Repository navigation
feat(verify): add the x-hub-signature verifier - #27
Merged
Merged
Conversation
TheGreatAxios
commented
Oct 15, 2026
TheGreatAxios
left a comment
Contributor
Author
There was a problem hiding this comment.
Review · Comment
Adds an x-hub-signature verifier: hex HMAC-SHA256 of the raw body against sha256=<hex>, header names from metadata.webhook.headers, delivery id as a 24h replay nonce, mail wrapped as {event, deliveryId, payload}.
Findings
src/resolve.ts:71— header names are only trimmed, not checked as valid header tokens. A typo such as"x-github event"makesHeaders.getthrow (Invalid header name: 'x github event'under Bun) atsrc/hooks.ts:89, so every request to that hook ends in an unhandled 500 instead of the documented 404 for a misconfigured credential. CouldparseHookHeadersreject names that fail/^[!#$%&'*+.^_|~0-9A-Za-z-]+$/` so the credential matches no hook, like a missing verifier?README.md:69— "the key stays held until it expires with its timestamp window" now also covers X-Hub-Signature keys, which have no timestamp and stay held for 24 hours. Worth saying so, since a GitHub manual redelivery after a crash gets409for a day.
Notes
- PR body has no
Closes <issue id>line, which CONTRIBUTING asks for. - No version bump in the branch, consistent with manual releases; this is additive, so the next release is a patch.
TheGreatAxios
force-pushed
the
x-hub-signature
branch
from
October 15, 2026 05:39
a110765 to
08f620f
Compare
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.
Adds
verify: "x-hub-signature": SHA-256 HMAC over the raw body compared in constant time againstsha256=<hex>, with the signature, event and delivery header names taken frommetadata.webhook.headers. Replay is keyed on the delivery id in the existing replay table for 24 hours and released on a failed delivery. The mail text is{"event","deliveryId","payload"}. A missing header or a non-JSON body answers 400. README documents the verifier, the headers field and the GitHub and Bitbucket Data Center header names.Verification:
bun run check(typecheck, lint, format, tests): 54 pass, 0 fail.