Repository navigation
feat(mediator): sign each kind of mediator call with its own secret - #58
Merged
Merged
Conversation
Add optional MEDIATOR_OPERATOR_SECRET, MEDIATOR_VERIFY_PATCH_SECRET and
MEDIATOR_RECEIPTS_SECRET, matching the mediator's settings of the same
names. Operator-route calls and verify-patch are signed with their own
secret when it is set and with MEDIATOR_WEBHOOK_SECRET otherwise, so
nothing changes while the new settings are empty. Signature formats are
unchanged.
No code in this repository issues receipts; signing_secret("receipts")
resolves that secret the same way for a receipt client.
The fix-verifier preflight accepts the verify-patch and receipts secrets
together in place of MEDIATOR_WEBHOOK_SECRET, so the backend no longer has
to hold the exchange's webhook secret.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The backend signs every call to the mediator with
MEDIATOR_WEBHOOK_SECRET, the same secret the exchange uses for its webhooks. The mediator is gaining optional per-purpose secrets (a2a-settlement/a2a-settlement-mediator#15); this is the matching client change.Change
Three optional settings in
Settings, each defaulting to empty and matching the mediator's setting of the same name:MEDIATOR_OPERATOR_SECRET/mediate/{id},/audits/{id}(v2=signature)MEDIATOR_VERIFY_PATCH_SECRETPOST /api/v1/verify-patchMEDIATOR_RECEIPTS_SECRETPOST /api/v1/receiptsmediator.signing_secret(purpose)returns the purpose's own secret when it is set andMEDIATOR_WEBHOOK_SECRETotherwise._operator_headersandverify_patchuse it. With the new settings empty, every call is signed exactly as before; the signature formats do not change.No code in this repository issues receipts.
MEDIATOR_RECEIPTS_SECRETandsigning_secret("receipts")are there so a receipt client resolves its secret the same way. Until such a client uses it, do not setMEDIATOR_RECEIPTS_SECRETon the mediator for a caller that still signs with the webhook secret.Unchanged edge cases: operator calls are still sent unsigned when no secret resolves (local development), and
verify_patchstill raisesMEDIATOR_WEBHOOK_SECRET not configuredwhen none resolves.Fix-verifier preflight
_check_mediatorrequiredMEDIATOR_WEBHOOK_SECRET. It still passes when that is set. When it is empty it now also passes ifMEDIATOR_VERIFY_PATCH_SECRETandMEDIATOR_RECEIPTS_SECRETare both set, so a backend that has moved to per-purpose secrets no longer has to hold the exchange's webhook secret. With one of the two missing, the error names it. With all three empty the error text is the same as before.Rollout
Set the per-purpose secrets on the mediator first, with its transition setting on, then here. The steps are in the mediator's
SECURITY.md.Docs
.env.example, and the settings table and mediator-client paragraph indocs/cyber/legal-review-packet.md.Tests
backend/tests/test_mediator_purpose_secrets.py: defaults; fallback and precedence per purpose; operator calls and verify-patch signed with their own secret and not with any other; behaviour with no webhook secret; no secret value on the wire.backend/tests/test_fix_verifier_preflight.py: the new preflight cases.Backend suite: 2132 passed locally.
🤖 Generated with Claude Code