Skip to content

fix(approvals): judge every answer name a signed inbox holds - #163

Merged
karauda merged 16 commits into
mainfrom
fix/s29-inbox-squat
Nov 29, 2026
Merged

karauda merged 16 commits into
mainfrom
fix/s29-inbox-squat

Conversation

@karauda

@karauda karauda commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What changed, and why

Under approvals.authority: signed, an inbox writer (any member of the operators' group) could squat the name a granted operator's answer takes, <approval id>.<key id>-<decision>.answer, with a file the plane left out, so the operator's rejection could not be filed and another operator's approval could run the call. This change closes that:

  • The plane reads as "named for" an approval every inbox entry whose part before the first . matches the approval id ignoring ASCII letter case, and judges each one. A name that is not exactly one an answer takes (another case, a bad label, another shape), a body that is not an answer, a body naming another approval, or a label that is not the body's <key id>-<decision> (or that with -2 through -16) leaves the batch unjudged, cause misnamed, malformed or other_approval. A name holding a byte outside ASCII unjudges every batch, cause misnamed; inbox pruning never removes it.
  • In the plane's fold, any valid rejection wins over files the inbox could not judge; without one the batch is unknown and the call is blocked INDETERMINATE, the hold standing. A truncated batch stays unavailable. An envelope that does not authenticate is now unknown, not left out, and counted under unauthenticated.
  • approvals approve --key and approvals reject --key refuse a taken name ("is this account's own, filed earlier") only when all hold: this account owns the file at the taken name; the file is one envelope of the answer type whose one signature verifies under this key; its body names this key, the same decision and the same held call (tenant, project, request id, approval id, action digest and bundle digest: the members the plane compares with its hold); the inbox the command opened lists that exact name byte for byte, within the bounds the plane reads (4096 names, 16 answers per approval); and the earlier answer is one the plane counts by now (an approval dated between the plane's request time and the command's clock; a rejection however dated, since the plane counts that too). Owner and listing are read through the inbox directory the command opened (Inbox.Lstat and Inbox.ListsExactly), never again by path, so moving the inbox after it was opened changes nothing. A hard link of this account's earlier answer under another letter case opened through the exact name on case-folding APFS, an answer to another hold, or an approval dated outside the window is passed over and the answer is filed under the next free label of the same key and decision, -2 through -16. Stderr prints one of two texts, each followed by ; the answer is filed as <name> instead: <taken> is held by a file that is not this answer (owned by uid N), and <taken> opens this answer, filed earlier, but the plane may not read it under that name when it is this account's own answer that the inbox does not list under that exact name. The filed path is printed on stdout. With all 16 names taken the command refuses, naming the first and its owner. When this machine's clock reads a time before the plane held the request, approvals approve --key refuses, writing nothing, reporting approvals: an approval dated before its request is never counted with a hint to set the clock; approvals reject --key still signs at such a clock.

Consequence, stated on the status page and in ADR-0073: any inbox writer can hold any held call INDETERMINATE with a file the plane cannot judge, including a revoked operator's earlier answer; by filling an approval's 16 answer names, or the inbox past 4096 names, it makes the batch unavailable, a valid rejection notwithstanding, until the hold's expiry or the files' removal. It can never make a call run.

Invariant or record

ADR-0073 is amended ("Amended in 0.20") for the name reading and the fold. Invariants 4 (INDETERMINATE is not ALLOW) and 5 (fail closed) are what the change leans on: every file the plane cannot judge moves a call toward INDETERMINATE, never toward running.

How it was tested

  • New tests: TestASquattedRejectionNameNeverLetsAnApprovalRun, TestASquattedAnswerNameUnjudgesTheBatch, TestANameOutsideASCIIUnjudgesEveryBatch, TestEveryNameAnAnswerMayTakeIsRead, TestAnUnjudgedFileHoldsTheCallUntilARejection, TestAnAnswerThatDoesNotVerifyIsNeverNoRejection, TestAFileOfNoApprovalAskedIsLeftOutAlone, TestEveryAnswerCauseIsListed, and for the CLI TestARejectionWhoseNameIsTakenIsFiledUnderAFreshLabel, TestARejectionIsRefusedOnceEveryLabelIsTaken, TestAnAnswerThisAccountFiledIsNotFiledAgain, TestThisAnswerFiledEarlierIsRefusedHoweverItCameThere, TestARejectionLinkedUnderAnotherSpellingIsStillFiled (lower-case id, upper-case label, and suffix with U+017F; skips with reason on volumes that distinguish spellings, including Linux CI, listed in scripts/expected-skips.txt), TestAnAnswerFiledEarlierPastTheListingBoundIsPassedOver (4096 and 4097 names), TestTheInboxIsJudgedThroughTheDirectoryOpened (inbox moved after opened: listing and owner), TestAnApprovalThePlaneCannotCountIsPassedOver, TestARejectionDatedBeforeTheRequestIsStillFiledEarlier, TestAnApprovalDatedBeforeItsRequestIsNotSigned, TestAFileOfThisAccountsIsPassedOverUnlessItIsThisAnswer (a hard link, another decision, another approval, another key, a bad signature, and this key's rejection of this hold with another tenant, project, request, approval id, action digest or bundle digest: each passed over), and ListsExactly cases in internal/approvals/inbox/listed_unix_test.go; the approval-authority port cases in testdata/ports/approval-authority/cases.json.
  • Mutants, one replacement each, all killed by the intended tests: case-blind match back to ==, another approval's body left out again, the label bound and its start, the signature key check, the label check, an unauthenticated envelope known again, the rejection-wins fold, unjudged files ignored, the directory and adapter paths, the CLI's first label only; and in the filing rule: listing by path again, the listing bound removed, the owner read by path again, the hold comparison always true and each of its six members dropped in turn, the decision and the key id dropped, the date window always true, its lower bound and its upper bound dropped, a rejection held to the window, and the new refusal off or applied to rejections too.
  • macOS: internal/approvals/inbox, internal/approvals, internal/gateway, internal/metrics, cmd/guardana-gateway, cmd/guardana-control suites PASS. Linux: earlier rounds' suites ran on Linux (the spelling subtests skip there, as listed; before the filing-rule change, every lane test passed, and remaining failures were tests needing the go binary or go.mod, which the container lacked). The last two rounds were not run on Linux locally; CI runs them.
  • make vet, go vet -tags twoaccounts, golangci-lint darwin and GOOS=linux on the five packages, gofmt, make check-sizes, scripts/check-brand.sh, make docs-check: all pass.
  • The Two accounts CI job is the only run with two real accounts; CI's make quality on this pull request is the gate.

Documentation

ADR-0073's amendment; docs/concepts/approvals-and-the-held-call.md, docs/guides/set-up-signed-operators.md (the label scheme, what to do on a squatted name, a revoked operator's answer), docs/reference/cli.md (the command's labels, the paragraph on --key covering the full rule and the clock refusal within the page's 1500-word budget), docs/status.md's approval-authority limits, and the CHANGELOG's Security and Changed entries; site pages regenerated.

An account that may write the signed inbox could file
<A>.<bob key id>-reject.answer before Bob answered, holding an envelope for
another approval or junk under a junk signature. The inbox left the first
out alone and the plane left the second out as unauthenticated, so the
batch read complete; Bob's reject then failed on the taken name and another
operator's approval ran the call. A name spelling A in other letter cases
took the same entry on a case-folding volume and was never listed for A.

The inbox now counts every entry whose approval id matches A without case
as named for A, and holds each file to its own label: the body's
<keyId>-<decision>, or that with -2 to -16, under one signature by the
body's key, with a body naming A. Anything else leaves the batch unjudged
(causes misnamed, malformed, other_approval). The plane reads an answer
that does not authenticate as unknown, lets a valid rejection win over
unjudged files, and otherwise holds the call INDETERMINATE (cause
batch_unjudged); a truncated batch stays unavailable. approvals approve and
reject file under the next free fresh label when the name is taken, say so
on stderr, and refuse once all sixteen are taken.

An answer by a revoked operator, by the pinned policy key or with no
signature now holds its call INDETERMINATE until a valid rejection, the
hold's expiry or the file's removal, where another operator's approval used
to run it.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
A volume that folds case or normalizes names can take a name holding a
byte outside ASCII as the name an answer needs, by rules no comparison
here reproduces (APFS folds "ß" onto "SS" and "st" onto "ST"), so such
a name now makes every batch unjudged rather than being left out as
foreign.

approvals approve|reject passed over any taken name for a fresh label,
the operator's own earlier answer included, so a second answer of the
same decision was filed beside the first. A name this account's own
file holds is now refused as filed; only another account's file is
passed over, and the stderr line names it as such.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
…nedBy

The uid comparison converted os.Geteuid's int to uint64, which gosec refuses; the shared helper also refuses a negative uid.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
ADR-0073 records the 0.20 reading of an answer's name (the approval id
ignoring ASCII case, an ASCII-only label set) and that any valid
rejection wins over files the plane cannot judge. The approvals concept,
the signed operators guide, the command line reference, the status
page's limits and the changelog say what an operator sees: the next free
label when another account holds the name, the refusals, and that an
unjudged file holds its call INDETERMINATE until a valid rejection, the
hold's expiry or its removal.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>

