Skip to content

feat(routing): raw headers and opt-in raw body for webhook verification#1488

Merged
kkopanidis merged 8 commits into
mainfrom
feat/raw-headers-raw-body-webhook-routes
Jun 23, 2026
Merged

feat(routing): raw headers and opt-in raw body for webhook verification#1488
kkopanidis merged 8 commits into
mainfrom
feat/raw-headers-raw-body-webhook-routes

Conversation

@ChrisPdgn

@ChrisPdgn ChrisPdgn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Forward sanitized rawHeaders and opt-in rawBody through Hermes/gRPC so webhook routes can verify signatures.
  • Add captureRawBody to routing types and proto definitions, including the follow-up proto fix.
  • Keep stripped/security-sensitive headers out of forwarded rawHeaders.

Test plan

  • Manual webhook signature verification with captureRawBody: true
  • Confirm stripped credentials are omitted from rawHeaders

ChrisPdgn and others added 3 commits June 18, 2026 17:25
Enable webhook signature verification by piping sanitized req.rawHeaders
through gRPC and adding captureRawBody for unmodified request bytes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Clear CodeFactor no-unused-vars findings for Request and Indexable.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ChrisPdgn
ChrisPdgn marked this pull request as ready for review June 19, 2026 13:48
Add captureRawHeaders opt-in flag, urlencoded rawBody verify, per-route
gating with early buffer release, and defensive sanitizeRawHeaders guard.
@kkopanidis

Copy link
Copy Markdown
Contributor

@ChrisPdgn — follow-up commit pushed addressing review feedback from the three-horsemen review:

  • captureRawHeaders opt-in flag (proto field 15, RouteBuilder helpers) — raw headers only forwarded over gRPC when enabled
  • Form-encoded webhook support — shared captureRequestRawBody verify on both express.json and express.urlencoded
  • Per-route gating — strips rawBody/rawHeaders when flags are off; clears req.rawBody early to release buffer reference
  • sanitizeRawHeaders guard — safe on missing rawHeaders (mocks/tests)
  • GrpcConverter — skips serializing empty rawHeaders arrays

Webhook routes should use both:

.captureRawBody(true)
.captureRawHeaders(true)

Ready for your review when you have a moment.

ChrisPdgn and others added 3 commits June 23, 2026 12:38
Add express.raw() middleware before express.json() so routes with
captureRawBody: true receive rawBody for application/xml,
application/octet-stream, and other non-standard content types.

Co-authored-by: Cursor <cursoragent@cursor.com>
…-capture-gating-6d8d

fix(routing): capture raw body for non-JSON webhook content types
@kkopanidis
kkopanidis merged commit b366071 into main Jun 23, 2026
8 checks passed
@kkopanidis
kkopanidis deleted the feat/raw-headers-raw-body-webhook-routes branch June 23, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants