Repository navigation
Description
Part of #7
Story
As a requester, I want to use my corporate identity and permitted actions.
Business value
The plan (#6) sets this release exit for phase 1: "documented service with durable data and identity; every live read on two automatically imported clusters; baseline telemetry."
Context
PR #40 merged the token checks and the role authorization. PR #112 (draft) adds the LDAP role groups and the test users (#110). Tokens were checked on community Keycloak 26.6.4 with an LDAP stand-in. Realm cmapi is not on CRC (read 2026-11-06).
Acceptance criteria
- Wrong issuer, audience and expired tokens are refused, shown by
cmapi/tests/service/test_auth.py::test_wrong_audience_issuer_or_expired_is_401 - Role and optional environment restrictions match authz-roles.yaml; onboarding identity can create but cannot change/delete, shown by
cmapi/tests/service/test_review_c_authz.py::test_onboarding_creates_onlyand::test_environment_role_cannot_approve_or_reject_in_another_environment - Required team DL is format/domain checked; employee ID and personal names never enter Git; automation and onBehalfOf follow configured rules, shown by
cmapi/tests/core/test_identity_metadata.py::test_email_domains,::test_automation_account_needs_no_employee_idandcmapi/tests/service/test_review_c_authz.py::test_submitter_cannot_approve_what_it_filed_on_behalf_of_someone
Tasks
- Merge PR LDAP groups app-cmapi-rbac-<role>, cmapi.<role> test users, CA-only keychain #112 (LDAP groups app-cmapi-rbac-<role> and cmapi.<role> test users, before the first import #110).
- Prove the LDAP login and the token roles on CRC in Wave 1 (Wave 1: deploy cmapi on CRC with oc apply, image in the internal registry by digest #94).
- The owner decides SEC-01: Existing LDAP server: the admin passwords sit in a ConfigMap #35 and BUG-08: Existing LDAP server: a reapply of ldap-acls would drop any rule missing from its source #36 in Wave 8.
Out of scope
- The source states none for this story.
Evidence
- PR cmapi service, image and charts: the foundation for the first deploy on CRC #40, merged at
1f30ab1on 2026-11-05.build-tracker.mdlinks it to this story ("Stories and epics"). - PR LDAP groups app-cmapi-rbac-<role>, cmapi.<role> test users, CA-only keychain #112, draft, branch
ldap-rbac-names, saysPart of #14. It is not merged.
Definition of done
- Mockup approved, or the work has no screen and no API shape
- Draft pull request open
- Build: tests fail before the change and pass after it
- Documented where a reader looks for it
- Review ruled
- Merged with its proof
- Released on the default branch
- The owner approves, after a comment cites the proof for each criterion and its cluster
Class
INV. The story adds a new capability to the product.
Source
Status: Draft backlog. No sprint commitment.
Owner in Paperclip: Ahsoka. Ahsoka mentors Luke and assigns bounded engineering work after technical review.
Source: OBI-23.
Epic: #7. Plan, release windows, and review gates: #6.
Planned story; phase 1, provisional 8 points (Ahsoka/Yoda to validate).
- Attach automated or reproducible evidence for each criterion; cover denial/failure paths.
- Read the plan; Yoda owns design choices. Keep this in backlog until prerequisite phase evidence is accepted. Ahsoka may split and delegate to Luke with mentorship.
Language acceptance criterion
Before sprint entry, the owner must define technical terms and attach language review evidence for this text revision.
Use simple-english 2.1.1, Strict mode. Index #6 records the vocabulary source and review limits.
The source criteria remain unchanged. Language review remains open.
Activity
ephico2real2 commentedon Nov 6, 2026
PR #112 is
Part ofthis story: LDAP groups for each role, the role mappings in realmcmapi, and test users. Tokens checked on community Keycloak 26.6.4 with an LDAP stand-in; not on CRC, and not yet merged. This story stays open.ephico2real2 commentedon Nov 13, 2026
Work tag: In-Progress. A part of this story is merged: PR #40, merge commit
1f30ab1, on 2026-11-05 (build-tracker.md, "Stories and epics"). Draft PR #112 saysPart of #14and carries the role groups and the test users. The story is not complete, and no cluster proves it. Read fromghandgitat 2026-11-13T09:18Z.ephico2real2 commentedon Nov 13, 2026
Proof so far for this story, from OB1's run on 2026-11-13. Nothing is proven on CRC yet: the realm
cmapidoes not exist there, so the story stays open and the owner decides its close.app-cmapi-rbac-<role>and the 13 test users: PR LDAP groups app-cmapi-rbac-<role>, cmapi.<role> test users, CA-only keychain #112 (merged, 99093d8).deploy/tests/ldap-identities-test.shon an OpenLDAP stand-in: 0 failed, 13 mutants killed, on macOS with Podman and in CI on Ubuntu with Docker.deploy/tests/realm-test.pyon community Keycloak 26.6.4 in CI.docs/14-authorization.md(PR docs/14, docs/15, docs/16: authorization, Keycloak, the data model; BUG-30 #153, merged, f62d448), withtests/service/test_auth.pyandtest_review_c_authz.py(24 tests). BUG-30: an approval in an environment the role does not cover answers forbidden, not environment-forbidden #141 (BUG-30) is fixed there, read by Codex with no defect found.docs/15-keycloak-integration.md. Its real token, its sign-in figure and each CRC result are marked as not done.deploy/crc-proof.sh, on CRC).docs/14: the onBehalfOf path for tools, the shared-submitter case cor…
docs/14, docs/15, figure: the realm and the 13 users proven on CRC (c…
ephico2real2 commentedon Nov 26, 2026
Story #14, OIDC identity, directory and role authorization: proof for the owner's approval.
Part of #7. Cluster: CRC, main
cf1c0f4e62(OB1 run 42, 2026-11-26), images from CI by digest: api and workersha256:76f55721..., portalsha256:48b7a552.... Earlier CRC proofs: OB1 run 40, mainc2b89f5d71, 2026-11-25 (api and workersha256:c939bfc5...). Sources:workbench/cmapi/ob1-run42/andob1-run40/(resume.md,logs/). The realm iscmapi,issuer
https://keycloak.apps-crc.testing/realms/cmapi, audiencecmapi-nonprod(deploy/manifests/environments/crc/20-config.yamll.24-25).
1. Process facts, first
delivery.mode: apply, not Argo CD. This story does not depend on Argo CD.gh pr view 112: MERGED; the issue'sEvidence still calls it a draft). The 13 test users and their groups exist on CRC (docs/11), and every proof below used them.
2. Criterion 1: "Wrong issuer, audience and expired tokens are refused, shown by
cmapi/tests/service/test_auth.py::test_wrong_audience_issuer_or_expired_is_401"CI:
test_wrong_audience_issuer_or_expired_is_401(wrongaud, wrongiss,exp120 s ago: each 401unauthenticated).Expired, CRC, run 40 (
ob1-run40/logs/story-exp14/):cmapi.viewer's token answered 200 at once; the same token 50 s afterits
exp(past cmapi's 30 s leeway) answered 401unauthenticated, "Token expired",WWW-Authenticate: Bearer error="invalid_token"(2-after-exp.txt, x-request-idc801ce9ed8a7a27fe5b5d33b94aafeb3).Wrong audience, CRC, run 40 (
ob1-run40/logs/story-aud14/): a client-credentials token of realmcmapifor the clientcmapi-directory, whoseaudis absent (claims.txt: aud null, roles realm-management only), answered 401unauthenticated, "Invalid token" onGET /api/v1/me(directory-me.txt);cmapi.viewer's token (audcmapi-nonprod) 200.This is a token without cmapi's audience, refused because
audis a required claim (core/auth.py,require: [exp, iat, iss, aud, sub]). A token whoseaudnames another client was not sent: run 42's brief forbids a token from another client.Wrong issuer, CRC, run 42 (
ob1-run42/logs/c42-iss14/): four self-signed RS256 access tokens (headertyp: at+jwt), madewith a throwaway RSA key (deleted after the run), each with
audcmapi-nonprodandexpnow + 300 s, sent toGET /api/v1/me:iss.../realms/ob1-run42-not-a-realm, kidob1-run42-throwawayunauthenticated"Invalid token: unknown signing key",WWW-Authenticate: Bearer error="invalid_token"issrealmcmapi's, kidob1-run42-throwawayissrealmcmapi's, kid of realmcmapi's RS256 key, signed by the throwaway keyiss, the realm's kidcmapi.viewer's real tokenThe api's counter after the four:
cmapi_auth_failures_total{reason="signature"} 4(metrics-auth.txt); one JWKS refetch forthe unknown kid (
cmapi_jwks_refresh_total{result="ok"} 2, start included), as docs/02 "Token verification" allows.Not proven on CRC: the issuer refusal itself ("Token issuer is not trusted"). PyJWT 2.15.1, read in the api pod
(
pyjwt-decode-complete.txt), checks the signature (_jws.decode_complete) before the claims (_validate_claims, whereissis compared). So a token reaches the issuer check only if realm
cmapi's own key signed it, and realmcmapiissues only itsown issuer. A wrong-issuer token that the realm's key signed cannot be made without that private key. On CRC every forged token is
refused one step earlier, at the signature; the issuer comparison stays proven in CI.
RFC 9068, section 4: "The issuer identifier for the authorization server ... MUST exactly match the value of the "iss" claim",
"The resource server MUST validate the signature of all incoming JWT access tokens", and "in case of any failure in the
validation checks listed above, the authorization server response MUST include the error code "invalid_token"". RFC 6750,
section 3.1, invalid_token: "The resource SHOULD respond with the HTTP 401 (Unauthorized) status code". RFC 9110, section
15.5.2: "The server generating a 401 response MUST send a WWW-Authenticate header field".
3. Criterion 2: "Role and optional environment restrictions match authz-roles.yaml; onboarding identity can create but cannot change/delete, shown by
test_review_c_authz.py::test_onboarding_creates_onlyand::test_environment_role_cannot_approve_or_reject_in_another_environment"ob1-run40/logs/story-auto14/):cmapi-automation(client credentials, rolecmapi-onboarding):PATCH dry run of
cmap-live-g-dev403forbidden"Missing permission namespaces:write: no role in your token grants it(roles: ['cmapi-onboarding'])" (
3-patch-dryrun.txt); DELETE dry run ofcmapi-live-a403, the same (4-delete-dryrun.txt);create dry run 200 (
5-post-dryrun.txt). Run 42 repeated the create dry run ascmapi-automation: 200(
ob1-run42/logs/c42-obo14/1-automation-no-obo.txt).ob1-run40/logs/a3-otherenv/05-approve-by-approver-prod.txt):cmapi.approver-prodon:approveof a dev request needing approver-platform: 403not-eligible"Not in an approving groupstill needed: ['approver-platform']"; no approval row written (run 40 resume, "Story A3").
story-audit/audit.md, "[Draft] OBI-23: OIDC identity, directory and role authorization #14"; those run folders are no longer on disk, sorun 42 did not re-read them): each of the 13 users signs in with the table's groups, roles and employee_id (run 26
logs/step23.logl.21);cmapi.noaccess403 wherecmapi.viewer200 (l.22); KPIs operator 200, requester 403 (run 9 l.30,run 15 l.16);
:probe403 for viewer and requester (run 26 l.20).4. Criterion 3: "Required team DL is format/domain checked; employee ID and personal names never enter Git; automation and onBehalfOf follow configured rules, shown by
test_identity_metadata.py::test_email_domains,::test_automation_account_needs_no_employee_idandtest_review_c_authz.py::test_submitter_cannot_approve_what_it_filed_on_behalf_of_someone"CI: the three tests named.
Team DL, CRC: refusals for team-dl as a label, a wrong domain and a bad pattern (run 9 l.30); the DL refused on its own field
(run 19 l.41-42), as
story-audit/audit.mdcites.onBehalfOf, CRC, run 42 (
ob1-run42/logs/c42-obo14/), the configured rulesidentity.requireOnBehalfOf: false,automationRoles: [cmapi-onboarding](20-config.yamll.28), each a create dry run ofcmap-z39-dev, against docs/14's table"Tools that act for people":
cmapi-automation, noonBehalfOfcmapi-automation(kind service),automated: true,submittedBynullcmapi-automation,onBehalfOf: cmapi.requestercmapi.requester(kind user, itssuband employee ID from the directory),automated: true,submittedBy/submittedByClientcmapi-automationcmapi-automation,onBehalfOf: ob1-run42-no-such-userunknown-user"unknown-user, "ob1-run42-no-such-user is not an enabled user",onBehalfOfnamedcmapi.requester(a person),onBehalfOf: cmapi.vieweron-behalf-of-not-allowed"on-behalf-of-not-allowedThe database was the same before and after (25 requests, md5
172fec2386dc16a5bdac8c421e346bdc).Git, CRC, run 42 (
c42-obo14/git-files-identity.txt): the plan's files for theonBehalfOfcreate hold the username labelcmapi.net/requested-by-user: cmapi.requesterand the email annotationcmapi.net/requested-by, and no employee ID, no given orfamily name, no
sub. The email in Git is the design (docs/01 l.311 and l.321, docs/02 l.1020); docs/14 l.281 says otherwise,filed as docs/14 says the requester's email is kept in the database only; the plan puts it in Git as cmapi.net/requested-by #698 (Low, documentation). Earlier: run 11's commit trailer
Cmapi-Requester: cmapi.requester, no employee ID (audit).Not proven on CRC: a real request filed with
onBehalfOfand then refused when that person approves it(
test_submitter_cannot_approve_what_it_filed_on_behalf_of_someone): it needs real writes, outside run 42's scope. CI only.5. Approval
The owner approved closing #14 on 2026-11-26, on these proofs, accepting both "Not proven on CRC" lines as covered in CI:
cmapi's key signed can reach it.onBehalfOfrequest with its self-approval refusal. The dry runs go through the same pipeline path.These sub-issues stay open as their own items: