Repository navigation
Check the actor at ID-JAG redemption - #7255
Conversation
For a resolve issuer nothing checked who the acting agent is, yet the act claim is copied into the issued token, is the audit trail, and is the basis for session binding. Resolution of the subject cannot be turned on until a missing, malformed or disallowed actor is refused. For resolve issuers only, the handler now reads the effective actor (the outermost act, with the ID-JAG's iss standing in when act has none). A missing or malformed act, or an act.iss that is neither the ID-JAG's iss nor in actor_issuers, is refused with access_denied and the new actor_denied reason, before the actor policy runs. The policy is built once per issuer at construction. A denial is actor_denied. A policy error means the policy could not decide, so it is server_error, not a denial. The checks run before the code gate and before the jti is used up. Refusals are logged at Debug with the issuer, client and reason, never the subject, the jti or an act value. The default policy checks only the actor's issuer, so it does not restrict actors per subject or per client. The docs and the doc comment on DefaultPolicy.Evaluate say so, and say what Evaluate trusts in its request. Refs #7245 Co-authored-by: Mecatl <[email protected]>
The actor check reads the act.iss that AS-1's real issuance puts in an ID-JAG, which is the actor's issuer and not AS-1's own. Unit tests feed the handler hand-made claims, so they cannot show that the two ends agree over HTTP. AS-1 mints an ID-JAG through real issuance with a mocked actor token validator, and AS-2 redeems it under a resolve issuer. The test decodes the ID-JAG to assert act.iss is the actor issuer, not AS-1. With that issuer in actor_issuers the redemption reaches the gate and is refused with subject_unknown; with it unlisted the actor check refuses first with actor_denied. startAS2With and startTwoServerIDJAGConfigured let a test change AS-2's config. Refs #7245 Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Approve: the actor check is made at the right place and nothing blocking turned up.
Design: IDJAGHandler.HandleTokenEndpointRequest is the single redemption point for ID-JAGs, and the PR reuses the existing actor package (Effective, DefaultPolicy) instead of reimplementing it. The check runs after the client-audience check and before the gate and the jti consume, so a refused ID-JAG stays reusable. A policy error returns a 500 rather than a denial, which is correct. The only behaviour change is for resolve issuers, which are Go-embedder-only and are refused at the gate today anyway. So upgrade impact is a different refusal reason (actor_denied), and no CRD, CLI or persisted-state change.
Non-blocking notes (no action needed to merge):
id_jag_actor.go:65-67: the inlineActorIssuersallowlist check repeats whatDefaultPolicy.Evaluatealready does.actorPoliciesis only built fromDefaultPolicy, so in production this branch is unreachable, andTestIDJAGActor_IssuerAllowlistends up testing the duplicate. Consider dropping it, or noting that it guards a future injectable policy.subject_mode.go:73:validateSubjectModedoes not reject empty or#-containingactor_issuersentries, butactor.NewDefaultPolicy(now called fromnewIDJAGIssuanceHandler) does. Such a config passes validation and fails later when the handler is built. Rejecting those entries invalidateSubjectModewould surface the error at config time.id_jag_actor.go:92-99: theactor_policy_error500 path is logged only at Debug. Logging it at Warn would make it visible to operators.
🤖 Reviewed with Claude Code
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7255 +/- ##
==========================================
- Coverage 81.85% 81.81% -0.05%
==========================================
Files 913 914 +1
Lines 92576 92619 +43
==========================================
- Hits 75780 75778 -2
- Misses 16791 16836 +45
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A policy that cannot decide is a server fault the caller did not cause, so operators need to see it. It was logged at Debug with the denials. A denial stays at Debug because a caller can trigger it at request rate. The comment on the issuer pre-check now says why it repeats the policy: the handler holds the Policy interface, so actor_issuers must still bind a future policy that does not check issuers. The retry paragraph in the architecture doc now says only the access_denied refusals that a new ID-JAG with the same claims would not change are not worth retrying. Refs #7245 Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Re-review of ad5a3e0: still approve. The new commit logs a policy that cannot decide at Warn (denials stay at Debug), and the comment and architecture-doc wording now match the code.
Of the earlier non-blocking notes: 1 (duplicate issuer check) is addressed by the comment saying it guards a future non-default Policy, and 3 (500 path only at Debug) is addressed by the Warn level. Note 2 (validateSubjectMode not rejecting empty or #-containing actor_issuers) is still open; it stays non-blocking.
🤖 Reviewed with Claude Code
Summary
For a
resolveissuer nothing checked who the acting agent is. Theactclaim is copied into the issued token, it is the audit record of which agent acted for the user, and session binding uses it later. Resolution of the subject cannot be turned on until a missing, malformed or disallowed actor is refused, so this adds that check first.resolveissuers only, the handler reads the effective actor: the outermostact, with the ID-JAG'sissstanding in whenacthas none.act, or anact.issthat is neither the ID-JAG'sissnor inactor_issuers, is refused withaccess_deniedand the newactor_deniedreason, before the actor policy runs.actor_denied. A policy error means it could not decide, so it isserver_error, not a denial.jtiis used up, so a refusal leaves the ID-JAG unused.jtior anactvalue. A denial is logged at Debug. A policy that cannot decide is logged at Warn, because it is a server fault operators need to see.act.issis the actor's issuer, not AS-1's.Closes #7245
Type of change
Test plan
go test -raceonpkg/authserver/server/tokenexchange/...,pkg/authserver/actor/...andpkg/authserver/, which includes the two-server integration test)task test-e2e)task lint-fix)Changes
pkg/authserver/server/tokenexchange/id_jag_actor.gocheckActorpkg/authserver/server/tokenexchange/id_jag_handler.goactorPoliciesfield, built in the constructor;checkActorcall before the gatepkg/authserver/server/tokenexchange/redemption_refusal.goactor_deniedreason codepkg/authserver/actor/policy.goDefaultPolicy.Evaluateonlydocs/arch/17-token-exchange-delegation.md*_test.goDoes this introduce a user-facing change?
Only for
resolveissuers, which only embedders can configure and which are still refused on every redemption until resolution is turned on.resolveissuer that passed validation and the client and resource checks was refused with 400access_denied,subject_unknown, whatever itsact.act, a disallowedact.iss, or an actor the policy denies is refused with 400access_denied,actor_denied. A policy that cannot decide gives 500server_error. An ID-JAG whose actor passes is still refused by the gate withsubject_unknown. None of these uses up thejti.namespacedissuers: no change.Special notes for reviewers
server_error, notactor_denied. A broken policy is a server fault, and a client that readsactor_deniedconcludes its actor is not allowed.DefaultPolicydoes on purpose.Policyis an interface, and another implementation might not check the issuer.act.subat an allowed issuer passes. Which clients may redeem is bounded separately by the client checks. The docs and the comment onDefaultPolicy.Evaluatesay so.resolveissuers, which aresolveissuer has none of.actor_issuersentry that is empty or contains#passesRunConfigvalidation and is refused only when the handler is built. By then an upstream client may already be registered. Only Go embedders can setActorIssuers. Validating it earlier is left out of this PR.