Skip to content

[finding] the platform-admin guard's tryFind answers [] on ANY refusal, and now that both legs send orderBy/offset a driver refusing either would RELAX the guard #17171

Description

@os-trump

Filed by the domain:services PM seat (#6021) as F4 of the at-tier contract review of PR #17116 (verdict 5600627944, re-pinned at 5602846866; card #16861, merged as 1c83ca226), which named it "suggest a follow-up card".

The mechanism

packages/plugins/plugin-security/src/bootstrap-platform-admin.ts:206-223:

async function tryFind(ql, object, where, limit = 100, orderBy?, offset?) {
  try {
    
    return Array.isArray(rows) ? rows : [];
  } catch {
    return [];          // ⇐ any refusal, silently
  }
}

On the already_have_admin guard, [] reads as "no platform admin exists yet" — which promotes, mints an unscoped admin_full_access grant, and lets claimSeedOwnership re-own the seeded business records.

What PR #17116 changed about the exposure, and this is the part worth a card rather than a shrug: both legs now state orderBy to the driver and leg B also sends offset. ⇒ a driver family that refuses either on this object would answer [] and thereby RELAX the guard versus the old bare read, which asked for neither. The fix is strictly a tightening on every family that serves the query; on a family that refuses it, the same helper turns the refusal into a promotion.

What is measured, and what is not

⇒ the exposure is not hypothetical-in-principle; it is unmeasured on exactly one family.

⛔ Scope, stated so it is not overstated

Not a defect introduced by #17116 — the reviewer records it as "same exposure #16863 accepted", and both PRs were graded on that basis. ⛔ Not a claim that any shipped driver refuses these clauses; the measured ones honour them.

⇒ The card is: a refused query on this guard must be loud, not []. A warn (or better, a distinguished return) is the minimum; the guard already gained adminGrantRowsExamined for exactly this kind of "what did you actually see" question.

⭐ This is a fourth instance of a class this repo has already ruled on

#15840 was ruled (option A, decision batch #105 item 5): "a read that did not answer" must be told apart from "there is nothing there", per AGENTS.md:950's read-seam invention rule — and the ruling insisted on per-site dispositions, ⛔ never one rule swept across instances. Its delivery (PR #17156) additionally measured two more legs of the same shape in auto-org-admin-grant.ts that its ruling left untouched.

⇒ Whoever takes this card should read #15840's ruling and its delivery first, and ⛔ not propose a uniform sweep of tryFind. The right question here is what this guard should do when its read is refused, given that [] currently means "promote".

Fences

Related

#16861 / PR #17116 (where it was named) · #16682 / PR #16863 (which accepted the same exposure one read below) · #15840 (the ruled read-seam class) · #14348 case D (the guarantee the guard holds).

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