Repository navigation
#789: an owner of a service client cannot approve or reject what it filed (identity.clientOwners) - #801
Open
ephico2real2 wants to merge 2 commits into
Open
#789: an owner of a service client cannot approve or reject what it filed (identity.clientOwners)#801ephico2real2 wants to merge 2 commits into
ephico2real2 wants to merge 2 commits into
Conversation
…em on :approve and :reject instance.yaml identity.clientOwners maps a client ID to usernames and Keycloak group paths (the owner's decision on #789, 2026-12-01). A username is resolved to its sub through the directory when the client sends a request, and stored with the request beside submittedBySub (clientOwners, never in a response); a group is compared with the decider's token. RequestRepo.ledger passes both to ApprovalLedger, so an owner gets 409 self-approval and nothing is written, unless the rule has selfApproval: true. A username the directory does not know refuses the request (500 internal-error, log client_owner_unknown); usernames with no directory stop the start. A client that sends onBehalfOf with no entry keeps the rule from before and is named in client_without_owners: at the start for the clients cmapi knows of, otherwise on its first onBehalfOf. A directory that cannot be reached during a requester's or an owner's lookup answers 503 idp-unavailable instead of escaping as 500.
…design record and the tests before and after The proof test runs :approve and :reject as separate cases, so each shows its own 200 before the fix. docs/16's requester row names clientOwners. docs/reviews/2026-12-01-issue-789/ holds the decisions with their sources (fetched 2026-12-01) and the output of the service and core files before and after.
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.
Closes #789
Closes #798
Part of #18
What this does
docs/01, "Approval of record": the approver is "not an owner of the svc client that asked".
ApprovalLedgerhad the check, andRequestRepo.ledgergave it no owners because cmapi had no record of them. Built to the owner's decision on #789 (2026-12-01):identity.clientOwnersininstance.yaml:{<clientId>: [usernames or groups]}. An entry starting with/is a Keycloak group by full path (as thegroupsclaim carries it); anything else is a username (Keycloak's default user profile refuses/in a username). A bad value stops the start (core/identity/owners.py,core/config.py).subthrough the existing DirectoryProvider (view-users; no new Keycloak privilege) and stored in the request'srequesterrecord asclientOwnersbesidesubmittedBySub; never in a response (public_record). A later change of the setting does not move who may decide a request already filed, as with the requirement and the group path. No migration (JSONB).:approveand:rejectrefuse an owner (bysub, or by a group of the decider's token) with 409self-approvaland write nothing, unless the rule hasselfApproval: true(RequestRepo.ledger,ApprovalLedger._eligible).internal-errorand the log lineclient_owner_unknown(OWASP SCP: "Access controls should fail securely"). Usernames with no directory stop the start. The API's start looks each username up once and logsclient_owner_unknownfirst.client_without_owners: at the start for the clients cmapi can know of (approval-rules.yamlrequester.clients, and clients that filed for another person before), otherwise the first time it sendsonBehalfOf(once per process).internal-error(unhandled DirectoryUnavailable); it now answers 503idp-unavailablewithretryAfter30, likeGET /directory/users. Fixed here because it is in the lines this change edits (Pipeline.requester_for).Decisions, options not taken and sources (fetched 2026-12-01):
docs/reviews/2026-12-01-issue-789/design.md.Tests
Service
test_client_owners_789.py: before (the two defect sites as on main) 6 failed, 6 passed: the owners kim (username) and bob (group) got 200 on:approveand:reject, and the directory-down case 500; after, 12 passed. Coretest_client_owners_789.py: before (main's ledger) 1 failed; after, 15 passed. Existing files re-run one at a time, all passed:test_reject_decision_779_7808,test_review_c_authz13,test_operations_review_77420,test_idempotency_caller_59218,test_openapi_render_3378,test_api_standard177,test_config_twice_keys_78184; coretest_approvals40,test_identity_metadata21. Full suites: CI. Output:docs/reviews/2026-12-01-issue-789/tests-before-after.md.No migration: the owners live in the
requesterJSONB. Not tested: a real Keycloak (the directory isInMemoryDirectory), CRC and kind.Docs
docs/14 (step 5 and the problem table; the "What is not built" row for #789 removed), docs/18 (the new key), docs/16 (the requester record), docs/GLOSSARY (client owner). docs/01 unchanged: it is the design. Citations:
scripts/doc-citations.py --check0 problems.Who wrote what
Every commit of this pull request was written by Opus 5.5 at
high(the implementer). One model family so far: the adversarial review (security: both reviewers) is the coordinator's next step.