security(controller): reject cross-namespace spec.agent.ref#564
Closed
bussyjd wants to merge 1 commit into
Closed
Conversation
resolveAgentOffer accepted any ref.Namespace, while the verifier route source in PR #556 keys the hermes-api-server API_SERVER_KEY lookup off offer.Spec.Agent.Ref.Namespace. Combined with the cluster-wide openclaw-monetize-write ClusterRoleBinding, any principal holding the Hermes obol-agent SA token could publish a ServiceOffer in their own namespace referencing another tenant's Agent, causing the verifier to inject the victim's API_SERVER_KEY as upstream Authorization on a route under attacker-controlled path and payTo. Paying buyers would gain authenticated proxy access to the victim Hermes /api/* (chat, skills, sub-agent management, wallet ops). Fail-closed in the controller before any route is published or any bearer is resolved. The legitimate flow (mother creates offer in the agent's own namespace) is preserved. Flagged on PR #556 by @OisinKyne; not exploitable in today's single- mother layout, but lands ahead of sub-agent SA split / multi-mother marketplace mode.
This was referenced May 28, 2026
Merged
Collaborator
Author
|
Aggregated into #566 (release/v0.10.0-rc8 → main). Originally split off from the review of #556 — see that PR's discussion thread for the security analysis that motivated this guard. |
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.
Summary
Closes the confused-deputy gap flagged by @OisinKyne on #556 (review comment).
resolveAgentOfferaccepted anyspec.agent.ref.namespace, while the verifier route source (introduced in #556) keys thehermes-api-serverAPI_SERVER_KEYlookup offoffer.Spec.Agent.Ref.Namespace. Combined with the cluster-wideopenclaw-monetize-writeClusterRoleBinding, any principal holding the Hermes obol-agent SA token could publish a ServiceOffer in their own namespace referencing another tenant's Agent. The route would be published with the victim'sAPI_SERVER_KEYas upstreamAuthorization, attacker-controlledpath, and attacker-controlledpayment.payTo. Paying buyers would gain authenticated proxy access to the victim Hermes/api/*(chat, skills, sub-agent management, wallet ops).Fix
Single fail-closed guard at the controller boundary: if
spec.agent.ref.namespace != metadata.namespace, the offer is rejected before any route is published or any bearer is resolved. Matches the existing missing-ref error pattern; the legitimate flow (mother creates the offer in the agent's own namespace) is preserved.Why now
Not exploitable in today's single Hermes mother layout (only one principal has
serviceofferswrite, and it already has cluster-wideagents/secretswrite over its own children). Becomes exploitable the moment sub-agent SAs split out of the mother or multi-mother marketplace mode lands. Cheap to enforce the invariant now.Validation
go test ./internal/serviceoffercontroller/... ./internal/x402/... -count=1New regression:
TestResolveAgentOffer_RejectsCrossNamespaceRefasserts the guard fires andstatus.AgentResolutionis not mutated. Existing happy-path tests updated to setmetadata.namespaceso they exercise the post-guard codepath.Test plan
go test ./internal/serviceoffercontroller/... ./internal/x402/...passesTestResolveAgentOffer_RejectsCrossNamespaceRefcovers the guardmetadata.namespacenow set)