Skip to content

[2026.10.9] fix(imap): backport nodemailer sender parsing fixes to 2026.10.9 - #187302

Merged
RomneyDa merged 6 commits into
release/2026.10.9from
security/mail-parser-stable-20261029
Oct 29, 2026
Merged

RomneyDa merged 6 commits into
release/2026.10.9from
security/mail-parser-stable-20261029

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Summary

  • Pin only [email protected]>nodemailer and [email protected]>nodemailer to 10.1.4 (train previously resolves 10.0.13); regenerate the corresponding narrow lock entries.
  • Add real inbound parser/authenticator regression fixtures and exercise existing IMAP sender admission. No production gate changes, blanket override, or unrelated dependency edits.
  • Target: release/2026.10.8, verified baseline 5413218. Local package adaptation, not an upstream OpenClaw cherry-pick.

Security boundary and proof

IMAP watcher calls mailparser.simpleParser(message.source) before evaluateImapSender. The baseline nested-comment fixture parses the attacker mailbox as [email protected] and the real sender gate incorrectly accepts it using the recipient token. Fixed parsing rejects it before authentication. Quoted-angle and quoted-group fixtures additionally verify that both mailparser- and mailauth-resolved address parsers retain the actual sender identity; real mailauth.authenticate sees the attacker headerFrom.

The grouped From fixture remains rejected as invalid-from: a group has no top-level mailbox. Only the parser identity assertion flattens group members. Neither production admission nor the test expectation permits a grouped From. The quoted-angle fixture is parser identity coverage, not a claimed baseline gate bypass.

Upstream provenance

Nodemailer 10.1.4 registry gitHead: 2a7e95294d2a4995a19e9009379daf650cdc80e6. Source author Andris Reinman [email protected]; original patch headers also retain upstream co-authorship. Relevant later advisory fixes:

  • 0a8761762ac78f2db2ba37f712f2a52a404ce011 — nested comments; GHSA-8c8m-p3m8-cjg8.
  • 1cd57d2b8c49dff048c21cdbafdb54439a7f07e2 — quoted angle/group boundaries; GHSA-85x2-q946-cp5h and GHSA-m943-m63m-w62w.
  • ee35f5745658bf46952651fa53207255e9dc3406 — unexpected angle handling outside quoted/comment contexts.
    Earlier included repairs a502247555fd81773eac337486781f3b6008e16a (angle comments) and b5a896fcb02df1628329d7cd665ca08490b14b56 (SMTP AUTH regex) are already fixed in these train baselines, not newly claimed inbound exploits.

Upstream patches: nodemailer/nodemailer@0a87617 and nodemailer/nodemailer@1cd57d2 . Registry integrity is verified against the lock. Original source/proof trees and #186177 are untouched.

Validation

  • Corrected unchanged regression script against baseline frozen install: 4/4 fail on the intended parser/authenticator identities.
  • Corrected real IMAP baseline suite: 40 pass / 1 fail, exposing actual nested-comment token admission.
  • Fixed frozen install (--ignore-scripts): pass. Standalone parser/authenticator regression: 4/4 pass. Existing sender-gate/watcher suites: 41/41 pass. Targeted format/lint, syntax and diff checks: pass. Focused fixed IMAP run: 28.90s wrapper wall time (27.28s Vitest); standalone script under 0.2s. Exact receipts retained in the train clone's .openclaw-evidence directory. Earlier incorrect fixture failures remain preserved separately, not waived or relabeled. Stable also retains an intermediate compiler-snapshot failure caused by writing a new evidence JSON during compilation; the unchanged-source retry passed with a stable file namespace.

Status / remaining gates

DRAFT ONLY. Scoped local precommit review is not canonical independent full-context review. That review and hosted checks remain required before ready-for-review or landing. No merge, release, tag, force-push, or gate changes authorized/performed. This PR is intentionally four files; other active-train/security work remains separately owned.

