Skip to content

Test/2132 requestid middleware unit tests#2379

Open
aaniya22 wants to merge 2 commits into
gopaljilab:mainfrom
aaniya22:test/2132-requestid-middleware-unit-tests
Open

Test/2132 requestid middleware unit tests#2379
aaniya22 wants to merge 2 commits into
gopaljilab:mainfrom
aaniya22:test/2132-requestid-middleware-unit-tests

Conversation

@aaniya22

@aaniya22 aaniya22 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Adds unit tests documenting the current handling of a client-supplied X-Request-ID header in requestId middleware. This issue's core ask (UUID assignment, header set on response, existing header preserved, requestContext.run mocked/verified) is already covered by tests merged under #2217 (server/middleware/requestId.test.ts + requestId.integration.test.ts, commit 45cc9953). This PR adds coverage for a gap not previously tested: the middleware trusts a client-supplied ID with no sanitization, length limit, or format check — relevant given this issue's type:security label.

Related Issue

Relates to #2132

Type of Change

  • 🧪 Test addition or update

Changes Made

  • Added "requestIdMiddleware - client-supplied X-Request-ID validation (security)" test block in server/middleware/requestId.test.ts
  • Test: control characters (e.g. CRLF) in the header pass through unsanitized
  • Test: no length cap is enforced (10,000-char value accepted)
  • Test: no format/charset validation is performed (arbitrary non-UUID strings accepted)

Screenshots (if applicable)

N/A — test-only change

Testing

  • I have tested these changes locally
  • I have added/updated tests where applicable
  • All existing tests pass (12/12, including 9 pre-existing)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have updated the documentation if needed
  • My changes generate no new warnings or errors

Note for maintainers

These tests characterize existing behavior rather than fixing it — flagging for discussion on whether client-supplied X-Request-ID values should be validated/sanitized before being trusted. Leaving #2132 open rather than closing it, since the underlying security question isn't resolved yet, just documented.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

@aaniya22 is attempting to deploy a commit to the gopaljilab's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the type:security Vulnerability fixes or security-related enhancements. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:security Vulnerability fixes or security-related enhancements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant