Repository navigation
fix(import): trust a DMARC pass only from the pinned authserv-id - #248
Merged
Merged
Conversation
Fifth round of review feedback on the email import. - A dmarc=pass now counts only when the server named by EMAIL_IMPORT_AUTHSERV_ID stamped it; anyone can write a header claiming one. Other servers' results can still make the verdict stricter. Until the id is set, every pass reads as `unpinned` and nothing imports (EMAIL_IMPORT_ALLOW_MISSING_DMARC=1 is the explicit opt-out, warned on per email). Comma-joined repeated headers no longer borrow the receiver's authserv-id, and folded headers are unfolded. - The tight per-address limit on binding codes is now per reader and address (3 an hour), with a looser shared one (10 an hour), so one account can't lock an address's owner out of verifying. - A failed Wenqu search is logged; attachment links must be https. - The importer is split: saving and book matching move to save.ts and the logging helpers to log.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCcqmwTy6GqiC7gN4HCjMa
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
|
Review Solid hardening pass overall. Pinning the DMARC pass to the receiver's authserv-id is the right fix, and the comma and line-fold handling is careful. The split of import.ts into save.ts and log.ts reads well. I only read the code and didn't run the tests. Security
Quality
Tests
Point 1 is the main thing to settle before merging. The rest are small. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This follows up clippingkk/web#247, which was merged just before this commit landed. It addresses the fifth automated review on that PR.
Sender authentication
dmarc=passnow counts only when the server named byEMAIL_IMPORT_AUTHSERV_IDstamped it. Anyone can write anAuthentication-Resultsheader claiming a pass.unpinned.EMAIL_IMPORT_AUTHSERV_IDis set, nothing imports. The log says which variable to set.EMAIL_IMPORT_ALLOW_MISSING_DMARC=1is the explicit opt-out; it now also coversunpinnedpasses, with a WARN for each email.evil.example; dmarc=passcan't borrow the receiver's authserv-id.Binding codes
Smaller
https.import.tsis split: saving and book matching move tosave.ts, and the logging helpers tolog.ts.EMAIL_IMPORT_AUTHSERV_IDis marked required, with the new code-send limits and a note that each new code resets the attempt count.Deploy notes
Set
EMAIL_IMPORT_AUTHSERV_IDbefore expecting imports to work.Authentication-Resultsvalue.If there is no such header, only
EMAIL_IMPORT_ALLOW_MISSING_DMARC=1lets imports through; seedocs/email-import.mdfor the risk.Test plan
pnpm test: 86 files, 661 tests. New cases:pnpm lint,pnpm format:check,pnpm typecheck,pnpm typecheck:server🤖 Generated with Claude Code
https://claude.ai/code/session_01CCcqmwTy6GqiC7gN4HCjMa
Generated by Claude Code