Skip to content

security: validate inbound X-Request-Id#108

Closed
felixvippp-ai wants to merge 1 commit into
Agentpay-Org:mainfrom
felixvippp-ai:codex/request-id-sanitizer
Closed

security: validate inbound X-Request-Id#108
felixvippp-ai wants to merge 1 commit into
Agentpay-Org:mainfrom
felixvippp-ai:codex/request-id-sanitizer

Conversation

@felixvippp-ai

Copy link
Copy Markdown

Closes #96.

Summary

  • adds a sanitizeRequestId helper that only accepts caller-provided request IDs matching ^[A-Za-z0-9._-]{1,200}$
  • preserves valid gateway IDs and replaces missing, empty, oversized, CRLF, or other control-character values with a fresh UUID
  • documents the request ID policy in the README and covers header/error-body behavior with tests

Threat model note

Inbound X-Request-Id is echoed into response headers, structured logs, and error bodies. This change prevents CRLF/control-character injection from reaching those sinks while keeping the existing response shape unchanged.

Tests

  • npm.cmd run build
  • npm.cmd run lint
  • $env:NODE_ENV='test'; node --test dist/request-id.test.js
  • $env:NODE_ENV='test'; node --test dist/*.test.js dist/**/*.test.js

@mikewheeleer

Copy link
Copy Markdown
Contributor

thanks for the effort here @felixvippp-ai! 🙏 issue #96 isn't assigned to you, and we merge from the assigned contributor to keep the campaign fair. please claim an open unassigned issue first, then open your PR. closing this one for now — hope to see it back 🙌

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.

Validate the inbound X-Request-Id to prevent header/log injection via CRLF

2 participants