Skip to content

fix: use constant-time compare for admin/webhook HMAC digests - #3964

Open
SashaMIT wants to merge 1 commit into
interledger:mainfrom
SashaMIT:fix/admin-api-hmac-timing-safe
Open

fix: use constant-time compare for admin/webhook HMAC digests#3964
SashaMIT wants to merge 1 commit into
interledger:mainfrom
SashaMIT:fix/admin-api-hmac-timing-safe

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Admin/tenant API HMAC verification (verifyApiSignatureDigest) and POS webhook HMAC used digest === signatureDigest (non-constant-time string compare).
  • IdP secret checks already use crypto.timingSafeEqual; align HMAC digest compares the same way (equal-length hex Buffers, fail closed on length/non-hex mismatch).
  • Update webhook docs examples that already recommend constant-time compare but showed ===.

Sibling surface to open #3963 (same auth/signature files; EXPIRE units).

Test plan

  • Helper semantics checked with Node (timingSafeEqual equal/unequal/short/non-hex)
  • pnpm exec jest src/shared/utils.test.ts / packages/auth tenant signature tests (needs Docker/testcontainers; not available in this agent environment)
  • Confirm docs examples render

Made with Cursor

Admin API and POS webhook signature verification compared hex digests with
===, which is not constant-time. IdP secret checks already use
crypto.timingSafeEqual. Align HMAC digest compares and docs examples.

Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
@netlify

netlify Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploy Preview for brilliant-pasca-3e80ec ready!

Name Link
🔨 Latest commit d327997
🔍 Latest deploy log https://app.netlify.com/projects/brilliant-pasca-3e80ec/deploys/6a775bff3ac16c0008bb2cec
😎 Deploy Preview https://deploy-preview-3964--brilliant-pasca-3e80ec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added pkg: backend Changes in the backend package. type: source Changes business logic pkg: auth Changes in the GNAP auth package. pkg: documentation Changes in the documentation package. labels Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: auth Changes in the GNAP auth package. pkg: backend Changes in the backend package. pkg: documentation Changes in the documentation package. type: source Changes business logic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant