Skip to content

feat(webhooks): enforce origin and audience claims on all webhook JWTs (Closes #2274) - #2312

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2274-jwt-claims
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2274-jwt-claims

Conversation

@IVANLI2412

Copy link
Copy Markdown
Contributor

Closes #2274

Summary

  • Adds a zero-dependency webhook JWT claim validator in backend/src/webhooks/jwt.ts: strict Base64URL + UTF-8 decoding (incl. astral/surrogate pairs), aud, orig, iss, exp/nbf validation against a compiled policy, origin normalization (scheme+host+port, http/https only), stable typed error codes, and metrics/logger observability hooks. Signature verification is delegated to the caller's JOSE layer.
  • Adds backend/src/webhooks/dispatcher.ts: gates webhook delivery on validated claims before invoking handlers, with signature + split hooks, handler registration, typed dispatch errors, and metrics/logger on every path.
  • Jest tests: __tests__/jwt.test.ts (42 assertions) + __tests__/dispatcher.test.ts (7 assertions) covering happy paths and failure modes. Standalone Node-26 verification harness: 71/71 assertions pass.

Acceptance criteria

  • Focused production-ready implementation; no orphan scripts/TODOs.
  • Tests cover happy path + realistic failure modes; run clean locally.
  • Observability via metrics/logger hooks on all validation/dispatch paths.
  • API documented inline via JSDoc (no new .md files).
  • Branch created from upstream/main; target is upstream repo.

Payout addresses

  • Base Mainnet (USDC/ETH): 0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868
  • Solana (USDC/SOL): DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5
  • PayPal: ivanzenteno3@gmail.com

@github-actions
github-actions Bot merged commit 6ddf329 into Smartdevs17:main Nov 24, 2026
7 of 27 checks passed
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.

Enforce origin and audience claims on all webhook JWTs

1 participant