Repository navigation
Conversation
Admins no longer get the provenance of tasks they don't own: the rule
`admins-get-provenance` is removed from the base config, so that
`GET /tasks/{id}/provenance` answers only to the task's owner. Everyone
else, admins included, gets `403 Forbidden`, also for unknown tasks, as
for `GET /tasks/{id}`. Admins of a TES gateway must not see the details
of other users' tasks.
Tests cover the owner (200), other users, outsiders and admins (403 for
existing and unknown tasks, GET and HEAD), no token (401), the base
config's rules, and overlays that still remove the rule (startup stops
with FOCA's error). Docs (API, access control, operations, OpenAPI) and
the upgrade notes are updated.
BREAKING CHANGE: admins get `403` for the provenance of tasks they don't
own; overlays with `admins-get-provenance: null` must drop that entry.
Closes #568
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
Tests that the rule stored by earlier versions stops applying when the app starts without it, and that variants of the provenance path never give admins the provenance. The upgrade notes name custom lists of rules, which must drop the rule too; docs re-wrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
The 0.4.0 upgrade checklist no longer tells custom rule lists to add `admins-get-provenance`, but to leave it out; the provenance docs say that requests without a valid token get `401`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
The Permissions API section still listed the provenance of tasks among what admins see; it is for the task's owner only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
`GET /usage` no longer gives admins the totals of single users. Every authenticated caller gets the totals of their own tasks and of the tasks that service clients ran for them; service clients split theirs by named user (`group_by=acting_for`). Admins also get anonymous totals over all tasks (`aggregate`), withheld (`"withheld": true`) below `custom.accounting.min_aggregate_tasks` tasks (default 5, at least 1). `user_id` and `acting_for` may only name the caller (403 otherwise, also for admins). Execution reports are unchanged. The rule `admins-get-usage` is renamed to `authenticated-get-usage`; overlays that name the old rule stop the start. BREAKING CHANGE: admins get only anonymous totals at `GET /usage`; the rule `admins-get-usage` is renamed to `authenticated-get-usage`. Closes #569 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
Reviewer's GuideData structuresAdd the configurable minimum task count that determines when anonymous usage aggregates are withheld.
APIChange the usage endpoint contract to return caller-owned totals and an admin-only anonymous aggregate, and document its filters and response schema.
Restrict provenance access to task owners and replace the admin-only usage policy with an authenticated usage policy.
Uses of the APIHave the usage controller enforce caller-only filters, return the caller’s totals, and include thresholded aggregates for admins.
ImplementationImplement caller-owned usage totals and anonymous aggregate totals using shared aggregation fields, including withholding below the configured threshold.
Define the forbidden response for requests that try to retrieve another caller’s usage.
Update provenance method documentation to reflect the owner-only access policy.
ConfigurationUpdate the deployment example’s accounting comments to describe owner totals and anonymous admin totals.
DocumentationDocument the revised roles, caller-only usage totals and filters, anonymous aggregate threshold, and owner-only provenance.
Record the breaking changes, renamed usage rule, new aggregate setting, and effects on upgrades and rolling deployments.
TestsTest owner-only provenance access and the removal of the former admin provenance rule, including upgrade and path variants.
Test caller usage totals, filter authorization, anonymous aggregate thresholds and ranges, and the renamed access-control rule.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
📖 6 files modified
Preview · build overview · proTES · built Dec. 6, 2026, 12:23 a.m. UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #571 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 39 39
Lines 4021 4057 +36
=========================================
+ Hits 4021 4057 +36 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Review fixes for #569: `own_usage_totals` and `aggregate_totals` share the accumulators of `usage_totals` and get unit tests; the flags are named `include_owned` and `include_acted_for`. The docs no longer claim more than the minimum gives: it counts tasks, not users, and doesn't stop differencing. `user_id` takes the stored (namespaced) form. More endpoint tests (HEAD, grouping of aggregates, error detail, the error of each overlay of the old rule); comments re-wrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
Second-round review fixes for #569: module and OpenAPI comments no longer say "per user"; the docs say that `min_aggregate_tasks: 1` gives single-task totals; the include flags test checks `acting_for`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
The 0.8.0 upgrade section now says that `admins-get-usage` is named `authenticated-get-usage` since the unreleased changes, and that the old name stops the start (contract review of #569). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
Linked issuesChecked at commit 48fd6b2 #569 feat!: anonymous usage aggregates for admins · 6 of 8 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 6 issues
Sourcery assessment
Needs a human reviewer. 5 findings to address first, and every authenticated caller can now query usage, with the controller relying on get_owner() and the user_id/acting_for checks to keep results scoped to that caller. If that identity scoping is wrong, another caller's usage is disclosed; reverting stops future access but cannot undo data already returned.
Blocking findings: pro_tes/ga4gh/tes/server.py:174, pro_tes/config.yaml:105, pro_tes/accounting/report.py:176, tests/accounting/test_usage_endpoint.py:287, tests/accounting/test_usage_endpoint.py:343
Sourcery review of #571: `own_usage_totals` refuses unknown groupings also when it leaves out the caller's own tasks; the spec says where `acting_for` appears; the tests of withheld totals and of service clients' own rows check whole values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk
Stacked on #570. This branch contains #570's commits. The change of this PR is the last commit,
feat!: anonymous usage aggregates for admins. The PR targetsdevso that CI runs; CI runs only on PRs intodev. After #570 is merged, update this branch fromdevand the diff shrinks to this change.Summary
GET /usageno longer gives admins the totals of single users (D-555):acting_for).group_by=acting_for.aggregatesums all tasks in the time range (since,until), without user identifiers.custom.accounting.min_aggregate_tasks(default5, at least1), it holds only{"withheld": true}.{"withheld": false, "tasks": ..., ...}.user_idandacting_formay only name the caller. Naming anyone else gives403 Forbidden, also for admins. Withuser_id, only the caller's own tasks are counted; withacting_for, only the tasks run for the caller.admins-get-usageis renamed toauthenticated-get-usage("*"), and the controller decides what each caller gets. Overlays that name the old rule stop the start: a value is refused by proTES (RENAMED_RULES), andnullby FOCA.GET /usage/reports(execution reports) is unchanged and admin-only.GetUsageand the newAggregateUsageschema.docs/api.md: the table and the Usage section.docs/access-control.md,docs/operations.mdand the comments inconfig.yamlandvalues.yaml.docs/configuration.md: the new setting.docs/upgrading.md: a breaking-change note, and the older sections annotated.Deviations from the issue text (Claude's proposal; D-555's goal holds)
user_id,acting_fororgroup_byget400. Here every caller, admins included, gets their own totals, and the same rules apply to everyone: naming anyone else gives403, andgroup_byapplies to one's own rows. This matters for admins who also own tasks, e.g., the roleadmintogether withuser. They get both their own rows and the anonymous totals, and the API has one consistent rule instead of a special case per role."withheld": true, not the number of tasks, so that small counts aren't revealed either.Verification
tests/accounting/test_usage_endpoint.pywere written before the controller change. Run against the old controller, they failed: admins got per-user rows, users got 403, and there was noaggregate.own_usage_totalsandaggregate_totalsintests/accounting/test_report.py: all flag combinations, no double counting, threshold boundary 5 and 6, time range, empty collection, float overflow.group_by, the 403 detail, and the exact error for each form of the old rule in an overlay.pre-commit run --all-files: all hooks pass (ruff, mypy, semgrep, actionlint, gitleaks, ...).coverage run -m pytest -W ignore::DeprecationWarning(mongomock) at 07dae3c: 2664 passed, 11 skipped, coverage 100%. The later commits change only docs, comments and one test assertion;tests/accounting/test_report.pypasses.Scan imageandScan release imagefail on OpenSSL CVEs in the FOCA base image. fix!: provenance only for the task owner #570 anddevhave the same failures; they are unrelated to this change and block theCI passedgate. CI at 48fd6b2: same result, all other jobs pass (Test mongomock and MongoDB 7.0, Integration, Smoke test, Chart, Lint, Docs, CodeQL).Reviews
Adversarial, quality and contract reviews, two rounds.
Fixed: unit tests for the new report functions; one shared
_sums()accumulator helper; flags namedinclude_ownedandinclude_acted_for; precise exceptions per overlay case of the old rule.Docs, also fixed:
min_aggregate_tasks: 1gives single-task totals;user_idtakes the stored, namespaced form;Sourcery (6 threads): fixed
group_byvalidated before either totals branch, theacting_fordescription in the spec, two tighter tests (48fd6b2); answered: the deviation for admins (below) and rolling upgrades (already in the upgrade note). All threads resolved.Declined review findings
since/untilagainst differencing (medium): this is inherent to arbitrary time ranges, and the issue doesn't ask for it. Documented as not prevented.user_idandacting_forboth naming the caller (low): documented as matching no tasks, and it leaks nothing.docs/releases/0.8.0.md(low): these are the notes of a released version;docs/upgrading.mdcarries the pointers./usagein the spec (low): the gap predates this PR, and no other proTES extension path inadditions.openapi.yamllists a 401 either.Merge gate
#570 merges first; then this branch is updated from
dev. TheScan imagefailure (base-image OpenSSL CVEs) must be fixed or excepted for theCI passedgate; that is separate work.Open questions
None. The deviations above are Claude's proposal; D-555's goal holds.
Closes #569
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk