Skip to content

sec(auth): retry-any:purchases has no handler coverage and no non-test reference in internal/api #1743

Description

@cristim

retry-any:purchases is a #923 carved-out money verb with no handler-level coverage of any kind, and no non-test reference in internal/api at all.

Found by instrumenting grantAdmin to record every (action, resource) pair the whole internal/api suite actually asks for. Thirty distinct pairs came back. retry-any:purchases was asked zero times.

Why this is distinct from #1596

#1596 covers the two carved-out verbs that are exercised — execute:purchases (12 asks) and approve-any:purchases (23 asks) — but exercised through grantAdmin, which answers true for them. Since production refuses an admin:* holder those verbs, those 24 tests assert behaviour for a principal that cannot exist. #1596 repairs that.

This verb is a different shape: it is not covered by an impossible principal, it is not covered at all. Fixing grantAdmin will not create coverage that was never written.

What is unclear and needs establishing first

The zero references in non-test internal/api code raise a question the fix depends on:

  • Is the verb enforced somewhere else — the service layer, a different package — with the handler simply never consulting it? Then the gap is coverage, and the fix is a test.
  • Or is it not enforced on any live path, in which case the gap is the enforcement itself and a test would be asserting a control that does not exist.

Resolve that before writing anything. Grep for the constant across the whole repo, not just internal/api, and trace whichever call sites exist back to a reachable request path.

If it is enforced elsewhere

Add handler-level coverage matching whatever #1596 lands for its two siblings: an admin:* principal must be refused, and a principal with legitimate Purchaser membership must be allowed. Both directions — a refusal-only test passes trivially against a handler that refuses everyone.

If it is not enforced

That is a live separation-of-duties gap rather than a test gap, and it should be re-triaged accordingly. retry-any is the verb that re-drives a purchase; combined with #1668 and #1718 — where retry successors could buy a second uncancellable Azure savings plan — an unenforced retry verb is not a paperwork problem.

Verification

Whichever branch it lands in, mutation-verify: remove the verb from adminCarvedOuts and confirm the new test fails. Today that mutation is entirely silent for all three carved-out verbs, which is the condition #1596 exists to end.

Related

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions