Skip to content

fix(trailers): patch single-line bypass in shadow commit subjects - #2176

Open
Beehtrix wants to merge 2 commits into
entireio:fix/shadow-commit-trailer-forgeryfrom
Beehtrix:patch-3
Open

fix(trailers): patch single-line bypass in shadow commit subjects#2176
Beehtrix wants to merge 2 commits into
entireio:fix/shadow-commit-trailer-forgeryfrom
Beehtrix:patch-3

Conversation

@Beehtrix

Copy link
Copy Markdown

Edge case: a single-line bypass.

Because the regexes are anchored to the line-start, a hostile single-line subject that begins exactly with a trailer key (e.g., Entire-Session: attacker) is still evaluated as line 1 and successfully parsed as a trailer.

This layers onto your forgery fix by:

  • Updating flattenSubject() to check if the flattened subject starts with Entire-. If it does, it prepends (subject) to safely neutralize the line-start anchor.
  • Adding a regression test in trailer_forgery_test.go to explicitly pin this single-line bypass behavior.

The new forgery tests cover newline-based injection, but they don't cover the remaining bypass where the subject is a single line that begins with a trailer key (e.g. "Entire-Session: attacker"). Adding a regression assertion for that case will ensure the fix actually prevents line-start trailer forgery.
flattenSubject() collapses whitespace, but a hostile single-line subject that starts with an Entire trailer key (e.g. "Entire-Session: attacker") will still be parsed as the first trailer because the regexes are anchored to line-start and the subject is the first line. This leaves a trailer-forgery bypass even without newlines.
@Beehtrix
Beehtrix requested a review from a team as a code owner August 30, 2026 10:25
@Soph

Soph commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

These landed against feature branches rather than main - that's what the GitHub edit button does when you're browsing a branch. The branch owner has no way to find out: GitHub doesn't notify anyone when a PR is opened against their branch, and no cross-reference appears in the original PR's timeline either. For findings about unmerged work, a review comment on the original PR (with a suggested change) gets it to the person who can act on it and survives their next force-push. For findings about released code, open against main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants