Skip to content

Require a signature when a signing secret is configured - #228

Merged
sophiecarreras merged 1 commit into
masterfrom
require-signature-when-secret-configured
Nov 2, 2026
Merged

sophiecarreras merged 1 commit into
masterfrom
require-signature-when-secret-configured

Conversation

@sophiecarreras

Copy link
Copy Markdown
Contributor

The three-argument B2EventNotification.parse overloads now require a signature header and a signing secret.
A missing or empty header throws B2SignatureVerificationException; a null or empty secret throws IllegalArgumentException.
Signature comparison is constant-time; comma-separated multi-signature headers still work.
Added parseUnverified for callers that intentionally skip verification; the one-argument parse overloads still work but are deprecated and their Javadoc is corrected.
Behaviour change noted in the CHANGELOG: receivers should answer HTTP 401 on B2SignatureVerificationException.

Tests: updated the tests that expected a missing header or secret to be accepted, and added tests for empty header, null/empty secret, multi-signature headers, wrong signature, and the unverified path.

🤖 Generated with Claude Code

The three-argument B2EventNotification.parse overloads now throw
B2SignatureVerificationException when the signature header is missing or
empty, and IllegalArgumentException when the signing secret is null or
empty. Signatures are compared in constant time. Add parseUnverified for
callers that intentionally skip verification, and deprecate the
one-argument parse overloads, whose Javadoc wrongly mentioned a check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sophiecarreras
sophiecarreras force-pushed the require-signature-when-secret-configured branch from f9fc792 to 2fcc3a1 Compare November 2, 2026 20:18
@sophiecarreras
sophiecarreras merged commit d3fe805 into master Nov 2, 2026
5 checks passed
@sophiecarreras
sophiecarreras deleted the require-signature-when-secret-configured branch November 2, 2026 21:08
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.

2 participants