region-host: the store policy's overlap Deny spares s3:DeleteObject
The Deny that keeps a careless store prefix off the deployment's own buckets also denied s3:DeleteObject there, which is how a box releases an instance's lease (and how litestream retention, the registry snapshot prune, logship and the metrics flush work). It stranded leases on flagship on 2026-09-09 and on dev on 2026-10-29; both were hand-fixed. The Deny keeps DeleteBucket and CreateBucket. New plan-time test store_deny_spares_object_deletes. Census overlay approved by Astra (#280). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Prompts: I would go with subagents, but I only have half my usage available, so I'm concerned I'll run out of tokens. Can kick this off in 90 minutes when my session rolls over. <cross-session-message from="uds:/run/user/1001/cc-socks/1118974.sock" from-name="platform-01" from-mode="bypass"> v0.30.3 is done: dev and flagship boxes and both consoles run it, rolled by 11:15Z. All 13 of sophie's drop-ins came through identical, store.conf included. box-1 updated itself on stable. No DeleteObject 403s on sophie since your fix at 11:07Z. You're free to release and roll again. </cross-session-message> <task-notification> <task-id>b6qxzulvv</task-id> <tool-use-id>toolu_017c4ndo3XDU5298nHRFjLvw</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2d812478-ae68-44f2-8075-b2330abd5939/tasks/b6qxzulvv.output</output-file> <status>completed</status> <summary>Background command "After 15 min, recount 403s on sophie" completed (exit code 0)</summary> </task-notification> OK, proceed with subagents. Let's see this home! Squashed from region-host-store-deny into main.
5 files changed,
+60
−1
docs/superpowers/notes/census-proposal-region-host-store-deny.md+21 −0infra/modules/region-host/main.tf+9 −1infra/modules/region-host/tests/store_scanning.tftest.hcl+21 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-region-host-store-deny.tsv+8 −0
CI failed — run details
landed from region-host-store-deny
diff --git a/docs/superpowers/notes/census-proposal-region-host-store-deny.md b/docs/superpowers/notes/census-proposal-region-host-store-deny.md| new file mode 100644 |
| index 000000000..4b321b629 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-region-host-store-deny.md |
| @@ -0,0 +1,21 @@ |
| +# Census approval: region-host-store-deny |
| + |
| +Ruling `census-ruling-region-host-store-deny`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `infra/modules/region-host/main.tf` `external` | body | unchanged (1) | host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file | |
| +| `infra/modules/region-host/tests/store_scanning.tftest.hcl` `external` | body | unchanged (1) | adds plan-time run store_deny_spares_object_deletes asserting the Deny omits s3:DeleteObject and keeps DeleteBucket/CreateBucket; run by tofu test on an operator machine, never on a box | |
| + |
| +Envelopes re-pinned: `infra/modules/region-host`, `infra/modules/region-host/tests`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `infra/modules/region-host/main.tf` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file |
| +- `infra/modules/region-host/tests/store_scanning.tftest.hcl` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-c2-root-exec-inputs;basis=now fingerprinted: a tofu test file under infra/ (every regular file there is in scope); run by tofu test on an operator machine, never on a box; unchanged bytes |
| + |
| +Seal: `c68e2453bfc8afaf3794eb4c08850428982fa6954269b6b99bddfda4e6242929` → `951f33500fdf9e47408fd2b8fe8cab419eaf1f6b1803b6ccd169ff19fe7882c6`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-region-host-store-deny.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/infra/modules/region-host/main.tf b/infra/modules/region-host/main.tf| index aca89632e..0e206d0ea 100644 |
| --- a/infra/modules/region-host/main.tf |
| +++ b/infra/modules/region-host/main.tf |
| @@ -718,9 +718,17 @@ resource "aws_iam_role_policy" "host_store" { |
| # — would otherwise hand the box DeleteBucket on the control plane it |
| # runs from. An explicit Deny beats every Allow in IAM, so this holds |
| # whatever prefix an operator chooses, including a careless one. |
| + # |
| + # Bucket-level actions only. s3:DeleteObject must NOT be here: the box |
| + # deletes objects in its own deployment bucket all the time (releasing an |
| + # instance's lease is a DeleteObject on instances/<host>/lock.json, and |
| + # so are litestream retention, the registry snapshot prune, logship and |
| + # the metrics flush). Denying it stranded every lease on flagship on |
| + # 2026-09-09 and on dev on 2026-10-29. Object deletes in the deployment |
| + # buckets are already granted, and bounded, by the buckets policy. |
| { |
| Effect = "Deny" |
| - Action = ["s3:DeleteBucket", "s3:DeleteObject", "s3:CreateBucket"] |
| + Action = ["s3:DeleteBucket", "s3:CreateBucket"] |
| Resource = [ |
| var.deployment_bucket_arn, |
| "${var.deployment_bucket_arn}/*", |
diff --git a/infra/modules/region-host/tests/store_scanning.tftest.hcl b/infra/modules/region-host/tests/store_scanning.tftest.hcl| index 3ec400b4f..6413b0ed8 100644 |
| --- a/infra/modules/region-host/tests/store_scanning.tftest.hcl |
| +++ b/infra/modules/region-host/tests/store_scanning.tftest.hcl |
| @@ -68,3 +68,24 @@ run "refused_without_a_store_prefix" { |
| } |
| expect_failures = [aws_iam_role_policy.host_store_scan] |
| } |
| + |
| +# The store policy's overlap Deny names bucket-level actions only. A Deny on |
| +# s3:DeleteObject over the deployment buckets broke every lease release |
| +# (flagship 2026-09-09, dev 2026-10-29). |
| +run "store_deny_spares_object_deletes" { |
| + command = plan |
| + assert { |
| + condition = alltrue([ |
| + for st in jsondecode(aws_iam_role_policy.host_store[0].policy).Statement : |
| + !contains(flatten([st.Action]), "s3:DeleteObject") if st.Effect == "Deny" |
| + ]) |
| + error_message = "the store policy must never Deny s3:DeleteObject: lease releases delete objects in the deployment bucket" |
| + } |
| + assert { |
| + condition = anytrue([ |
| + for st in jsondecode(aws_iam_role_policy.host_store[0].policy).Statement : |
| + st.Effect == "Deny" && contains(flatten([st.Action]), "s3:DeleteBucket") |
| + ]) |
| + error_message = "the overlap Deny on DeleteBucket stays" |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 75956ce81..1eb468eb1 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -75,3 +75,4 @@ plan14-root-reads-domains-check-country.tsv b0fc198c53bb0dacba33a54c3d8bf8fe5ac0 |
| plan14-root-reads-static-stream-extract.tsv 7fb932b118e67e23b33a374c6a4020b38976667c7ec4cfb855c0f8b598b1756b |
| plan14-root-reads-ls284.tsv 744b16d970f22476b79982e57c326157ca5137fa96ccaee4a7ae10c25248d124 |
| plan14-root-reads-region-ha-p1b3b-t.tsv c68e2453bfc8afaf3794eb4c08850428982fa6954269b6b99bddfda4e6242929 |
| +plan14-root-reads-region-host-store-deny.tsv 951f33500fdf9e47408fd2b8fe8cab419eaf1f6b1803b6ccd169ff19fe7882c6 |
diff --git a/internal/provision/testdata/plan14-root-reads-region-host-store-deny.tsv b/internal/provision/testdata/plan14-root-reads-region-host-store-deny.tsv| new file mode 100644 |
| index 000000000..1daa3ba99 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-region-host-store-deny.tsv |
| @@ -0,0 +1,8 @@ |
| +# Census overlay region-host-store-deny, written by census-propose (#369). census-ruling-region-host-store-deny, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-region-host-store-deny.md. |
| +# 2 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy b2144d8184b0422b7944a230645b449c88c2936768d3bebcfd3f149f6c5b8a99 infra/modules/region-host/main.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-host-store-deny;basis=host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file file:external@0 7b8dfe1e94e7d29f05c6f6eb3ac0e12b25b7bab34153ae26c45c3b6e0fb57344 |
| +@legacy e951c61fa1c418d54a9efeacb1b09b06923f3db1ab89afa2e6fe31b373579c28 infra/modules/region-host/tests/store_scanning.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-c2-root-exec-inputs;basis=now fingerprinted: a tofu test file under infra/ (every regular file there is in scope); run by tofu test on an operator machine, never on a box; unchanged bytes;rev3=census-ruling-region-host-store-deny;basis=adds plan-time run store_deny_spares_object_deletes asserting the Deny omits s3:DeleteObject and keeps DeleteBucket/CreateBucket; run by tofu test on an operator machine, never on a box file:external@0 388c79cf2ce071ef15c072c92e78cc535930b52b017ef4c25a81d71cb8cc1e8a |
| +infra/modules/region-host/main.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-host-store-deny;basis=host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file file:external@0 7b8dfe1e94e7d29f05c6f6eb3ac0e12b25b7bab34153ae26c45c3b6e0fb57344 |
| +infra/modules/region-host/tests/store_scanning.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-c2-root-exec-inputs;basis=now fingerprinted: a tofu test file under infra/ (every regular file there is in scope); run by tofu test on an operator machine, never on a box; unchanged bytes;rev3=census-ruling-region-host-store-deny;basis=adds plan-time run store_deny_spares_object_deletes asserting the Deny omits s3:DeleteObject and keeps DeleteBucket/CreateBucket; run by tofu test on an operator machine, never on a box file:external@0 388c79cf2ce071ef15c072c92e78cc535930b52b017ef4c25a81d71cb8cc1e8a |
| +@coverage infra/modules/region-host cc58ac141c678a7e5bda3387643775365de4bed54725fd85f33905eb894b6c13 |
| +@coverage infra/modules/region-host/tests 78e248276ef1b2e1c32bfc6c1b7636f34a6eed32f0bb246e9b2903ec8df18f3a |