# Conflicts:
#	CHANGELOG.md
#	site/docs/changelog.html
The answer's label scheme pushed the page past the reference budget of
1500 words. Six hand-written paragraphs say the same facts in fewer
words; the generated help blocks are unchanged.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
@karauda
karauda requested a review from a team November 28, 2026 13:10
@karauda
karauda requested a review from a team as a code owner November 28, 2026 13:10
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
b24d19f 2026-11-29T18:40:11.911Z View logs ↗
  • Build: Failed ❌

View logs ↗
b0221bd 2026-11-28T19:50:21.664Z View logs ↗
  • Build: Failed ❌

View logs ↗
80bf2ae 2026-11-28T17:48:08.759Z View logs ↗
  • Build: Failed ❌

View logs ↗
eb9ef2f 2026-11-28T17:34:54.643Z View logs ↗
  • Build: Failed ❌

View logs ↗
0623de0 2026-11-28T13:11:11.318Z View logs ↗

Any account that may write the inbox can hard-link a file this account
owns under the name an operator's answer takes. The signing command read
"this account owns the inode" as "this is my earlier answer", refused, and
filed nothing, so a linked file kept the operator's rejection out until
the hold expired.

The command now refuses as filed earlier only when the file at the name,
read bounded and without following a link, is one envelope of the answer
payload type whose one signature verifies under the operator's key and
whose body is that key's answer to this approval with this decision.
Anything else is passed over for the next free label, as another
account's file is, and stderr names the taken file as "a file that is not
this answer" with its owner.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
The CLI page, the signed operators guide and the changelog now say that
`approvals approve|reject --key` refuses a taken name as filed earlier
only for this account's own verified answer, and files under the next
free label otherwise. An unauthenticated answer is counted under
`unauthenticated`; a file the plane cannot hold to its name is
`misnamed`, which `/healthz` shows, and a name outside ASCII is removed
by hand. ADR-0073's amendment and the status limit say an inbox writer
can hold a call `INDETERMINATE` by truncating the batch, a valid
rejection notwithstanding, but cannot make one run.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>

