docs(cloud-setup): split §4.4 bucket policy into ListBucket + GetObject statements#67
Open
hanwencheng wants to merge 1 commit intomainfrom
Open
docs(cloud-setup): split §4.4 bucket policy into ListBucket + GetObject statements#67hanwencheng wants to merge 1 commit intomainfrom
hanwencheng wants to merge 1 commit intomainfrom
Conversation
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.
Summary
docs/cloud-setup.md§4.4'sput-bucket-policysnippet is rejected by AWS at policy-save time:Two bugs in the original snippet:
Combined actions under one
s3:prefixcondition.s3:prefixis a request-time condition that only exists fors3:ListBucket(the prefix filter on listings).s3:GetObjecttargets a specific key and has no prefix parameter, so combining the two actions under one statement with ans3:prefixcondition is semantically incoherent — AWS rejects it at validation. Fix: split into two statements (one per action), per the standard AWS pattern.StringEquals "${tag}/"would only allow listing the exact root prefix (e.g.0xABC/), not sub-prefixes like0xABC/inbox/or0xABC/sent/2026-05/. The daemon needs to list deeper paths, so this would break the read path even after fixing bug docs: human-readable keychain metadata in manual tests + field-name translation design note #1. Fix: useStringLike "${tag}/*".After this change,
aws s3api put-bucket-policyaccepts the policy and the daemon can list+get its own prefix as intended.Why this matches the rest of the repo
The split-statement +
StringLike "${tag}/*"shape is already what the spec and wiki describe:docs/spec/ses-email-architecture.md§10.4 (lines 307–319) —AllowListOwnPrefix(ListBucket + s3:prefix StringLike) +AllowCrudOwnPrefix(GetObject/PutObject/DeleteObject, resource-ARN-scoped)wiki/tag-based-access.mdlines 154–174 — same shapeThe runbook author tried to be DRY by collapsing both into a single statement; the spec docs got the shape right. This PR brings the runbook in line with the spec.
Defense-in-depth preserved
s3:ListBuckets3:prefixcondition forces every list call to filter by${PrincipalTag}/*. Session taggedwallet=Acan only listA/...keys.s3:GetObjectbucket/${PrincipalTag}/*, expanded at request time. Session taggedwallet=Acan onlyGetObjectonA/foo,A/bar/baz, etc.Same defense-in-depth as the broken version, just in two statements that AWS will actually accept.
Verification
Validated the new jq snippet locally:
Will run end-to-end §4.5 against this policy as part of bringing up Stage 7 (#62).
Test plan
aws s3api put-bucket-policysnippet against a fresh AWS account — should succeed (no MalformedPolicy).agentkeys_user_wallet=<wallet_a>, exchange for STS creds, confirmaws s3 ls s3://$BUCKET/<wallet_a>/inbox/succeeds.aws s3 ls s3://$BUCKET/<wallet_b>/inbox/should fail with AccessDenied.aws s3 cp s3://$BUCKET/<wallet_b>/foo.eml -should fail with AccessDenied (resource-ARN check).🤖 Generated with Claude Code