Repository navigation
fix(email): Guard reply-one auto-reply against literal null/undefined signature leak - #56
Merged
tylermenezes merged 1 commit intoSep 18, 2026
Conversation
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.
Detail bug report: View on Detail
Bug
The reply-one auto-reply branch in
processPostmarkInboundEmail(src/email/postmark.ts) built its HTML body by raw-interpolatingproject?.event?.emailSignatureinto a JS template literal.Event.emailSignatureis nullable (DB defaultNULL), theProject → Eventrelation is optional, and the branch runs before the!projectguard — so when the signature isnull(or the project was deleted and the lookup returnsnull), the literal wordsnull/undefinedwere rendered into the user-visible email body, between the "you forgot to reply-all" line and the quoted reply. The same line hardened the sender name with|| 'CodeDay'but left the signature unguarded.Fix
Append
|| ''to the signature interpolation, mirroring the|| 'CodeDay'guard already on thefromfield two lines above and matching how every other email template renders the signature (Handlebars triple-stache{{{ event.emailSignature }}}, which also emits empty string for null/undefined).src/email/postmark.tswas the only site that interpolatedemailSignatureraw into HTML.Testing
tests/testPostmarkReplyOneLeak.ts(uses the repo'snode:testconvention, liketests/testSlackReporting.ts, with typedi mocks): asserts anullsignature doesn't leak"null", a deleted project doesn't leak"undefined", and a real signature still renders verbatim. Verified the suite catches the bug — reverting the one-line fix turns 3/3 pass into 1/3 fail (the two leak cases fail).tsc --noEmit --skipLibCheck, the CI gate) is clean.@typescript-eslint/parserdeprecation banner that fires identically on untouched files (e.g.tests/testSlackReporting.ts); no new violations from this change.prisma db push) seeding realEvent/Projectrows withemailSignature = NULLand a deleted project, invoking the realprocessPostmarkInboundEmailwith only the mail transport mocked: States A and C produced leak-free bodies, the sender name fell back toCodeDay, and a reply-all correctly skipped the auto-reply and persisted aProjectEmailrow. This E2E script was not versioned (it requires a live DB); the committed unit test is the maintained regression guard.Automatic Fixes PRs can be configured here.