# Conflicts:
#	CHANGELOG.md
#	site/docs/changelog.html
On a volume that folds case, a valid rejection linked under another
spelling opens through the exact name, while the plane counts that entry
misnamed. The command now treats the name as taken by this answer only
when the directory lists it byte for byte.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>
The command opened the inbox once but then checked the owner of a taken
name and the directory's listing by path again, so moving the inbox and
putting another directory at its path could make it refuse an answer as
filed earlier while the real inbox held only another spelling. Both now
go through the opened directory: Inbox.Lstat and Inbox.ListsExactly.

The listing reuses the plane's, bounded at 4096 names and 16 answers per
approval; past a bound, or when it cannot be listed, the name counts as
not listed and is passed over. When the passed-over file is this
account's own answer under a name the plane may not read, stderr now
says so instead of calling it a file that is not this answer.

The spelling test skips, with its reason listed in expected-skips.txt,
on a volume that does not open the other spelling through the exact
name, and covers U+017F, which APFS folds onto "s".

Signed-off-by: Konrad Karauda <konrad@karauda.com>
The command refused "filed earlier" for this key's answer to the same
approval id and decision, whatever tenant, project, request, action digest
or bundle digest it named, while the plane leaves such an answer out as
another hold's. It now compares every member the plane compares.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
A taken name holding this key's approval of this hold dated before the
request or after the command's clock is no answer the plane counts, yet
the command refused it as filed earlier, so the operator could not file
one that counts. filedEarlier now holds an approval to that window, as
the plane does; a rejection counts however it is dated, as at the plane.

approvals approve --key now refuses to sign an approval dated before the
plane held the request, with a hint to set the clock; reject still signs
at such a clock, since the plane counts that rejection.

A case for this key's rejection of this hold under another approval id
pins the last member of the hold comparison no test held.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
…eeds

The CLI reference and the changelog said an answer filed earlier needs only this key, approval and decision; it also needs this held call, the exact listing and, for an approval, a date the plane counts. They now say so, with approve's refusal at a clock before the request.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>
@karauda
karauda merged commit d48449d into main Nov 29, 2026
14 of 15 checks passed
@karauda
karauda deleted the fix/s29-inbox-squat branch November 29, 2026 18:59
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.

1 participant