Skip to content

test: pin the access matrix of the redesign - #223

Draft
uniqueg wants to merge 3 commits into
devfrom
test/access-matrix
Draft

uniqueg wants to merge 3 commits into
devfrom
test/access-matrix

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Closes #224

Slice T1 of the access control redesign: the access-matrix test suite that pins the target behaviour and becomes the redesign's acceptance suite. Sibling of #222 / #221 (T3a, token validator); touches none of #221's files except a different section of docs/development.md. Test-only: no main code changes. Draft and unmerged until the whole redesign is done (TESK freeze).

Summary

  • src/integration-test/resources/access-matrix/matrix.txt: the design's caller x operation table (19 rows; service info, create, get in three views, list, cancel), parsed by the tests, so table and suite can't drift.
  • AccessMatrixIT: one test per row, caller variant (e.g. 12a-d: bad signature, alg none, unknown kid, ID token; 18a-c: decision service down / timeout / bad answer; 19a/b: user info 503 / timeout) and operation, plus the variants next to the table: stamped owner <iss>|<sub>, recorded actor of exchanged tokens, missing and foreign tasks alike (404, same Kubernetes requests), page tokens of other owners (400), user info refusing a locally valid token (401 on create only), and which operations ask the decision service (D-407 default: create only).
  • AccessMatrixServiceInfoPrivateIT (serviceInfoPublic: false), AccessMatrixAllOperationsIT (all operations at the decision service: same results as default, one evaluation per operation, fail closed 503, list scopes all/none, widening policy), AccessMatrixFailOpenIT (get/list/cancel fail open: owner-only fallback, create still closed).
  • Harness: mock OpenID Connect provider (MockIdp, LS Login-like user info), mock decision service (MockPdp, Java stand-in for the tes-authz owner-only reference policy, failure modes, records requests), mock Kubernetes API (MockCluster; lists honour the owner hash and return all tasks for any other selector, so a missing owner selector shows up as a leak).
  • pending.csv: 180 cells the current code doesn't meet, each with the slice that makes it pass (T2 72, T3b 68, T4a 11, T4b 14, T6 13, decide 2) and today's status. Pending tests are strict expected failures: they must still answer the recorded status and miss the target, then end as skipped; once a slice meets a cell, its test fails until the line is removed.
  • docs/development.md, "Access matrix": what the suite is, the slices, how to run it, what each slice must update.

Verification

  • ./mvnw clean verify spotless:check checkstyle:check (Java 21 container): BUILD SUCCESS, 584 integration tests, 0 failures, 180 skipped (= the pending cells), coverage check (100 %) passes.
  • Access matrix classes: AccessMatrixIT 212 (88 skipped), AllOperations 183 (84), ServiceInfoPrivate 26 (5), FailOpen 8 (3).
  • mkdocs build --strict: passes.
  • CI: all checks pass ("CI passed", Test, Lint, Docs, Smoke test, Scan image, CodeQL).

Review

Two rounds of adversarial and quality review. Fixed: row 11 now differs from a valid token only in iss; rows without callers fail the suite; the Kubernetes mock fails closed for unknown selectors; the actor must be recorded as an act chain; request order from the journal; pending.csv validates configurations and statuses; docs list the slices, the run command and the slice checklist.

Declined review findings

  • Pin more than the status for pending cells whose status is 200 today (e.g. what they list): low; the strict check already fails when a slice meets the target, and later slices replace these cells anyway.
  • @AfterAll check that every pending.csv line was used: it fails whenever a subset of tests is run; config names and line format are validated instead, and the skip counts equal the line counts today.
  • Refactor Harness.check / a helper for the foreign task: low, readability only.
  • Require job-type=taskmaster in the owner-hash stubs (lookahead): low; TESK's selectors always carry it.

Open questions

  1. Row 9 (unlisted service client, "valid token"): LS Login client tokens have aud = the client's own ID, which the D-392 pipeline (feat: validate JWT access tokens #221) accepts only for listed clients, so a real unlisted client gets 401 everywhere, not 403/404/200[]. The suite uses an unlisted client token with an accepted audience to pin the row as written. Keep the row (with a note in the design), or change it to 401?
  2. Service info with serviceInfoPublic: false for rows 16 (untrusted actor) and 17 (user sub = a listed client ID): the design says "others 200", but both tokens are refused on every operation (403 / 401). Marked decide (skipped) until settled.
  3. The fail-open variant pins the design's proposal (owner-only fallback, create never fails open), which is still open.
  4. tes-authz's draft Z1 contract (tes-authz#24) says a TES never returns or lists tasks of other owners "whatever the decision service answers" and asks list as a plain own evaluation, while D-407 (pinned here, pending T4b) has list scopes all/none and policies that widen beyond the owner. The two need aligning before T4b.

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5

uniqueg and others added 3 commits November 25, 2026 06:22
Add the caller x operation matrix of the access control redesign as
integration tests, the acceptance suite of the redesign: the design's
table as data (access-matrix/matrix.txt), one test per row, caller
variant and operation, and the variants next to the table (stamped
owner and actor, missing and foreign tasks alike, page tokens of other
owners, private service info, all operations at the decision service,
list scopes, widening policies, failing closed and open).

The tests run against a mock OpenID Connect provider, a mock decision
service (a stand-in for the tes-authz reference policy) and a mock
Kubernetes API. Cells that the current code doesn't meet yet are listed
in access-matrix/pending.csv with the slice that makes them pass and
today's status; their tests are strict expected failures and end as
skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
- Row 11 is wrong only in its issuer (signed with the provider's key).
- Every matrix row needs callers, and every caller a row.
- The mock lists all tasks for unknown or missing selectors, so that a
  selector without the owner shows up as a leak.
- The actor must be recorded as an act chain, not as a client ID.
- Requests are compared in journal order; pending.csv checks its
  configurations and statuses.
- Docs: the slices, how to run the suite, what a slice updates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Review the development guide's access-matrix section after the tests to confirm its description of the suite, slices, run command, and update process matches the implemented acceptance tests.

  • docs/development.md L101-186

Tests

Review the matrix table and pending-cell ledger first: they define the target access behaviour and the exact current-code gaps that the rest of the suite enforces.

  • src/integration-test/resources/access-matrix/matrix.txt L1-42
  • src/integration-test/resources/access-matrix/pending.csv L1-188

Review the shared caller, operation, ownership, and entitlement models together because the test cases and policy expectations depend on these representations.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Callers.java L1-288
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Entitlements.java L1-20
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Matrix.java L1-171
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Owners.java L1-26

Review the mock identity provider, decision service, and Kubernetes API as the test boundary that supplies tokens, policy answers, recorded requests, and task behaviour.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/MockCluster.java L1-204
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/MockIdp.java L1-238
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/MockPdp.java L1-184

Review the harness and parametrized matrix runner together: they configure the test environment, execute each cell, and enforce pending-cell expectations.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Harness.java L1-298
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/MatrixHarness.java L1-139
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/Pending.java L1-100

Review the focused matrix variants together, since they extend the baseline cases with private service info, all-operation authorization, fail-open handling, and design-specific edge cases.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/AccessMatrixAllOperationsIT.java L1-140
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/AccessMatrixFailOpenIT.java L1-69
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/AccessMatrixIT.java L1-330
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/accessmatrix/AccessMatrixServiceInfoPrivateIT.java L1-44

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

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #223   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           56        56           
  Lines         2612      2612           
  Branches       313       313           
=========================================
  Hits          2612      2612           

☔ 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.

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.

test: pin the access matrix of the redesign

1 participant