Express.js (Node.js) · CWE-347
Express.js: Webhook Signature & Replay Bypass
Reject forged, replayed, or cross-tenant webhook events reaching billing or provisioning handlers. Applied specifically to Express.js: Mount auth middleware ahead of resource handlers and validate raw webhook buffers.
Coverage ledger tracking key
surface:express::boundary:webhook-hmac::principal:req.user.id
API safe-mode test confirming unsigned or stale webhook deliveries fail closed with 401
Risk boundary
// Unverified Express.js path (CWE-347)
// Handler accepts client input without validating req.user.id or boundary invariants before sink.Hardened guard
// Hardened Express.js pattern (CWE-347)
// 1. Mount auth middleware ahead of resource handlers and validate raw webhook buffers
// 2. Compute HMAC over exact raw request bytes using timing-safe comparison plus a bounded timestamp window.Verification steps
- 01Seed coverage-ledger.json for every Express.js route handling this boundary.
- 02Inspect the code trace from request input down to the persistence or egress sink.
- 03Confirm with paired User A vs User B requests (or staging baseline-vs-payload replay) via business-logic-race-testing.