Skip to content

security: reject unsafe incoming request IDs - #25

Merged
isthatpratham merged 1 commit into
mainfrom
security/request-id-validation
Aug 30, 2026
Merged

isthatpratham merged 1 commit into
mainfrom
security/request-id-validation

Conversation

@isthatpratham

Copy link
Copy Markdown
Owner

Summary

  • Incoming X-Request-Id is accepted only when it matches [A-Za-z0-9._-]{1,128}
  • Newlines, JSON, HTML, and other payloads are replaced with a generated UUID
  • Safe client IDs such as client-trace-123 are still preserved

Testing

  • npm test -- src/__tests__/requestId.test.ts — 5 tests passed

Only honor X-Request-Id values that match a conservative token charset. Anything else is replaced with a generated UUID so logs and response headers cannot carry injection payloads.
@isthatpratham
isthatpratham merged commit 0206ceb into main Aug 30, 2026
1 check passed
@isthatpratham
isthatpratham deleted the security/request-id-validation branch August 30, 2026 23:41
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.

1 participant