Repository navigation
refactor(mcpbroker): fence the AS-2 trust test seam and share its defaults - #2794
Merged
Merged
Conversation
ChrisJBurns
force-pushed
the
feat/identitybroker-per-call-grant
branch
from
November 16, 2026 11:12
4cec7cd to
c135ad2
Compare
ChrisJBurns
force-pushed
the
fix/2535-review-followups
branch
from
November 16, 2026 11:12
b37200e to
8ee1f7b
Compare
ChrisJBurns
force-pushed
the
feat/identitybroker-per-call-grant
branch
from
November 16, 2026 12:01
c135ad2 to
04257a1
Compare
ChrisJBurns
force-pushed
the
fix/2535-review-followups
branch
from
November 16, 2026 12:04
9eee8c0 to
0251594
Compare
ChrisJBurns
force-pushed
the
feat/identitybroker-per-call-grant
branch
from
November 16, 2026 12:28
04257a1 to
b630101
Compare
ChrisJBurns
force-pushed
the
fix/2535-review-followups
branch
from
November 16, 2026 12:29
0251594 to
36793ca
Compare
A depguard rule lets only toolhive_construction.go and mcpbrokertest import the as2trust package outside tests, so no other production code in the adapter can build a trusting AS2Trust. Record that the field goes with #2533. Co-authored-by: Mecatl <noreply@mecatl.dev>
mcpbrokertest.StartAS2 and the adapter's own newTrustingAS2 now build the trust through as2trust.Trust.WithDefaults. The adapter's tests cannot call StartAS2 (mcpbrokertest imports the adapter), so newTrustingAS2 says so. Co-authored-by: Mecatl <noreply@mecatl.dev>
Address review comments on #2785: - DecisionRecord.OwnerVerified says whether Owner is the owner the broker verified at session open or only the one mecak8s reported, as audit subjects must say (audit.md). - Pin that check 3 comes before check 6: an expired credential for an unrouted server is refused as svid_expired. - ArgumentsSHA256 points at the design's definition of the argument hash. Co-authored-by: Mecatl <noreply@mecatl.dev>
…lowances Address review comments on #2786: - The retry-allowance table now checks one decision matching the returned error, one ID-JAG record per issued ID-JAG, no token on failure, and that the try after a revoked grant presents the session's new grant. - Mark the dropped AS-2 error_uri as a shortcut removed by #2735. - CloseSession's comment says a call in progress is refused at its next session check and gets no token. Co-authored-by: Mecatl <noreply@mecatl.dev>
gatewayTokenExpiry read the gateway token's exp through readJWTRef, which gives up when the token has no jti, so ExpiresAt could outlast the token. readJWTExp reads exp on its own. Originally #2792, by Jakub Hrozek; folded into the #2535 follow-up after (cherry picked from commit f437b4e) Co-authored-by: Mecatl <noreply@mecatl.dev>
The rejected-token retry test changed only the tool; it now checks a report that differs in each field of the attempt key, including a second agent in the same session. Originally #2792, by Jakub Hrozek; folded into the #2535 follow-up after (cherry picked from commit 385ef77) Co-authored-by: Mecatl <noreply@mecatl.dev>
…be ExpiresAt The ledger test now checks each call-key field on its own, and the ExpiresAt comment says it is the broker's use-before deadline, not the token's own expiry. Originally #2792, by Jakub Hrozek; folded into the #2535 follow-up after (cherry picked from commit b41ccf2) Co-authored-by: Mecatl <noreply@mecatl.dev>
ChrisJBurns
force-pushed
the
fix/2535-review-followups
branch
from
November 16, 2026 13:04
d8977f6 to
3ceed66
Compare
ChrisJBurns
enabled auto-merge (squash)
November 16, 2026 13:10
Merged
2 tasks
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.
Follow-up to jhrozek's review comments on #2784, #2785, and #2786, on top of the last PR in the #2535 stack (#2783).
AS-2 trust reachable from production code (comment)
as2trust.Trust, and depguard keeps production code from importingmcpbrokertest. The gap was other production files inside the adapter.internal-adapter-mcpbroker-as2trust-importers: outside tests, onlytoolhive_construction.goandmcpbrokertestmay importas2trust. Go imports are per file, so no other production file can build a trustingAS2Trust. Verified by plantingNewAS2Trust(as2trust.Trust{...})in a production file of the adapter: depguard refuses it.ToolHiveConfig.AS2Trustnow says it is removed with Configure the embedded gateway's authorization server as AS-2 #2533 (the shortcut is marked onapp.Config.IdentityBrokerAS2Trust).Duplicated trusting-AS-2 setup (comment)
as2_test.goispackage mcpbroker, andmcpbrokertestimportsmcpbroker, so those tests can't callStartAS2(import cycle). Moving them to an external test package would need shims for about ten unexported helpers.as2trust.Trust.WithDefaults(one default forMaxAssertionAge, one copy ofSubjects), andnewTrustingAS2documents that it is the in-package counterpart ofStartAS2and why.#2785: decision record owner (comment)
DecisionRecord.OwnerVerifiedsays whetherOwneris the owner the broker verified at session open or only what mecak8s reported, so Broker records of who acted #2541 can mark audit subjectsverifiedorreported:<component>(audit.md). Tested on a verified session and on a tokenless one.#2785: check order (comment)
svid_expiredwith a record naming no agent. Swapping checks 3 and 6 fails it.#2785: argument hash doc (comment)
ArgumentsSHA256now points at step (8), "The argument hash": SHA-256 of the RFC 8785 serialization ofparams.argumentsas sent (or{}), not of the raw bytes.#2786: retry-allowance assertions (comment)
TestAuthorizeCallRetryAllowancesnow also checks: one decision whose outcome, code and reason match the returned error; one ID-JAG record per ID-JAG AS-1 issued; no gateway token on failure; and that the try after a revoked grant presents the session's new grant (reverting the re-read of the grant fails it).#2786: dropped
error_uri(comment)ErrorURIthe AS-2 port sets rather than widening the shared refusal type.#2786:
CloseSessioncomment (review body)The #2785 review also asked for a rebase onto main for the amended design text; the stack was rebased onto main after #2784 merged.
#2792 folded in (Jakub Hrozek's fix-ups; authorship kept,
(cherry picked from …)in each message)36dc40138: respect a gateway token'sexpwhen it has nojti(readJWTExp).bf34f9cb4: the rejected-token retry test covers every field that binds an attempt.3ceed66ed: the attempt-ledger test covers each call-key field on its own, and theExpiresAtcomment describes the broker's use-before deadline.Each of #2792's three original patches is present in this branch (
git apply --check -Rsucceeds), and their tests pass.Testing
go build ./...;go testfor mcpbroker, identitybroker, identityharness, mecak8s, and the app identity tests; root golangci-lint 0 issues.API compatibility
No wire change.
DecisionRecordgainsOwnerVerified; it is an in-process type with no consumer outside the broker until #2541.