Repository navigation
feat!: show tasks to their owner only - #219
Conversation
Add tesk.api.authorisation.task-visibility (TESK_API_AUTHORISATION_TASK_VISIBILITY): with `owner`, the default, users get, list and cancel only their own tasks, whatever their groups; super admins and team admins included. `group` keeps the previous behaviour, in which team admins see all tasks of their teams and super admins all tasks. Owner-only visibility narrows the existing rules down to the creator's tasks: getTask additionally requires the creator, and lists always select and filter by the creator, also for admins and with legacy labels. Users without authentication (noauth) are unaffected. AuthIT, ClaimAuthIT and ServiceClientAuthIT pin `group`; the new TaskVisibilityOwnerAuthIT covers the default. Closes #218 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Describe TESK_API_AUTHORISATION_TASK_VISIBILITY in the access control guide and the configuration reference, mark the admin rules and examples as those of `group` visibility, and add the behaviour change to the upgrade notes of 2.1.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Move the rule of getTask from the SpEL of @PostAuthorize into User#mayGet, which is unit-tested in both visibility modes. Service clients now follow the task visibility too (no change in effect: they have no groups). Add tests for the binding of the setting (default, case, empty and invalid values) and for an admin's owner-only list with legacy labels, and fix review findings in the docs and Javadoc. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Test User#mayGet with tasks with only the old creator label, service clients and logs without metadata, and mark the permission table of the access control guide as that of `group` visibility. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Reviewer's GuideData structuresAdd the
ImplementationCentralize get authorization in
Pass the configured visibility mode into authenticated principals and service-client principals so the same task rules apply to both.
ConfigurationIntroduce the
DocumentationExplain the visibility modes, their endpoint and legacy-task effects, the configuration setting, and the upgrade impact of the new default.
TestsCover owner-only access and list results in integration tests while pinning existing authorization suites to group visibility.
Test visibility-setting binding, principal propagation, authorization decisions, list filtering, and legacy-label behavior across the two modes.
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 #219 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 55 56 +1
Lines 2515 2543 +28
Branches 287 296 +9
=========================================
+ Hits 2515 2543 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 2019354 #218 Tasks visible to their owner only · 4 of 6 met
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/main/resources/application.properties" line_range="73" />
<code_context>
+#which tasks users may get, list and cancel: only their own, whatever their groups, admins included (owner,
+#the default), or as their groups decide, team admins all tasks of their teams, super admins all tasks (group;
+#see docs/access-control.md)
+tesk.api.authorisation.task-visibility=owner
#server.port=8082
</code_context>
<issue_to_address>
**Old replicas still expose other users’ tasks**
When an authenticated deployment rolls out this version while older replicas are still serving requests, the older replicas keep the previous group-based authorization, so requests routed to them still let team and super admins get or cancel other users’ tasks and list those tasks. The owner-only policy is therefore not enforced consistently until those replicas are drained.
Drain or otherwise stop routing requests to old replicas before treating owner-only visibility as enforced.
</issue_to_address>
### Comment 2
<location path="src/integration-test/java/uk/ac/ebi/tsc/tesk/TaskVisibilityOwnerAuthIT.java" line_range="219" />
<code_context>
+ this.mvc
+ .perform(get(TASK_URL + "?view=" + view).header("Authorization", "Bearer BAR"))
+ .andExpect(status().isOk())
+ .andExpect(jsonPath("$.tasks.length()").value(expectedLength));
+ }
+ }
</code_context>
<issue_to_address>
**Wrong tasks can pass list tests**
When the API returns two non-owner tasks instead of the two expected owner tasks, `superAdmin_listsOwnTasksOnly` and `teamAdmin_listsOwnTasksOfTheTeamOnly` both pass if the API returns any two tasks, including other users' tasks, because `performListTask` checks only the array length. The tests therefore pass without verifying owner-only visibility.
Assert the returned task IDs (or creators) as well as the list length.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and with the default owner setting, admins can no longer get, list, or cancel other users’ tasks through the API; if that access policy is wrong, operators may silently lose their expected management workflow. Reverting or setting visibility to group restores the previous access, but this is a permission default that takes effect for everyone on deployment.
Blocking findings: src/main/resources/application.properties:73, src/integration-test/java/uk/ac/ebi/tsc/tesk/TaskVisibilityOwnerAuthIT.java:219
Check which tasks the owner-only list tests return, not only how many, and note in the upgrade notes that old pods keep the old rules until a rolling update has completed (Sourcery review). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Set date-released to 2026-11-24, the planned tag day, and add the changes merged since the first prep commit to the curated notes: owner-only task visibility (#218, #219), team names in labels (#216, #217) and audiences per service client (#215, #220; #220 is expected to merge before the tag); the merge of dev put them into the upgrade intro. The notes link the upgrade notes of the v2.1.0 tag, which never move, instead of the latest docs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Summary
Adds
TESK_API_AUTHORISATION_TASK_VISIBILITY(tesk.api.authorisation.task-visibility), following elixir-cloud-aai/generic-issues#124:owner(default, secure by default): users get, list and cancel only their own tasks, whatever their groups; super admins and team admins included. Groups still decide who may create tasks. Owner-only narrows the existing rules down to the creator's tasks:getTask(and so cancel, which gets the task first) additionally requires the creator (the rule moved from the@PostAuthorizeSpEL into the unit-testedUser#mayGet); lists always select by the creator hash and filter by the creator annotation, also for admins and with legacy labels.group: the previous behaviour (team admins see their teams' tasks, super admins all tasks).owner; invalid values stop the app at startup. Service clients follow the setting too (no change in effect). No effect withnoauth.group).Docs: access control (new "Task visibility" section; admin rules and examples marked as
group), configuration reference, upgrade notes of 2.1.0 (behaviour change, how to keep the old behaviour).Closes #218
Verification
./mvnw -B clean verify(JDK 21 container): 18732 unit tests and 153 ITs pass, JaCoCo check passes../mvnw -B spotless:check checkstyle:check: pass.mkdocs build --strict: pass.TaskVisibilityOwnerAuthIT(defaultowner): super admin and team admin get 403 on another user's task (grouped and ungrouped), cannot cancel it, and list only their own tasks (the selector names the creator); owners (member, team admin, super admin) keep access.AuthIT,ClaimAuthITandServiceClientAuthITpingroupand pass unchanged. Unit tests inUserTest(incl.mayGetwith legacy labels, service clients, missing metadata),ElixirPrincipalExtractorTest,ClaimAuthorisationTest,ServiceClientTokenServicesTest,KubernetesClientWrapperTest(owner-only admin list with legacy labels) andTaskVisibilitySettingTest(binding) cover both modes.Follow-up
The TESK Helm chart can't pass the variable today (no
extraEnv); a chart issue is drafted.Declined review findings
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5