carlos / platform Public

Security: legacy direct-S3 fleet boxes can write any deployment record Issue open

Security. Legacy "direct-S3" fleet boxes hold write access to the whole deployment bucket, and reconcile turns any record there into hub routes. Found by Astra while reviewing the #511 replica-console fix (merged separately; that fix no longer trusts route data for the replica endpoint). Facts below were checked read-only against code (origin/main a32d70bc) and both AWS accounts on 2026-11-14.

Who holds the grant today

Flagship (bucket carlos-flagship-271376211898): nobody outside the platform.

  • Holders: only the platform host roles (carlos-flagship-host, -host-uk, -host-us, -host-au, -us-ha) and the org admin roles.
  • Fleet principals (carlos-remote-host-bakeoff, carlos-remote-host-demo, the fleet box roles) reach only their own fleet buckets.
  • No bucket policy, BucketOwnerEnforced, public access block on: nothing outside the account can reach it.

Dev (bucket carlos-dev-640012953448): one non-platform holder, our own demo.

  • IAM user carlos-remote-host-pi (the Pi demo fleet pi): inline policy, Sid DeploymentBucketObjects, s3:GetObject/PutObject/DeleteObject on carlos-dev-640012953448/* plus ListBucket.
  • Access key active since 2026-08-05, never used. No fleets/pi/ data exists.
  • Everything else with write is platform (carlos-dev-host, ie-group, fence writer) or admin. carlos-root-runner (r10r box) has Get/Put on `root-runner/` only.

Self-hosted deployments were not checked: their own operators can run the same module.

What a holder can do

The grant comes from infra/modules/region-remote-host/main.tf:167-191 (hostdeploymentbucket, created whenever deploymentbucketarn is set). A box uses it when CARLOSDEPLOYMENTBUCKET is set (internal/host/agent.go:5580 openDeployStoreEnv, first match wins over the fleet door). The console's BYO fleet page (fleet_byo.html:54-59) still documents the path as "Legacy direct-S3 (grandfathered)".

What limits it, and what doesn't:

  • No prefix limit. The fleet door (internal/edge/storedoor.go:807 aclWrite, :688 aclRead) scopes a door box to its own fleet and apps; a direct-S3 holder has none of that.
  • Bucket policy: dev's protects only control/boxes, box-volumes, box-enrollment, box-fences and bind files. Flagship has none.
  • Reconcile checks shape, not writer. scanInstanceRecords (reconcile.go:1177) runs ValidateShape, and validAddr allows loopback, private, public IPs and host names. convergeOwned (reconcile.go:911, upstream rewrite :985-1000) rewrites addr and health on any row the record owns.
  • Signed objects hold. Channel pointers, grants and production flags are Ed25519-verified, so they can't be forged, but they can be deleted.

So a holder can:

  • read the whole bucket: every account's records, gate hashes and fleet data;
  • write or delete any instance record, which means: - repoint a tenant's upstream to any address, intercepting its traffic and sessions; - point a public host at a loopback service on a platform box; - plant unit=console.service rows; - take down apps not flagged production;
  • rewrite the console route's upstream through its record. The mechanism is verified (adopt an exact-match row, then convergeOwned); the console case itself is Astra's claim, not reproduced;
  • delete releases or pointers, causing an outage.

Worst outcome per deployment

  • Flagship: none today; no principal holds the grant. The risk is it coming back through the module or the BYO page.
  • Dev: if the carlos-remote-host-pi key leaked (its secret is in that root's tofu state), full cross-tenant traffic interception and outages on dev.

Smallest fence (recommended order)

  1. Now, dev: remove the DeploymentBucketObjects and DeploymentBucketList statements from carlos-remote-host-pi, or deactivate its key. It breaks nothing (never used). After that, no non-platform principal holds the grant on dev or flagship. This is an AWS write and needs Paul's go.
  2. Close the path in code: - drop hostdeploymentbucket from region-remote-host (or make a non-empty deploymentbucketarn a validation error); - delete the grandfathered paragraph from fleet_byo.html; - update infra/modules/README.md and dev/region-pi.md.

This breaks only pre-door agents still on the bucket path, and none are known.

  1. Only if a real grandfathered box turns up (e.g. on a self-hosted deployment): scope the grant to the door's prefixes, or add one bucket-policy Deny on Put/Delete outside those prefixes, conditioned on the carlos-remote-host-* principals. Keep it tight: the lease outage came from an over-broad Deny.
  2. Largest: signed instance records so reconcile can refuse a writer that couldn't have written them. Not needed while 1 and 2 hold.

Adjacent, not investigated here: OrganizationAccountAccessRole in both dev and flagship trusts the org management account 665106592142. That is standard for an AWS Organization, but anyone with admin there is admin here.

Fence 1a applied on dev (key deactivated, not deleted), 2026-11-14 04:05:23Z. Go: agent manager 8a3d302 (Paul's delegate). Done by platform-a9 with profile kass (dev account 640012953448).

  • User: carlos-remote-host-pi; access key id AKIAZKA56U5UDWQMC3F2, created 2026-08-05T19:46:44Z (its only key).
  • Before (04:05:19Z): Status Active. get-access-key-last-used: ServiceName N/A, Region N/A, no LastUsedDate, so never used.
  • Action: aws iam update-access-key --user-name carlos-remote-host-pi --access-key-id AKIAZKA56U5UDWQMC3F2 --status Inactive.
  • After: Status Inactive.
  • Reverse with the same command and --status Active.

Unchanged and waiting for Paul on this discussion: the user's DeploymentBucketObjects and DeploymentBucketList policy statements, the region-remote-host module, and the BYO fleet page. With the key inactive, no non-platform principal can currently use a deployment-bucket write grant on dev or flagship.

Fence 1b applied on dev: the deployment-bucket grant is gone from carlos-remote-host-pi, 2026-11-15T05:34:25Z. Go: agent manager 8a3d302 (Paul approved #1007 on 2026-11-15). Profile kass, dev account 640012953448.

  • How: the customer tofu root for the Pi demo fleet (private repo, consumes infra/modules/region-remote-host at ref=main) now leaves deployment_bucket_arn unset (committed there as a962785). Applied targeted at module.pi.aws_iam_user_policy.host only.
  • Plan and apply: 0 to add, 1 to change, 0 to destroy.
  • The one change removed DeploymentBucketObjects and DeploymentBucketList. Because the root follows the module's main, the same policy also gained the current module's three version statements, all on the fleet's own bucket pi-fleet-640012953448 (s3:GetObjectVersion, s3:DeleteObjectVersion, s3:ListBucketVersions). Nothing on carlos-dev-640012953448 or any other bucket. 8a3d302 approved that before the apply.
  • Access key AKIAZKA56U5UDWQMC3F2 stays Inactive (deactivated 2026-11-14).

Before:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::carlos-dev-640012953448/*"
            ],
            "Sid": "DeploymentBucketObjects"
        },
        {
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::carlos-dev-640012953448"
            ],
            "Sid": "DeploymentBucketList"
        },
        {
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448/*"
            ],
            "Sid": "OwnRegionDataObjects"
        },
        {
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448"
            ],
            "Sid": "OwnRegionDataList"
        }
    ]
}

After:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448/*"
            ],
            "Sid": "OwnRegionDataObjects"
        },
        {
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448"
            ],
            "Sid": "OwnRegionDataList"
        },
        {
            "Action": [
                "s3:GetObjectVersion"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448/*"
            ],
            "Sid": "PullDoorObjectVersions"
        },
        {
            "Action": [
                "s3:DeleteObjectVersion"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448/*"
            ]
        },
        {
            "Action": [
                "s3:ListBucketVersions"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::pi-fleet-640012953448"
            ],
            "Sid": "PullDoorVersionList"
        }
    ]
}

Drift left alone, noted:

  • An untargeted apply on that root would set the access key back to Active (state still says Active; the module has no status knob). Do not run an untargeted apply there until the module exposes the key status and the root pins it Inactive. That module change rides the #1007 code branch.
  • An untargeted apply would also create the module's current lifecycle rule on pi-fleet-640012953448 (noncurrent 7 days, abort multipart 7 days). Left as is.

After this, no non-platform principal holds a deployment-bucket grant on dev or flagship. Code fence (module, BYO page, docs, test) follows on branch close-direct-s3-fleet-writes.

Code fence merged: 4c892040 (2026-11-15). Branch close-direct-s3-fleet-writes.

  • infra/modules/region-remote-host no longer has a deployment-bucket grant. A non-empty deployment_bucket_arn now fails the plan, with a message pointing at the fleet door, so a root cannot silently re-grant it. A new access_key_status (Active by default, or Inactive) lets a root pin a switched-off key.
  • The BYO fleet page no longer has the "Legacy direct-S3 (grandfathered)" paragraph. infra/remote-host.md, both module READMEs, and the bootstrap and agent comments no longer describe a deployment-bucket grant for off-cloud boxes.
  • Guard: internal/provision/remote_host_module_test.go pins every file in the module by SHA-256 (CI has no OpenTofu, and three Astra rounds showed a text scan of HCL can always be dodged). It also refuses symlinks and extra files, and a mutation test covers each way the grant could come back. tests/no_deployment_bucket.tftest.hcl checks the plan with a mock provider.
  • Reviews: Astra rounds 1 to 3, each finding fixed. Census overlay approved by Astra on #280. Copy approved by Paul.

Self-hosted deployments: exposure and what an operator must do. Any operator running region-remote-host with deployment_bucket_arn set has given its off-cloud boxes read, write and delete on its whole deployment bucket. That is everything this issue describes, inside their own deployment. Once they move to a module version at or after 4c892040, their plan fails until they act. To fix it:

  1. Remove deployment_bucket_arn from the root and apply, targeted at the host's aws_iam_user_policy if anything else has drifted.
  2. Move each box to the fleet door: register it with carlos fleets add-box, set CARLOS_FLEET, CARLOS_TUNNEL_URL, CARLOS_TUNNEL_TOKEN and CARLOS_TUNNEL_NAME, and unset CARLOS_DEPLOYMENT_BUCKET (the console's BYO fleet page has the full list).
  3. If a key was switched off by hand, set access_key_status = "Inactive", so the next apply cannot turn it back on. A root pinned to an older module ref keeps whatever it had until it is bumped, so operators should check their current roots, not only new ones.

What we can see of a self-hosted operator (their infra repo, read-only, origin/main, 2026-11-15): not exposed.

  • One region-remote-host instance, pinned to v0.33.8, with deployment_bucket_arn unset.
  • Its other fleet-box policies are written by hand and reach only their own fleet data buckets. No deployment-bucket statement.
  • Every deployment_bucket_arn in that repo is on region-host (its platform hosts, which need it), and CARLOS_DEPLOYMENT_BUCKET appears only in platform-host bootstrap and release scripts. None of it is on a fleet box. Other self-hosted operators we can't see should check for deployment_bucket_arn on any region-remote-host module block.

Pi key pinned Inactive (2026-11-15T07:30:12Z). Go: agent manager 8a3d302. Profile kass, dev account 640012953448.

  • The GitHub mirror's main was fast-forwarded d279e904 → 4c892040 (fast-forward only, no tag), so module consumers at ref=main get the #1007 module.
  • The Pi fleet's customer root now sets access_key_status = "Inactive" (committed there as 142a363).
  • Targeted plan on module.pi.aws_iam_access_key.host: No changes (0 to add, 0 to change, 0 to destroy). AWS already had the key Inactive; only the stale state said Active. A targeted apply -refresh-only then wrote Inactive into state (0 added, 0 changed, 0 destroyed). Key AKIAZKA56U5UDWQMC3F2: Inactive in AWS and in state.
  • A full plan on that root is now 1 to add, 0 to change, 0 to destroy: only the module's lifecycle rule on pi-fleet-640012953448 (noncurrent 7 days, abort multipart 7 days), left alone as noted. A full apply can no longer reactivate the key or re-grant the deployment bucket.