Repository navigation
fix(approvals): judge every answer name a signed inbox holds - #163
Merged
Merged
Conversation
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>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:.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-2through-16) leaves the batch unjudged, causemisnamed,malformedorother_approval. A name holding a byte outside ASCII unjudges every batch, causemisnamed; inbox pruning never removes it.INDETERMINATE, the hold standing. A truncated batch stays unavailable. An envelope that does not authenticate is now unknown, not left out, and counted underunauthenticated.approvals approve --keyandapprovals reject --keyrefuse 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.LstatandInbox.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,-2through-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 namewhen 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 --keyrefuses, writing nothing, reportingapprovals: an approval dated before its request is never countedwith a hint to set the clock;approvals reject --keystill signs at such a clock.Consequence, stated on the status page and in ADR-0073: any inbox writer can hold any held call
INDETERMINATEwith 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 (
INDETERMINATEis notALLOW) and 5 (fail closed) are what the change leans on: every file the plane cannot judge moves a call towardINDETERMINATE, never toward running.How it was tested
TestASquattedRejectionNameNeverLetsAnApprovalRun,TestASquattedAnswerNameUnjudgesTheBatch,TestANameOutsideASCIIUnjudgesEveryBatch,TestEveryNameAnAnswerMayTakeIsRead,TestAnUnjudgedFileHoldsTheCallUntilARejection,TestAnAnswerThatDoesNotVerifyIsNeverNoRejection,TestAFileOfNoApprovalAskedIsLeftOutAlone,TestEveryAnswerCauseIsListed, and for the CLITestARejectionWhoseNameIsTakenIsFiledUnderAFreshLabel,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 inscripts/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), andListsExactlycases ininternal/approvals/inbox/listed_unix_test.go; the approval-authority port cases intestdata/ports/approval-authority/cases.json.==, 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.internal/approvals/inbox,internal/approvals,internal/gateway,internal/metrics,cmd/guardana-gateway,cmd/guardana-controlsuites 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 thegobinary orgo.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 andGOOS=linuxon the five packages, gofmt,make check-sizes,scripts/check-brand.sh,make docs-check: all pass.make qualityon 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--keycovering 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.