Skip to content

fix!: provenance only for the task owner - #570

Open
uniqueg wants to merge 4 commits into
devfrom
fix/568-provenance-owner-only
Open

uniqueg wants to merge 4 commits into
devfrom
fix/568-provenance-owner-only

Conversation

@uniqueg

@uniqueg uniqueg commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Summary

GET /tasks/{id}/provenance now answers only to the owner of the task. The rule admins-get-provenance is removed from the base config. Everyone else, admins included, gets 403 Forbidden, also for unknown tasks. That is the same response GET /tasks/{id} gives a non-owner, so the response doesn't tell whether a task exists. Before, admins got any task's provenance, and 404 for unknown tasks. The provenance tells which plugins and TES instances processed a task and when, which is a detail of someone else's task that admins must not see.

  • pro_tes/config.yaml: the rule is removed and the comments are updated; the model.conf comment and the get_task_provenance docstring follow.
  • Docs:
    • OpenAPI description and the 403/404 responses of GetTaskProvenance.
    • docs/api.md: the table and the Provenance section.
    • docs/access-control.md: the roles table, the rule list and Task ownership.
    • docs/operations.md.
  • Upgrade notes (docs/upgrading.md, Unreleased changes, breaking):
    • The stored rule is replaced on startup.
    • Overlays with admins-get-provenance: null stop the start (FOCA's error), so drop that entry.
    • Overlays or custom rule lists that still set the rule must drop it.
    • Rolling upgrades are covered.
    • Older sections that name the rule point to the change.

Breaking change

Admins get 403 for the provenance of tasks they don't own. Deployments that read the provenance with an admin's token must use the owner's token instead. Overlays that remove the rule (null, as the docs suggested before) must drop that entry.

Verification

  • Tests first, failing before the fix (9 failures), passing after:
    • The owner gets 200.
    • Other users, outsiders, admins and admins with the role user get 403 on GET and HEAD.
    • Unknown tasks give 403 to everyone.
    • Requests without a token get 401.
    • The base config has only the owner rule for the provenance.
    • An overlay with admins-get-provenance: null stops startup.
    • Upgrade: an app with the old rule lets admins read the provenance, and the next app without it gives 403.
    • Path variants never give admins the provenance.
    • A deleted task (tombstone) gives the owner 404 and admins 403.
  • pre-commit run --all-files: all hooks pass (ruff, mypy, semgrep, actionlint, gitleaks, ...).
  • coverage run -m pytest -W ignore::DeprecationWarning with mongomock: 2610 passed, 11 skipped, coverage 100%. The chart tests ran too, after helm dependency build deployment. The tests against a real MongoDB didn't run locally (CI runs them).
  • CI (run 47574785986): Lint, both Test jobs, Integration, Smoke test, Chart, Docs, CodeQL and Release readiness pass. Scan image fails, and so does the gate CI passed. The cause has nothing to do with this change: Trivy reports two fixable HIGH OpenSSL CVEs in the base image's Debian packages (libssl3t64, openssl, openssl-provider-legacy, 3.5.9-1deb13u1, fixed in 3.5.10-1deb13u1). They are CVE-2026-107494 and CVE-2026-124709, both denial of service in QUIC. dev's last run (2 Dec) passed, so the cause is a newer vulnerability database. dev would fail the same way now.

Merge gate

The image scan must pass. That needs a separate fix for the base image elixircloud/foca:0.23.0-py3.13: a FOCA image rebuilt with OpenSSL 3.5.10, or an accepted exception in .trivyignore.yaml. That fix is a decision outside this PR.

Declined review findings

  • Mentioning FOCA's policies_revision in the upgrade notes: proTES' docs don't document that FOCA setting anywhere, and the notes describe the default behaviour.
  • Rewording the 0.4.0 section of docs/upgrading.md ("In 0.4.0, owners and admins got ..."): the annotation already says that admins no longer get the provenance, and the section describes that version.

Open questions

None.

Closes #568

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqPsbB5s4NvhhYYcDJk

Summary by Sourcery

Limit task provenance access to its owner and remove the admin provenance permission from the base access-control configuration.

Bug Fixes:

  • Restrict task provenance access to task owners; admins and other non-owners now receive 403, including for unknown tasks, while unauthenticated requests remain 401.

Documentation:

  • Update access-control, API, operations, OpenAPI, and upgrade documentation to describe owner-only provenance access and the rule's removal, including configuration migration and rolling-upgrade considerations.

Tests:

  • Expand provenance API tests to cover non-owner GET and HEAD access, unknown tasks, tombstones, path variants, and removal of the former rule during upgrades.

uniqueg and others added 2 commits December 5, 2026 22:40
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
@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Change the OpenAPI contract so provenance is available only to the task owner, with non-owners—including admins and callers for unknown tasks—receiving 403.

  • pro_tes/api/additions.openapi.yaml L56, L74-75, L83

Implementation

Update the provenance retrieval docstring to describe the owner-only policy enforced by access-control rules.

  • pro_tes/ga4gh/tes/task_runs.py L817-818

Configuration

Remove the admin provenance policy from the base configuration and update the access-control comments to state that provenance is owner-only.

  • pro_tes/config.yaml L64-69, L100, L102 (removed lines)

Clarify in the access-control model comment that only task owners may read, cancel, or get provenance for a task.

  • pro_tes/access_control/model.conf L7-8

Documentation

Document owner-only provenance access, its 403 behavior for admins and unknown tasks, and the updated permissions and rule guidance.

  • docs/access-control.md L61-65, L100-106, L400-404 (+1 small edits)

Update the API endpoint and provenance documentation to specify owner-only access and its authorization responses.

  • docs/api.md L18, L182-188

Update the operations guidance to say that only owners receive task provenance.

  • docs/operations.md L425

Explain the breaking access change and required migration of stored rules, overlays, custom policy lists, and deployments during rolling upgrades.

  • docs/upgrading.md L18-38, L892-897 (+2 small edits)

Tests

Verify owner-only provenance access, authorization for non-owners and unknown tasks, configuration and upgrade behavior, and path variants.

  • tests/ga4gh/tes/test_provenance_api.py L88-116, L267-295, L329-357 (+7 small edits)

Assert that task tombstones return 404 to owners but 403 to admins for provenance requests.

  • tests/retention/test_retention_endpoint.py L128-131

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

📖 5 files modified


Preview · build overview · proTES · built Dec. 5, 2026, 11:10 p.m. UTC

@codecov

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e1e0683) to head (dc8ed1a).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #570   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           39        39           
  Lines         4021      4021           
=========================================
  Hits          4021      4021           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review December 5, 2026 22:17
@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit dc8ed1a

#568 fix!: provenance only for the task owner · 3 of 4 met · 1 to check by hand

# Requirement Status Notes
1 Only the task owner can read provenance; non-owners get the same not-owner response for existing and unknown tasks. ✅ Met The base config retains only the owner provenance rule, and tests cover 403 responses for non-owners, including admins, on existing and unknown tasks.
2 Update the OpenAPI description, API documentation, and upgrade notes to describe the owner-only access and breaking change. ✅ Met The OpenAPI spec and API, access-control, and upgrade documentation describe the new restriction and configuration migration.
3 Test owner access, non-owner and admin denials for existing and unknown tasks, and unauthenticated access. ✅ Met Tests cover owner 200, non-owner/admin 403 for existing and unknown tasks, and 401 without a token.
4 Release the change with the next proTES release. 👀 Check by hand (external system) Confirm that the owner-only provenance change is included in the next proTES release.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: docs/upgrading.md:894


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/upgrading.md Resolved
Comment thread docs/api.md Resolved
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
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Dec 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

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
@sourcery-ai
sourcery-ai Bot dismissed their stale review December 5, 2026 23:10

Sourcery withdrew this approval because the latest commits introduced blocking findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix!: provenance only for the task owner

1 participant