Skip to content

fix(http-signature-utils): require content-digest when request body present - #38

Open
SashaMIT wants to merge 1 commit into
interledger:mainfrom
SashaMIT:fix/require-content-digest-when-body-present
Open

fix(http-signature-utils): require content-digest when request body present#38
SashaMIT wants to merge 1 commit into
interledger:mainfrom
SashaMIT:fix/require-content-digest-when-body-present

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 8, 2026

Copy link
Copy Markdown

Changes proposed in this pull request

When a request has a body, validateSigInputComponents now requires content-digest to be covered by Signature-Input and verified (along with content-length / content-type). Previously, omitting content-digest failed open: a Signature-Input covering only @method / @target-uri / etc. could validate while the body was swapped.

Also fixes the existing regression test titled "fails if content-digest is missing while body is present": the shared fixture always set Authorization, so the case failed on the auth-component check rather than the digest check. The test now runs without Authorization so it actually asserts the digest requirement.

Context

Sibling of interledger/open-payments-go#50 (Go already requires content-digest when a body is present). Tip verified at a08efc2758b743abae0d6979c3c6083dd2198263.

Verified locally: pnpm test in packages/http-signature-utils (30 passed).

Test plan

  • pnpm test in packages/http-signature-utils
  • CI green on this PR
  • Confirm consumers that call validateSignature / validateSigInputComponents with bodied requests include content-digest in Signature-Input (expected for Open Payments / GNAP)

Made with Cursor

…resent

Signature-Input that omitted content-digest previously validated when a
body was present (fail-open), allowing the body to be swapped under an
otherwise valid signature. Align with open-payments-go: if the request
has a body, content-digest must be covered and verified.

Also fix the regression test so it exercises the digest check without
an Authorization header (the shared fixture previously failed for the
wrong reason).
@changeset-bot

changeset-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1734392

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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