Repository navigation
Conversation
Adds the authorisation hook of the profile tes-authzen/1, as in the sibling design for Poiesis (JaeAeich/poiesis#113), off by default: - tesk.api.authz.required-claim.{name,values,prefixes}: a claim rule (exact name first, then dotted path), enforced as an AND gate before all other rules; tesk.api.authorisation.claim stays the OR grant of the group model. - tesk.api.authz.decision-service.{url,timeout,claims,credential-file}: with a URL, one OpenID AuthZEN 1.0 Access Evaluation per decision decides create, get, cancel and list instead of the group model. The subject comes from the user info (opaque tokens) or the service client's token; the token is never sent. Get and cancel ask also for missing tasks; list asks for the task sets all and own and binds page tokens to the scope (400 on a mismatch). Any failure gives 503. - tesk.api.authz.issuer: owners <iss>|<sub>, stamped on new tasks as the annotation owner-id; older tasks get an owner from their creator only if no service client of another issuer can have created them. - Client-supplied id, state, creation_time and logs are dropped. - Startup checks refuse unsafe settings; list settings take JSON arrays in environment variables. Closes #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Documents the required claim and the AuthZEN decision service in the access control guide (settings, startup checks, what TESK API sends, 404/403/503 answers, page tokens, owners, trust implications), adds the settings to the configuration reference, and the upgrade notes for 2.1.0. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds the setting tesk.api.auth.oidc.timeout (seconds, default 10) of the tes-authzen/1 profile: the connect and read timeout of the user info endpoint (before: 10 s to connect, 30 s to read) and of the discovery document and keys of service clients' issuer (before: 5 s). Values that aren't seconds above 0 stop the app at startup. Also, from the review: the required claim is checked before the view is parsed; service clients own their tasks by client ID also if their token's sub differs; the service-client issuer is trimmed before it is compared; a credential with control characters, or a request that can't be built, is a decision-service failure (503), not a 500; the API reference and access control guide cover 503, scope-bound page tokens, the view property and owner stamping. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step 2c of the URL stripping of tes-authzen/1: if nothing comes between "://" and the first "/", and the rest has an "@" before its first "?" or "#", the URL is left out, as WHATWG parsers skip the extra slashes (https:///u:p@h/p sends u:p to h). The golden file is the shared one, now with 31 rows. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tests that tesk.api.auth.oidc.timeout reaches the clients of the user info endpoint and of the service clients' issuer, and stops the app if invalid; names control characters in the credential file messages; fixes the docs on what gets 400 before the required claim and on when the timeout setting is checked. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideData structuresAdd claims and validated issuer data to principals, and define the task-owner annotation used to persist owner IDs.
APIExtend task-service authorization entry points for decision-based cancellation and expose the unavailable-decision-service response as HTTP 503.
Apply the required-claim gate to task endpoints and route cancellation through the decision-aware service path when enabled.
ImplementationBuild the AuthZEN subject, action and resource evaluations, enforce the required-claim rule, and handle decisions, owners and service failures.
Integrate decision checks into task creation, retrieval, cancellation and listing, including owner stamping, legacy-owner derivation, scoped pagination and exact ownership filtering.
ConfigurationRegister the authorization hook and parse its authorization and decision-service settings, including startup validation.
Make the configurable OIDC timeout govern user-info and service-client issuer requests, and carry validated service-client claims and issuer into principals.
DocumentationDocument the required-claim gate, decision-service protocol and trust model, plus OIDC timeout, API status and pagination changes and 2.1.0 upgrade considerations.
TestsExercise the decision-service workflow end to end, including request construction, authorization outcomes, missing tasks, owner handling and scoped listing.
Test authorization settings, claim lookup, decision-service requests, task projections, URL stripping and authorization decisions.
Verify OIDC timeout parsing and wiring, principal claims and issuer, service-client timeout behavior, and authorization-aware task-service and controller paths.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #200 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 53 63 +10
Lines 2340 2853 +513
Branches 274 364 +90
==========================================
+ Hits 2340 2853 +513 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Step 0 of the URL stripping of tes-authzen/1: a value with a tab, line feed or carriage return anywhere is left out, as WHATWG parsers delete them (https://<TAB>/u:p@h/p would send u:p to h). The golden file is the shared one, now with 34 rows. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step 4b of the URL stripping of tes-authzen/1 replaces step 2c: after the user info is dropped and the query and fragment are cut, a value whose authority is empty and whose path has an "@" is left out (https:///u:p@h/p, https://x@/u:p@h/p). The golden file is the shared one, now with 36 rows. Refs #199 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bring in #201 (google-java-format update), #202 and #206 (removal of the /v2/api-docs alias). Conflicts: - docs/upgrading.md: both PRs add items to "To 2.1.0"; the removal of /v2/api-docs goes first in the list of changes for all deployments. - KubernetesClientWrapper: #201 only reformatted the creator filter that this branch moved into listAllTaskmasterJobsForUser; kept the moved version. Files of this branch reformatted with spotless:apply for #201. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #199
Summary
Adds the authorisation hook of the profile
tes-authzen/1, which Poiesis and other TES implementations share. It is off by default; without its settings nothing changes, apart from the two items under "Changes for all deployments".tesk.api.authz.required-claim.{name,values,prefixes}): a claim gate (exact name first, then dotted path), enforced as an AND gate before all other rules.tesk.api.authorisation.claimstays the OR grant of the group model.tesk.api.authz.decision-service.{url,timeout,claims,credential-file}plustesk.api.authz.issuer): one OpenID AuthZEN 1.0 Access Evaluation per decision decidesCreateTask,GetTask,CancelTaskandListTasks, instead of the group model.allandown. Page tokens are bound to the set (all:orown:); a token of the other set gives 400.<iss>|<sub>(for service clients,<iss>|<client ID>), stamped on new tasks as the annotationowner-idwhenever the issuer is known. Older tasks get an owner derived from their creator, but only if no service client of another issuer could have created them.tesk.api.auth.oidc.timeout(seconds, default 10) bounds the user info endpoint and the discovery and JWKS calls for service clients.Changes for all deployments
TESK_API_AUTH_OIDC_TIMEOUT.id,state,creation_timeandlogsare dropped before the task is stored. TESK already ignored them.Spec claim checked
"TESK names jobs itself" (marked unverified in the spec) is verified: the task ID is the generated job name,
stateandcreation_timeare derived, and logs were already nulled on GET. They are now also dropped before storing (IT case 7b).Verification
mvn clean verifyon Java 21 (eclipse-temurin:21-jdk): 18769 unit tests and 157 integration tests passed, all coverage checks met (100% line and branch).DecisionServiceITcovers spec cases 5–19, including 7b, 10b, 11b, 11c, 13 and 13b, with WireMock for the user info endpoint, Kubernetes and the decision service.mvn spotless:apply checkstyle:checkon Java 8: BUILD SUCCESS.mkdocs build --strictwithdocs/requirements.txt: OK.1ba80ab; TESK adapter: jar in a container, kind cluster, mock OIDC issuer, stub/OPA/OpenFGA): 54 passed, 3 skipped, 0 failed. Skipped: case 22 (no per-TES expectation yet), thesubmismatch variant of case 20 (opaque tokens have nosubto compare), and case 21 (user info cache; TESK keeps its per-request lookup).Declined review findings
gate(user)first, and each is covered by controller tests. An interceptor would also run before binding and change status codes for malformed requests, which the docs now describe instead.listTaskmasterJobsOfCreator, whosenullmeans all jobs: declined. The Javadoc says so, there is one call site, and a rename touches several mocks.TesAuthz(startup checks, gate, request building): declined for this PR. It is about 470 lines with one responsibility, the profile.ServiceClientTokenServicessets the claims and issuer, and thatTesAuthzbuilds the subject from them (subject_serviceClient).Decisions
sub.tesk.api.authz.issueris part of the spec (§4.2) as a TESK-only key, needed because the user info doesn't name the issuer.🤖 Generated with Claude Code
Summary by Sourcery
Add optional TES AuthZEN authorization with required-claim gating, issuer-scoped task ownership, and updated authentication behavior while preserving existing defaults when disabled.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: