GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers · Issue #2404 · developing-today/code

id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers #2404

New issue
Copy link
New issue
Copy link
Closed
#3423
Closed
id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers#2404
#3423
Copy link
Assignees
dezren39
Labels
app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Oct 29, 2026
Issue body actions

Problem

pkgs/id/src/directory_mail.rs defines three MailSinks for the same Mail { to, subject, body }, but only one of them validates the header fields:

  • SmtpSink::send (directory_mail.rs:148ff) refuses a non-ASCII or non-plain recipient (plain_address, :148-160), refuses a sender that is not a plain address at construction (:130-143), and refuses a subject containing any control character: "the subject has a line break or control character" (:161-164). The module's own test at :453 sends a smuggled [email protected]>\r\nRCPT TO:<[email protected] recipient and expects refusal.
  • OutboxSink::send (directory_mail.rs:58-76) performs no validation at all and interpolates both fields straight into the header block of the .eml file it writes:
write!(file, "To: {}\nSubject: {}\n\n{}", mail.to, mail.subject, mail.body)

A subject (or to) containing \n therefore forges arbitrary extra headers in the stored message — Bcc:, a second Content-Type:, or a whole second message after a blank line — in a file whose entire purpose is to be read/picked up as email. Mail's fields are pub (directory_mail.rs:23-31) and the sinks are the crate's public mail API, so the invariant the SMTP path enforces is silently absent for any present or future caller of the file sink (today's only in-tree caller, code_mail in directory_view.rs:1466, happens to pass a normalized address and a fixed subject — the sink itself guarantees nothing).

Evidence (verified this run, main 5a34fa70)

Laptop probe test added to the verbatim directory_mail.rs tests in a laptop worktree (file md5 58718d786ae90d6ea7cb65688cbc20e2, identical on sandbox main and the laptop; worktree removed after the run):

let sink = OutboxSink::new(dir.clone());
let mail = Mail {
    to: "[email protected]".into(),
    subject: "Your code\nBcc: [email protected]".into(),
    body: "hello".into(),
};
sink.send(&mail).unwrap();
// read back the single .eml file written
assert!(found.contains("\nBcc: [email protected]"));

Result: test directory_mail::tests::probe_outbox_writes_injected_header ... ok — the .eml on disk contains a real forged Bcc: header line. The same subject is refused by SmtpSink::send before any network I/O (control-character check), so the two sinks disagree on what a legal Mail is.

Existing tests cover the outbox happy path only (text.starts_with("To: [email protected]\nSubject: Your code\n\n"), :290); no test feeds a control character to OutboxSink.

Why it matters

The outbox directory is a trust boundary: files dropped there are mail. A header-forgery primitive in one sink but not its sibling is exactly the kind of inconsistency that gets exploited when a new caller (a world mail action with a user-chosen subject, a different confirmation flow) reuses the public sink trusting the module's established invariant. The fix is small and the invariant already exists in the same file — it should live in one place (on Mail construction or shared at the top of every send) instead of per-sink.

Acceptance criteria

  • OutboxSink::send refuses a Mail whose to is not a plain ASCII address or whose subject contains a control character, with the same error wording/classes as SmtpSink — or the validation moves to a single shared place (e.g. a checked Mail constructor / Mail::validate) that all three sinks use; either way, no sink writes unvalidated header fields.
  • A regression test mirrors the SMTP smuggling test (:453) for the outbox sink: a subject of "Your code\nBcc: [email protected]" and a recipient containing \r\n are both refused and no .eml file is created.
  • The legitimate path is unchanged: the existing outbox test (:290) and the directory confirmation flows (code_mail, directory_view.rs:1466 — normalized address, fixed subjects) pass unmodified.
  • Out of scope: CommandSink timeout behaviour (id(directory_mail): CommandSink has no timeout — a mail program that never exits hangs the directory request forever #1788) and the SMTP reply-reader bounds (id(directory_mail): SmtpSink's reply reader has no total deadline and no line bound — a trickling or never-terminating relay reply hangs the directory request forever #1899) — already tracked separately.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    developing-todayBot
    on Oct 29, 2026 – with developing.today
    Contributor
    More actions

    CODE-1226

  3. dezren39
    added
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    dezren39
    on Oct 29, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator (lane B, new-issue-creator-code-b)
    • Session / ID: cron job new-issue-creator-code-b, run 2026-10-29T18:20Z
    • Found via: filed this run
    • Task: Triage the missing header-field validation in OutboxSink::send (pkgs/id/src/directory_mail.rs:58-76) — it interpolates to/subject into the .eml header block unchecked while SmtpSink in the same file refuses control characters and non-plain addresses; pin whether validation is per-sink or shared on Mail, then route a small_fix packet.
    • Expectation: effort/xs — done when the validation home is pinned and a fix packet with the no-file-created regression test is routed.
    • Links: evidence in issue body; laptop probe test in a disposable laptop worktree (directory_mail.rs md5 58718d786ae90d6ea7cb65688cbc20e2, identical to main 5a34fa7): OutboxSink wrote a forged Bcc: header line from a newline-bearing subject, probe test passed, worktree removed.
  5. github-actions
    assigned
    dezren39
    on Oct 29, 2026
  6. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  7. 11 remaining items

  8. developing-today
    added
    status:in-review
    on Nov 1, 2026
  9. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  10. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code (OpenChamber scheduled lane)
    • Session / ID: ses_e5e69ce4cf3ffe9cJArm136X7o · queue task 5279
    • Found via: repo-health-code-pilot atomic claim; fix packet from task 3576
    • Task: Shared header-field validation now runs before OutboxSink file creation and before SmtpSink network activity. CommandSink remains unchanged. Both injection tests and existing directory_mail tests pass.
    • Result: PR fix(id): validate outbox mail headers (#2404) #3423 is open at bb7e92d. Fresh PR state is mergeable with no reported checks; queue task 5279 completed as pr_opened.
    • Links: fix(id): validate outbox mail headers (#2404) #3423 · id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers #2404
  11. dezren39 commented on Nov 3, 2026

    @dezren39
    dezren39
    on Nov 3, 2026
    MemberAuthor
    More actions

    agent-note:v1
    state: triaged (coverage pass) — fix already written, shepherd enqueued
    Agent: queue worker (repo-worker-code), OpenChamber scheduled lane 02cafe76
    Found via: queue claim (task 7916, triage)

    Verdict: still live and already fixed in an open PR; the gap is that nobody is shepherding it. Follow-up enqueued as task 8166.

    • PR fix(id): validate outbox mail headers (#2404) #3423 (fix(id): validate outbox mail headers, head bb7e92d, pkgs/id/src/directory_mail.rs +44/-13) is the fix from queue task 5279 (2026-11-01): shared header validation now runs before OutboxSink creates the .eml and before SmtpSink opens the network, with the injection regression test.
    • It is two days old with no workflow checks recorded (gh pr checks: only CodeRabbit skipping), so it needs main merged in and the policy check set run before merging. Task 8166 shepherds that; it must not re-implement.
    • id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers #2404 stays open until fix(id): validate outbox mail headers (#2404) #3423 merges; closing evidence goes on the issue with the merge sha.
  12. dezren39
    added
    queue/queuedHas a queued queue task
    status/needs-triageNot yet triaged; needs a first look
    on Nov 3, 2026
  13. developing-today commented on Nov 3, 2026

    @developing-today
    developing-todayBot
    on Nov 3, 2026 – with developing.today
    Contributor
    More actions

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 30 (priority/low). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  14. dezren39
    added a commit that references this issue on Nov 3, 2026

    Merge pull request #3423 from developing-today/queue/5279-2404-outbox…

    3e65e3f
  15. dezren39
    closed this as completedin #3423on Nov 3, 2026
  16. dezren39 commented on Nov 3, 2026

    @dezren39
    dezren39
    on Nov 3, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-i
    • Session / ID: task 8166 (pr_shepherd for PR fix(id): validate outbox mail headers (#2404) #3423)
    • Found via: queue claim
    • Task: Issue id(directory_mail): OutboxSink writes To/Subject into the .eml header block with none of SmtpSink's validation — a newline in either forges arbitrary headers #2404 is fixed and closed: PR fix(id): validate outbox mail headers (#2404) #3423 merged as 3e65e3f3ba6e9939af954f2d5d5657116201a704.
    • Expectation: done — OutboxSink now runs the shared Mail::validate_header_fields before creating the .eml file, so a newline in To/Subject can no longer forge headers; the two injection regressions are in the test suite (directory_mail: 20 passed / 0 failed on the laptop after the shepherd's conflict resolution against current main).
  17. dezren39
    removed
    status:in-review
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.