Repository navigation
feat(gateway): hold every receiver to the plane's one tenant - #168
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>
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>
One tenant under every authority: a listener.principal.tenant_id apart from tenant_id is now refused at load under directory and memory as under signed, naming both keys. A claim read from approvals.dir, or from the memory store, now carries the authority, tenant and project its record names, and the plane takes it only when they are the directory kind and the hold's own tenant and project. A claim that names another, and a 2.0 record, which names none, leave the hold standing: the retry is INDETERMINATE, a restart closes it APPROVAL_STATE_UNKNOWN, and the plane counts an answer of another hold. Signed-off-by: Konrad Karauda <konrad@karauda.com>
The unsigned pause file moves to schema_version 5, which names tenant and project. A plane reads a file of another tenant or project as unknown and blocks every call, as it does under any unreadable pause file. Versions 1 and 2 are refused, naming pause init --tenant --project, which rewrites such a file as version 5 with its entries. pause add, pause remove and the console keep the file's tenancy; state restore carries a version 2 backup as version 5 of the plane's tenancy and refuses another one. The signed file stays version 4. Signed-off-by: Konrad Karauda <konrad@karauda.com>
parseAny reads the head and the entries in two functions, and the tests that grew past the complexity bound are split, each read error checked. Signed-off-by: Konrad Karauda <konrad@karauda.com>
…e-tenant Signed-off-by: Konrad Karauda <konrad@karauda.com> # Conflicts: # CHANGELOG.md # cmd/guardana-control/approvals_sign.go # cmd/guardana-control/approvalssquat_test.go # docs/reference/cli.md # internal/gateway/authority.go # internal/gateway/signed_helpers_test.go # site/docs/changelog.html # site/docs/reference/cli.html
Init reads the file it would carry through ReadUnsignedV2 and wraps the cause of a refusal: a version 5 file, a signed one, one it cannot parse, or the mode or owner a plane's read refuses. Merge decodes its backup through the same reader, which now refuses a signed file itself. Under the signed authority a write to an unsigned file of version 1 or 2 answers ErrUnsigned, as the plane's read does. The signed header checks its tenancy through Tenancy.Check, the worst-case file of a 256-byte tenancy is pinned inside the byte bound, and the versions page lists the versions the code writes and reads. Signed-off-by: Konrad Karauda <konrad@karauda.com>
A claim whose record names another tenant, project or authority is judged before the duplicate check, so a good claim filed first no longer hides it from the other_hold count. Signed-off-by: Konrad Karauda <konrad@karauda.com>
Outside the signed authority, with pause.file set, a tenant_id or project_id past the pause file's 256-byte bound is refused at load, naming the key, instead of failing when the plane starts its poller. Signed-off-by: Konrad Karauda <konrad@karauda.com>
pause list opens an unsigned file's listing with its tenant and project and says that a plane of another reads the file as unknown; the console says the same of every readable file, signed ones included, and the scenario runner skips the line. The help shows --tenant and --project as required for pause init, and the command line page follows it. Signed-off-by: Konrad Karauda <konrad@karauda.com>
update asks writeKind whether the file it read is of the write's kind, which keeps update under the complexity bound, and the memory claim test carries each case's count beside its outcome. Signed-off-by: Konrad Karauda <konrad@karauda.com>
…oject ADR-0089 is accepted for its receivers: the listener's tenant, directory and memory answers and the unsigned pause file version 5. The pages, the configuration reference and the changelog say what a plane outside signed now refuses, and how to upgrade a pause file and a pending hold. Signed-off-by: Konrad Karauda <konrad@karauda.com>
…e-tenant Signed-off-by: Konrad Karauda <konrad@karauda.com> # Conflicts: # CHANGELOG.md # docs/backlog.md # site/docs/changelog.html
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
The security re-check of the receivers change found three gaps, each failing closed but misreported or late: - claimed() stopped at an answer in no known state before it saw another hold's claim, so other_hold went uncounted; every claim is now judged first and otherHold reported whatever stands beside it. - pause list and the console did not say that a signed pause file is bound to its plane and that an unsigned one reads as unknown under signed. - the 256-byte bound on tenant_id and project_id with pause.file set skipped signed, where a longer id loaded and then blocked every call; it now holds under every authority. Signed-off-by: Konrad Karauda <konrad@karauda.com>
Splits the order cases out of the unreadable-claim test to keep each under the complexity bound, and reads the pause file's tenancy through its embedded field. 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
A
listener.principal.tenant_idthat differs fromtenant_idis refused at load underdirectoryandmemorytoo, not only undersigned, naming the key and both values. Upgrade: leave it unset or set it totenant_id.Under
directory, an answered approval record (format2.1) counts only if it names thedirectoryauthority, the hold's tenant and the hold's project. Undermemory, the store reports each claim with the held call's tenant and project, and only the hold's count. Any other record, and a2.0record (which names none of them), is unreadable: a retry is blockedINDETERMINATEEVIDENCE_UNAVAILABLEand the hold stays; at restart the hold closesAPPROVAL_STATE_UNKNOWN. Each is counted inguardana_control_pipeline_answers_refused_totalunder causeother_hold, also when the hold's own claim stands beside it. A hold made before the upgrade is a2.0record and stays one when answered after it, so it never releases its call: let it expire, then issue the call again.Unsigned pause files use version
5, namingtenantandproject. A plane reads a file of another tenant or project as unknown (every call blockedPAUSE_STATE_UNAVAILABLE,/healthz503,doctornaminganother tenant or project). Versions1and2are refused as an unknown version, naming the fix.pause initnow requires--tenantand--project: it creates a version5file, or rewrites a version1or2file in place as5keeping its entries. Any other file at the name is refused with the reason (a version5file, a signed file, or a mode or owner the plane refuses).pause add,pause removeand the console keep the file's tenancy.state restorecarries a backup's1or2file to5for the plane's tenant and project. Undersigned,pause addandpause removeon a leftover unsigned1or2file answer that the file is not signed.pause listof an unsigned file opens withfor tenant <t> project <p>; a plane of another tenant or project, or under signed, reads this file as unknown. The console shows the same line for an unsigned file. For a signed file, it showsFor plane <id> tenant <t> project <p>; another plane, or a plane of another tenant or project, reads this file as unknown./api/stategainspause.tenancy. The scenario runner skips thepause listline.With
pause.fileset, atenant_idorproject_idover 256 bytes is refused at load underdirectory,memoryandsigned. The error names the key, as intenant_id: <n> bytes, past the 256 the pause file at pause.file can name. Previously, the plane loaded. Outsidesigned, it then failed to start reading its pause file. Undersigned, it blocked every call.Invariant or record
ADR-0089 is accepted for receivers. Outside
approvals.authority: signed, a plane's receivers hold their input to its one tenant and project. The route part of ADR-0089 comes in a later change.How it was tested
TestAPlaneServesOneTenantUnderEveryAuthority(directory and memory took another listener tenant);TestAClaimOfAnotherHoldIsUnreadableandTestAMemoryClaimOfAnotherHoldIsUnreadable(another tenant's, project's, authority's or a2.0claim released the call);TestADirectoryClaimOfAnotherHoldIsUnreadableincmd/guardana-gatewayover a real approvals directory (the lost hold closedAPPROVAL_NOT_RESUMED, wantAPPROVAL_STATE_UNKNOWN); pause acceptance tests (a version2file read clear, init wrote version2); the 257-byte tenant accepted; theother_holdcount; console andpause listtenancy; the runner's line skip; and the help form.2accepted; the one-tenant check off; the 256-byte bound off by one; the unsigned-leftover case undersignedoff; theother_holdorder restored; andpause initreading the file without its owner and mode check.pause listshowing another tenancy's file asClearorPaused. They also covered the 256-byte bound failing at start instead of load, theupdatemigration error undersigned, theother_holdcount missing beside a good claim, andpause init's untested owner/mode check and dropped refusal cause.other_hold. The outcome was already unreadable. The console andpause listexplain signed files' plane binding and that unsigned files read asunknownundersigned. The 256-byte bound coverssigned. Before the fix,claimhold_test.go:90(two claim orders) andpause_test.go:182(257-byte tenant and project ids loaded undersigned) failed.internal/gateway(1389),internal/gatewayconfig(656),internal/console(58),internal/pause(196),cmd/guardana-control(799) andcmd/guardana-gateway(910), withmake docs-check;internal/recovery(137) andinternal/docscheck(472) passed on the commit before, which the last one does not touch outsideinternal/docscheck/configdoc.internal/pause196 passed, 0 failed;internal/gatewayconfig631 passed, 24 failed (all in the access-control-list family that cannot run on the container's file system, none in this change). On Linux onlyinternal/pauseandinternal/gatewayconfigran.make vet,go vet -tags twoaccounts,golangci-linton darwin andGOOS=linux,gofmt,make check-sizes,scripts/check-brand.shandmake docs-checkpassed./api/stateis tested). No mutant targets the runner's line skip, the console line or the help form (each has a test shown red first). Localmake qualitywas not run; CI'smake qualityon this pull request is the gate.Documentation
Accepted ADR-0089 (receivers part) and amended ADR-0082 validation line. Updated
docs/status.md,docs/contracts.md(three rows for the unsigned receivers: directory claim, memory claim, unsigned pause file),docs/reference/cli.md,docs/concepts/enforcement-modes.md,docs/reference/versions.md,docs/guides/run-the-gateway.md,docs/backlog.md(B13), the configuration reference, andCHANGELOG(ChangedandFixedentries with the upgrade steps).