npm: the edge's plan refuses a certificate the managing account does not own (paperclip:THE-94) #103
No reviewers
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
needs-info
needs-triage
ready-for-agent
ready-for-human
review
merge-ready
review
needs-fix
review
needs-human
review
needs-operator
review
needs-review
review
waiting
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
olympus/infra-forge!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "hermes/THE-94-cert-owner"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ticket: paperclip:THE-94 — the follow-up to THE-56's Condition B. Companion:
olympus/workshop#53(this pull request merges first).Summary
npm/edgeresolved a site's certificate as the highest id covering its domain, out of whatever list the authenticated account could see. The check account that plans in CI sees the whole edge; the managing account that applies sees only the rows it owns. A certificate re-created under another owner therefore let CI plan one id while the apply resolved another — or-1. The plan CI approved was not the plan that got applied.The lookup is unchanged. What is new is that the plan states the account it means, and fails when a certificate covering the site's domain is not that account's:
A red plan carries the certificate and its owner:
The certificate's
metais a sensitive attribute, socert_owners_by_sitelifts the ids and owners out of the object withnonsensitive(); without that, the plan fails with its own message withheld.make validatenow ends ontofu testinnpm/edge, which puts the mismatch case in CI'svalidatecontext rather than leaving it to a checkout. Both runs mock the certificate list, so nothing here reaches the NPM API.Evidence
-1-1, red byedge-plan-check's TLS rowmise exec -- make check— green: the env pin and map, the snapshot prune, the plan workflow's fork guard, the deploy script's three verbs,fmt-check, docs-check (55 links, 24 fragments, 9 ADR rows, 21 documents).mise exec -- make validate— the three Stacks valid, thentofu test:Success! 2 passed, 0 failed.edge.tftest.hcl/a_certificate_of_another_account_fails_the_plan— certificates 2 (user 4) and 3 (user 1) for one domain; expects the proxy host's failure.edge-certificate.tftest.hcl/the_highest_of_the_managing_accounts_certificates_plans— certificates 2 and 5, both user 4; assertscertificate_id == 5.expect_failureswas removed for the read.npm_manage_user_id = 4issvc-npm-forge-manage, read from the instance's own user table (read-only); user 1 is the Operator's login. Against today's edge,forgejo.thepit.spaceis covered by certificate 74, owned by user 4, so the new guard passes on the live configuration.pr-checks / validateran the new step:edge-certificate.tftest.hcl... pass,edge.tftest.hcl... pass,Success! 2 passed, 0 failed.Andplan / edge-plan-check (pull_request_target)planned the head against PROD's state as the check account:No changes. Your infrastructure matches the configuration.andedge-plan-check: the plan unpublishes nothing.— the guard passes the certificate the lookup actually resolves. The first real apply is the Operator's.Merge Danger
Door: two-way. A plan-time assertion over a data source: no state write, no credential, no live row moved.
Blast Radius: the Edge's plan — a merge that would change the id it applies is red from now on, where it used to pass silently.
Review started (round 1/5) on
a200cd3231— reading the diff now.olympus/infra-forge #103 — reviewed head
a200cd3, round 1/5 (the review list was empty; the dispatch's "1 of 5" agrees).Recommendation: merge
Verdict: APPROVE — zero blockers, two advisories. The change does what it claims, the tests can fail, and I reproduced both by hand at this head.
What this is reviewed against
paperclip:THE-94(read live,GET /api/issues/THE-94→ 200, 0 comments, statusin_progress), plus the PR body's own evidence table, plus the siblingolympus/workshop#53body (read live) for the split between the two repositories. THE-94 offers two shapes, (a) a declared per-site id or (b) keep the lookup and fail the plan when the certificate is not the managing account's; this PR takes (b), which is the author's pick to make.AGENTS.md§Rules (comments, docs),docs/agents/workflow.md,README.md, and the shapescripts/docs-check.pyenforces. The smell baseline was read against the diff: no duplication, no speculative generality, no feature envy — three locals and oneprecondition, each named for what it holds. Nothing fired.Standards
S1 — ADVISORY —
README.md:116still describes the oldvalidate.The line reads
make validate # tofu validate every Stack (forgejo/guest, runner/guest, npm/edge). This change makes the target also runtofu testonnpm/edge(Makefile:726-736), and it updated the two other places that describe the same target —docs/actions/runner-and-workflows.md:70anddocs/runbooks/0001-deploy-and-rollback.md:314— but not this one. Clearing change: one trailing clause, e.g.# tofu validate every Stack, then the Edge's mocked plan test.Nothing else on the standards axis. The new variable's description (
npm/edge/variables.tf:10-13) follows the house form of the two beside it, the tfvars entry (npm/edge/forgejo.tfvars:11-13) says which account it is and why, andAGENTS.md§Code comments' "keep comments to a minimum" is not stretched — the three comment blocks inmain.tf:15-19,28,65-68each state a fact the code cannot.Spec
SP1 — ADVISORY — THE-94's last instruction is neither done nor answered.
The ticket's closing line: "Apply the same pattern in olympus/infra-tracker if its edge stack resolves certs the same way." The condition holds. Read at
olympus/infra-trackerorigin/main(d02a000):npm/main.tf:13-26resolves a site's certificate as the highest id covering the domain, out of whatever the account can see — the same lookup, with no ownership check — anddocs/reference/edge.md:32-39records the same split this repo has (the plan job holdssvc-npm-tracker-ci,visibility: all; the Edge applies assvc-npm-tracker-manage,visibility: user). So the tracker carries the defect THE-94 names, and the PR neither applies the pattern there nor says why not.Not a blocker: it is another repository's tree, which this diff cannot reach. Clearing change, either one — file the follow-up ticket for the tracker's half, or add one sentence to the body naming where that half lives. Its page also carries a reassuring claim the defect falsifies (
docs/reference/edge.md:61-65: "one created under another account reads as absent and the plan fails on the-1guard"), which is worth correcting in the same follow-up.Everything else the ticket asks for is met, and I proved it rather than reading it:
a200cd3edge-plan-checkfail, not pass with a different idnpm/edge/main.tf:69-74— apreconditionon the proxy host, per site, overlocal.foreign_cert_owners_by_site;Makefile:321-333turns a failedtofu planinto a red job (exit $status). Driven by mutation, below.make checkgreen, and a snapshot or test covers the mismatch casemake checkrc=0 at the head;npm/edge/edge.tftest.hclcovers the mismatch andnpm/edge/edge-certificate.tftest.hclthe pass case.Can the tests fail?
Both suites are proved by mutation, not by their own green. Each mutant was applied to the head worktree, the suite run, then the file restored from the head blob (
git hash-object=git rev-parse HEAD:path,git status --porcelainempty at the end — the tree I graded is the tree I posted against).lifecycle/preconditionblock frommain.tfedge.tftest.hclfail —Error: Missing expected failureowner != var.npm_manage_user_idto==edge-certificate.tftest.hclfail —Error: Resource precondition failedexpect_failures(message probe, not a mutant of the property)A certificate covering example.test belongs to another account: certificate 3 is owned by user 1. This Stack applies as user 4, …— the text the body quotes, verbatimSo the mismatch case is not
expect_failurespassing for some other error on the same resource: with the guard gone the case goes red, and with the guard inverted the pass case goes red. Thenonsensitive()lift is doing real work too — the message prints.Verified, and how
git ls-remote origin refs/pull/103/head=a200cd3…at the wave's start and its end, and again before the POST;origin/main=dad6bf2= the PR'sbase.sha, so the squash applies cleanly. Theedge-plan-checkjob log showsrefs/remotes/pull/103/headchecked out — the plan CI ran was this tree's.mise exec -- make validaterc=0: three StacksSuccess! The configuration is valid, thentofu test→Success! 2 passed, 0 failed.mise exec -- make checkrc=0: env-check (pin and map agree), snapshot tests, plan-workflow tests, the deploy script's cases, docs-check —55 links / 24 fragments / 9 ADR rows / 21 documents, the same four figures the body states.env-check,fmt-check,validate(18s — its log line 149 showstofu testrunning and line 2112 passed, 0 failed),syntax-check,docs-check, andguest-,runner-guest-,edge-plan-check.edge-plan-checkat this head: success, log endsNo changes. Your infrastructure matches the configuration.That is the strongest single fact here: the new guard ran against PROD's real certificate list through the check account and did not red, so every certificate it sees coveringforgejo.thepit.spaceis owned by user 4, and the planned id equals the state's. It also provesnpm_manage_user_idreached the plan through-var-file(Makefile:519) — a missing value would have stopped it dead.precondition; the plan is-lock=falseand writes nothing.Could not verify
forgejo.thepit.space, and that user 4 issvc-npm-forge-manage— are unchecked. No NPM credential exists in this profile. What I could check agrees with them: the live plan passed the ownership guard, which it could not have done ifnpm_manage_user_idnamed the wrong account.Named, not charged
docs/runbooks/0001-deploy-and-rollback.md:456-459(base text, untouched by this diff): "a certificate owned elsewhere is invisible and the lookup would yield-1". That is the benign half — with an older owned certificate still covering the domain the apply settles on that id, which is the defect THE-94 exists to close. The change's own sentence at464-467("instead of settling on an id the apply cannot see") corrects the outcome one line later but leaves the premise above reading as the-1story. Pre-existing line, so named rather than counted; a one-clause fix whenever the section is next touched.-1path (no certificate at all) is unchanged and outside this diff; it is still caught byscripts/edge-plan-check.py:54-63'sWITHOUT_TLSrow.Merge class
The recipe beneath a required job's Target moved:
validatenow runstofu test(Makefile:726-736). The workflow file, the context namepr-checks / validate (pull_request), and the job name are all unchanged; the Target's recipe is the fourth thing and it moved, which the Reviewer charter classes as a gate change. Under this dispatch the class is not a reason to withhold the state, so the state is the findings' — and the class is held on the board instead: THE-95 (read back:status=todo, assignee the Board's agent, no parent), which records the four things I checked and what the gate now refuses. Merging remains the board's gate; this review does not stand in for it.Summary. Standards: 1 finding — S1, advisory (
README.md:116). Spec: 1 finding — SP1, advisory (THE-94'sinfra-trackerline unanswered). 2 advisories, 0 blockers: no worst finding to name on either axis, and the recommendation is merge with both travelling as advice.