Skip to content

fix(options): enforce RFC 7230 header name validation, reject boolean true, and clean up dead branches - #77

Open
mertcano wants to merge 1 commit into
uphold:masterfrom
mertcano:mertcano-patch-1
Open

mertcano wants to merge 1 commit into
uphold:masterfrom
mertcano:mertcano-patch-1

Conversation

@mertcano

@mertcano mertcano commented Oct 8, 2026

Copy link
Copy Markdown

Summary of Changes

Resolves F16 (Low) and F17 (Low) from the Uphold Workspace Security & Code Quality Audit:

  • RFC 7230 Header Name Enforcement (F16):
    • Added strict FIELD_NAME token grammar validation (/^[!#$%&'*+.^_|~0-9A-Za-z-]+$/) for exposeandheader` configuration options.
    • Explicitly rejects boolean true inputs, preventing misconfigurations from emitting literal true: <uuid> HTTP response headers.
  • Removed Unreachable Branch (F17):
    • Streamlined the ID fallback evaluation logic to eliminate unreachable dead-code paths after crypto.randomUUID().
  • Regression Coverage & Docs:
    • Added unit test cases covering boolean true rejections and malformed header names (bringing the suite to 22 passing tests).
    • Updated README.md option tables to document the tightened string | false contract.

Verification

  • node --test executed cleanly with 22 passing tests and 0 failures.

… true, and clean up dead branches

### Summary of Changes
Resolves **F16 (Low)** and **F17 (Low)** from the Uphold Workspace Security & Code Quality Audit:

- **RFC 7230 Header Name Enforcement (F16):**
  - Added strict `FIELD_NAME` token grammar validation (`/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/`) for `expose` and `header` configuration options.
  - Explicitly rejects boolean `true` inputs, preventing misconfigurations from emitting literal `true: <uuid>` HTTP response headers.
- **Removed Unreachable Branch (F17):**
  - Streamlined the ID fallback evaluation logic to eliminate unreachable dead-code paths after `crypto.randomUUID()`.
- **Regression Coverage & Docs:**
  - Added unit test cases covering boolean `true` rejections and malformed header names (bringing the suite to 22 passing tests).
  - Updated `README.md` option tables to document the tightened `string | false` contract.

### Verification
- `node --test` executed cleanly with 22 passing tests and 0 failures.

This branch has not been deployed

No deployments
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