shakkernerd and others added 2 commits October 27, 2026 13:12
Passive macOS Gateway stops now preserve an absent current-profile service definition without invoking uninstall, while explicit low-level ghost recovery remains available.

Release adaptation: the 2026.10.8 backport of #180390 removed the absent-plist
guard from GatewayLaunchAgentManager's disable path without main's follow-up,
so every passive stop with no LaunchAgent plist ran `openclaw gateway uninstall`
(mac validation: GatewayProcessManagerTests "pause preserves unretainable
services" [absent]). Stable has no migration-pending custody or `.authority`
wrapper, so the guard checks `custody.definition.plist` directly. Mac-only
post-tag fix; npm, Docker and Linux bytes are unaffected.

(cherry picked from commit cb10ec4)
Locally adapt the mailauth/mailparser scoped package selectors; not an upstream OpenClaw cherry-pick. Add real sender identity and token-gate regressions.

Upstream-author: Andris Reinman <[email protected]>
Upstream-commits: 0a8761762ac78f2db2ba37f712f2a52a404ce011, 1cd57d2b8c49dff048c21cdbafdb54439a7f07e2, ee35f5745658bf46952651fa53207255e9dc3406
Upstream-package-gitHead: 2a7e95294d2a4995a19e9009379daf650cdc80e6

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@RomneyDa
RomneyDa marked this pull request as ready for review October 29, 2026 04:34
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR updates Nodemailer beneath both inbound mail consumers to preserve sender identity and adds parsing and admission regressions.

Example: Mail uses From: Attacker (x(y) <[email protected]>) <[email protected]> and To: [email protected].

  • Before: The reported baseline parses [email protected] as the sender and admits the message using its sender-bound token.
  • After: The updated parser preserves [email protected], so the existing allowlist rejects the message.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-supported, but required authorization proof is incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A malformed From header can make an attacker appear to be an allowlisted sender and admit their email to an agent.
Reason: The maintainer-authored change repairs a documented sender-identity invariant using narrow upstream dependency updates.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this useful, maintainer-authored stable-line security backport open; source review found no definite introduced defect.

Priority: P1
Reviewed head: c2ba275128c34a7e96d8e7d17a928c6bd166d752

Before merge

  • Add real behavior proof - Authority-chain proof required: the parser and sender-gate regressions exercise real parsing, but the supplied material does not demonstrate the nested-comment attacker being rejected before dispatchHookAgentTurn alongside legitimate sender admission through the production watcher; local receipt locations are not inspectable artifacts. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - Upstream provenance and package integrity check out, while final-effect sender authorization needs evidence.
  • Resolve merge risk - The PR owner must establish that the changed sender interpretation permits legitimate mail and prevents spoofed mail from reaching hook dispatch.

Findings

None.

Tests

  • Missing end-to-end proof: Supply final-effect evidence through the production watcher showing legitimate sender admission and nested-comment attacker rejection before hook dispatch; redact credentials and non-public endpoints.
Agent review details

How this fits together

The IMAP watcher parses mailbox messages with Mailparser, checks sender identity and authentication, and dispatches accepted messages to an isolated hook agent.

flowchart LR
  A[IMAP message] --> B[Mailparser and Nodemailer]
  B --> C[Sender allowlist]
  C --> D[Token or Mailauth verification]
  D --> E[Hook dispatch]
  C --> F[Recorded rejection]
  D --> F
Loading

Technical review

Best possible solution:

Keep sender parsing in Nodemailer and preserve the existing IMAP admission policy through the scoped dependency update.

Do we have a high-confidence way to reproduce the issue?

The upstream tokenizer repair and existing token-admission path support the reported nested-comment bypass; the author reports failing baseline runs, but this read-only review executed no reproduction.

Is this the best way to solve the issue?

Updating the shared parser beneath both inbound consumers fixes identity at its producer without adding another admission policy or weakening grouped-From rejection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 54818f9e6756.

Merge-risk options

Maintainer options:

  1. Demonstrate sender authorization at dispatch (recommended)
    The PR owner should exercise legitimate token mail and the nested-comment attacker through the production watcher, recording permitted dispatch and rejection before dispatch respectively.

Provenance checked

  • Inbound Nodemailer dependency resolutions keeps the original intent (09fbd7b: The dependency refresh selected compatible cooled versions and retained a scoped Mailauth override; earlier security work already established updating both inbound consumers.)

Testing

Proof path: in-process harness.

Security

Needs attention: Upstream provenance and package integrity check out, while final-effect sender authorization needs evidence.

Evidence

What I checked:

  • Scoped dependency repair: The introduced diff changes only the two consumer-scoped Nodemailer resolutions and adds parser/authenticator and sender-admission coverage; no production admission policy changes. (pnpm-workspace.yaml:69, c2ba275128c3)
  • Authorization boundary: The parsed From mailbox controls allowlist and sender-bound token admission; the watcher returns on rejection before dispatchHookAgentTurn. (extensions/imap/src/watcher.ts:344, c2ba275128c3)
  • Supplied proof coverage: The full body reports baseline failures and fixed parser/sender-gate/watcher passes, but supplies no inspectable final-dispatch trace for the malformed sender; comments add no behavior artifact. (extensions/imap/src/sender-gate.test.ts:30, c2ba275128c3)
  • Authoritative upstream parser repair: OpenClaw's inbound consumers execute this parser, establishing the dependency contract: the upstream change tracks nested comment depth instead of exposing comment-contained addresses as header text. (src/addressparser/index.ts, 0a8761762ac7)
  • Quoted-boundary repair and package identity: The upstream change preserves quoted angle and group boundaries; npm metadata for 10.1.4 matches the PR's gitHead and lockfile integrity and retains CommonJS addressparser exports. (src/addressparser/index.ts, 1cd57d2b8c49)
  • Release and main distinction: The published stable tag retains the 10.0.13 override; fetched main resolves Mailauth through Nodemailer 10.1.0 and Mailparser through 10.1.7, so main does not establish completion of this stable backport. (pnpm-lock.yaml, 54818f9e6756)

PR surface

Tests +23, Config +1, Other +56. Total +80 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 23 0 +23
Docs 0 0 0 0
Config 1 2 1 +1
Generated 0 0 0 0
Other 2 62 6 +56
Total 4 87 7 +80

Labels

Label changes:

  • add P1: The stable-line report identifies incorrect sender interpretation that can bypass sender-bound admission and trigger an agent turn.
  • add merge-risk: 🚨 security-boundary: Changing the parsed principal changes hook authorization, and supplied evidence does not reach the final dispatch boundary for the malformed sender.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P1: The stable-line report identifies incorrect sender interpretation that can bypass sender-bound admission and trigger an agent turn.
  • merge-risk: 🚨 security-boundary: Changing the parsed principal changes hook authorization, and supplied evidence does not reach the final dispatch boundary for the malformed sender.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof through the production watcher showing legitimate token mail dispatches and the nested-comment attacker cannot dispatch.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 29, 2026, 12:40 AM ET / 04:40 UTC.

roboclaw-bot and others added 2 commits October 29, 2026 05:01
Exercise the real TCP IMAP connection, parser, watcher and admission boundary with legitimate and nested-comment spoofed senders sharing a recipient token.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa
RomneyDa changed the base branch from release/2026.10.8 to release/2026.10.9 October 29, 2026 05:08
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Oct 29, 2026
@RomneyDa RomneyDa changed the title fix(imap): backport nodemailer sender parsing fixes to 2026.10.8 [2026.10.9] fix(imap): backport nodemailer sender parsing fixes to 2026.10.9 Oct 29, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the app: macos App: macos label Oct 29, 2026
@RomneyDa
RomneyDa merged commit 4b8ddaf into release/2026.10.9 Oct 29, 2026
121 checks passed
@RomneyDa
RomneyDa deleted the security/mail-parser-stable-20261029 branch October 29, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. plugin: imap rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants