Skip to content

feat(http/unstable): add RFC 9530 digest fields#7037

Open
tomas-zijdemans wants to merge 10 commits into
denoland:mainfrom
tomas-zijdemans:digest-fields
Open

feat(http/unstable): add RFC 9530 digest fields#7037
tomas-zijdemans wants to merge 10 commits into
denoland:mainfrom
tomas-zijdemans:digest-fields

Conversation

@tomas-zijdemans

@tomas-zijdemans tomas-zijdemans commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Adds an unstable @std/http/unstable-digest-fields module for creating and verifying RFC 9530 Content-Digest and Repr-Digest field values.

RFC 9530, an IETF standards-track RFC from Feb 2024, replaces the legacy RFC 3230 Digest field with Structured Fields based digest headers for HTTP content and representation integrity. These helpers support creating digest values from strings, bytes, or streams, and verifying Request / Response bodies without consuming the original body.

This is also useful with HTTP Message Signatures (RFC 9421), where a signed digest field can bind the signature to the message body. The implementation is small and browser-compatible, reusing existing @std primitives: timing-safe-equal, unstable-structured-fields, and to-bytes.

@tomas-zijdemans tomas-zijdemans requested a review from kt3k as a code owner March 9, 2026 13:33
@github-actions github-actions Bot added the http label Mar 9, 2026
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.59%. Comparing base (f0c9f14) to head (5749927).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7037      +/-   ##
==========================================
+ Coverage   94.57%   94.59%   +0.01%     
==========================================
  Files         636      637       +1     
  Lines       52138    52283     +145     
  Branches     9399     9431      +32     
==========================================
+ Hits        49311    49456     +145     
  Misses       2249     2249              
  Partials      578      578              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomas-zijdemans

Copy link
Copy Markdown
Contributor Author

Updated to use the stable toBytes

@tomas-zijdemans

Copy link
Copy Markdown
Contributor Author

Parsing has been hardened and docs improved. Ready for review @bartlomieju

@fibibot fibibot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI green. The new unstable module is wired only via http/deno.json ./unstable-digest-fields, not re-exported from mod.ts. Symbols have @experimental, JSDoc, and per-symbol examples with @std/assert assertions.

parseDigestHeaderValue runs before any body access — the streaming-body tests at lines 380-413 confirm malformed headers don't drain the request body. Subtle but correct.

  • nit: verifyDigestHeader reads the whole body via message.clone().bytes(). The doc already warns about content-encoded responses; worth also flagging the in-memory cost for large bodies.
  • nit: the module-level "Creating a Content-Digest header" example (lines 12-23) builds a Request but doesn't assert anything; per-symbol examples below do.

@fibibot

fibibot commented May 13, 2026

Copy link
Copy Markdown

@bartlomieju this is ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants