carlos / platform Public

spec: store write credential rev 2 after Astra round 1

Sessions policy and state object kept apart from the store policy and
record; revocation on every key retirement; AWS-time check after mint.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 63de2400d8ff9e276f45e1d43ffe5d441f94cc2f parent bd09d8f
3 files changed, +270 −102
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-design.md +17 −1
  • docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md +73 −0
  • docs/superpowers/specs/2026-11-25-store-write-credential-design.md +180 −101
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-design.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-design.md
index 64e49b00f..9f09e8fe9 100644
--- a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-design.md
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-design.md
@@ -1,4 +1,4 @@
-# Review brief: store write credential design, round 1 of 3
+# Review brief: store write credential design, round 2 of 3
Repo carlos/platform, branch `store-write-credential`, at the commit named
in your prompt.
@@ -59,6 +59,22 @@ the store's full credential.
consoles, never logging the secret.
9. The record (§9): additive, and what an older console does with it.
+## Round 2
+
+Earlier rounds: round 1, `docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md`
+(Astra, NOT READY: P1s 1-3, P2s 4-7). Rev 2 of the design answers each,
+marked (astra N) in the text. The main changes: the write-credential state
+moved to its own object and its IAM statements to a second inline policy
+(`carlos-store-sessions`), so the store policy is unchanged for every store;
+both rotation walks revoke before deleting a key; an exact AWS-time check
+after each mint; explicit scope Denies in the session policy; the boundary's
+multipart actions under either switch; two distinct two-key refusals.
+
+First give one line per P1 and P2 from round 1: resolved, partly, or not.
+Carry every unresolved or partly resolved finding forward at its current
+severity, then add new findings. The verdict covers everything outstanding,
+earlier rounds included. This is round 2 of a budget of 3.
+
## Severity
- **P1**: unsafe, would not compile, a test fails, or it would not work.
diff --git a/docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md b/docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md
new file mode 100644
index 000000000..032d1528f
--- /dev/null
+++ b/docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md
@@ -0,0 +1,73 @@
+Reviewed commit `bd09d8f619393e3ef11e611ac9d289df6a58c1a3`. No network calls, file edits or tests.
+
+1. **P1 — §2.3, §5: `RotateFinish` can race with policy convergence and lose revocation.**
+
+ **Evidence:** The design adds policy convergence to `RotateFinish`, but the existing handler takes only the store walk lock ([apistore.go:1067](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/console/apistore.go:1067)). Storage-limit convergence takes the account lock and calls `GrantIn` without the walk lock ([planstorage.go:66](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/console/planstorage.go:66), [planstorage.go:144](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/console/planstorage.go:144)). `EnsureUser` replaces the entire inline policy ([aws.go:484](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/aws.go:484)).
+
+ **Failure scenario:** Convergence reads the record before revocation, pauses, then overwrites the newly installed revocation Deny with its stale policy. Previously revoked sessions regain access. `WithAppMutation` supplies no exclusion on ordinary deployments ([app_mutation.go:12](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/release/app_mutation.go:12)).
+
+ **Fix:** Explicitly require `RotateFinish` to acquire the account lock before the walk lock, covering the record read, revocation write and policy convergence. Add an interleaving test against another policy writer.
+
+ **Fault family:** Revocation must survive every concurrent policy rewrite.
+
+2. **P1 — §2.3: A repeated rotation retires a key without revoking its sessions.**
+
+ **Evidence:** The design attaches revocation to `RotateFinish`. However, `RotateIn` itself deletes an earlier pending key ([walk.go:544](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/walk.go:544)); the documented contract explicitly treats a second rotation as finishing the oldest key ([walk.go:492](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/walk.go:492)).
+
+ **Failure scenario:** A leaked key mints a 36-hour session. The member rotates twice. The leaked key is deleted, but its session remains usable because neither rotation calls the proposed revocation path.
+
+ **Fix:** Apply session revocation when `RotateIn` retires a pending key too, using a shared, retryable retirement operation. Test rotation twice without an intervening finish.
+
+ **Fault family:** Retiring a credential must also retire the sessions derived from it.
+
+3. **P1 — §7: The proposed boundary does not grant two promised operations.**
+
+ **Evidence:** The current boundary permits `AbortMultipartUpload` and `ListMultipartUploadParts` only when `store_conversion` is enabled ([main.tf:837](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/infra/modules/region-host/main.tf:837)). Section 7 adds only `sts:GetFederationToken` and requires only `store_bucket_prefix`.
+
+ **Failure scenario:** With `store_write_credentials=true` and `store_conversion=false`, minting succeeds, but the issued credential cannot list parts or abort an upload despite §1 and §3 promising those permissions.
+
+ **Fix:** Include those two S3 actions when either switch is enabled. Test the write-credentials-only configuration against the rendered boundary.
+
+ **Fault family:** Every advertised operation must be permitted through all policy layers.
+
+4. **P2 — §2.3: The one-minute mint refusal does not establish the stated clock guarantee.**
+
+ **Evidence:** [Design:122](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/docs/superpowers/specs/2026-11-25-store-write-credential-design.md:122) sets the cutoff to console time plus one minute and resumes minting when that local timestamp passes.
+
+ **Failure scenario:** The console is 30 seconds ahead of AWS. After waiting one local minute, AWS’s issue time is still 30 seconds before the cutoff. The returned credential is born revoked, contrary to the stated guarantee.
+
+ **Fix:** Define an explicit clock-error bound and a holdoff that accounts for it, or use a trustworthy AWS-time reference. Test both positive and negative skew.
+
+ **Fault family:** Mint admission and revocation must compare times consistently.
+
+5. **P2 — §9: Older writers can restore revoked access, not merely disable minting.**
+
+ **Evidence:** Section 9 describes losing the STS Allow when an older console drops the block. The same block also holds `revoked_before`. Older code unmarshals into a struct without that field and marshals that struct back ([objstore.go:348](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/objstore.go:348), [objstore.go:379](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/objstore.go:379)); convergence replaces the policy wholesale.
+
+ **Failure scenario:** After revocation, an older console rewrites the record and converges it. Removing the revocation Deny can restore an unexpired session’s S3 access. Removing permission to mint new sessions does not substitute for that Deny.
+
+ **Fix:** State this consequence explicitly and define the rollback restriction, covering every record/policy writer. If rollback remains supported, preserve revocation state independently or enforce a compatibility gate. Account for app-minted sessions lasting 36 hours.
+
+ **Fault family:** Revocation state must remain durable across version changes.
+
+6. **P2 — §2–§3: The three-policy intersection is not a complete permission ceiling.**
+
+ **Evidence:** The locally installed, repository-pinned STS SDK documents that a resource policy naming the federated session can grant permissions in addition to session policies ([api_op_GetFederationToken.go:69](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/sts@v1.45.6/api_op_GetFederationToken.go:69)). The proposed session policy relies on omitted Allows for reads and out-of-prefix access.
+
+ **Failure scenario:** A resource policy granting the session access can invalidate the unconditional claim that its permissions are confined to the three listed policies.
+
+ **Fix:** Either enforce explicit session Denies for prohibited actions and resources, or state and enforce the resource-policy restrictions required by the proof. Include resource-based grants in the policy-evaluation tests.
+
+ **Fault family:** The credential ceiling must account for every source of authorization.
+
+7. **P2 — §5: The two-key refusal gives an ineffective recovery instruction for an orphan key.**
+
+ **Evidence:** [Design:188](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/docs/superpowers/specs/2026-11-25-store-write-credential-design.md:188) tells both unfinished rotations and stray-key cases to finish rotation. Existing `RotateFinish` refuses when `PrevKeyID` is empty ([walk.go:620](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/store-write-credential/internal/objstore/walk.go:620)).
+
+ **Failure scenario:** A crashed mint leaves an extra key without a pending rotation. Following the 409’s instruction cannot recover the store.
+
+ **Fix:** Distinguish pending rotation from an occupied slot without one. For the latter, direct the member through the existing rotate-and-finish recovery; retain the rule against mint-side reaping.
+
+ **Fault family:** Every refusal must offer recovery that works for the detected state.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/2026-11-25-store-write-credential-design.md b/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
index d061000d9..4a9151ee3 100644
--- a/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
+++ b/docs/superpowers/specs/2026-11-25-store-write-credential-design.md
@@ -1,7 +1,9 @@
# Store write credential: design
-Status: draft for review, 2026-11-25. Asked for by Paul on 2026-11-25.
-Branch `store-write-credential`.
+Status: rev 2, 2026-11-25, after Astra design round 1
+(`docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md`;
+accepted findings are marked **(astra N)**). Asked for by Paul on
+2026-11-25. Branch `store-write-credential`.
## 1. What and why
@@ -38,10 +40,18 @@ user's permissions boundary limits it too ("the intersection of all three
policy types"). So the minted credential can never do more than:
1. the store user boundary (`infra/modules/region-host`, store prefix only),
-2. the store user's inline policy (`storePolicyJSON`: one bucket, every
- Deny), and
+2. the store user's inline policies (`storePolicyJSON`: one bucket, every
+ Deny; plus the sessions policy of 2.3, which grants no S3 at all), and
3. the session policy (one prefix, write only).
+The one other source of authority is a resource policy that names the
+federated session's ARN, which AWS lets grant beyond the session policy
+**(astra 6)**. Store buckets carry no bucket policy: the store user is
+denied `s3:PutBucketPolicy` (`historyBucketDenies`) and the console role is
+never granted it on store buckets. The session policy also carries explicit
+Denies on everything outside its scope (section 3), and an explicit Deny
+wins over any resource policy, so the scope holds even if one appeared.
+
The ceiling is the store's own principal. A bug in the session policy can
at worst give the third party what the app's own key already has, in that
one store. It can never reach another store or a deployment bucket, because
@@ -79,49 +89,103 @@ returned.
- **Presigned URLs.** LiveKit's `S3Upload` takes keys and a session token,
not URLs.
-### 2.3 What the store user gains, and how that stays safe
+### 2.3 The sessions policy, and keeping revocation durable
To call `GetFederationToken` the store user needs `sts:GetFederationToken`
-in its inline policy and in its boundary. Both are added only where the
+in its boundary and in an inline policy. Both are added only where the
feature is used:
- the boundary statement only with the module switch
- `store_write_credentials = true` (section 6); off, the boundary renders
+ `store_write_credentials = true` (section 7); off, the boundary renders
byte for byte as today;
-- the inline statement only for a store whose record carries a
- `write_credentials` block, which the first mint writes. Until then that
- store's policy is byte for byte today's.
+- a **second inline policy on the store user, `carlos-store-sessions`**,
+ written only for a store that has minted a write credential. The store's
+ own `carlos-store` policy (`storePolicyJSON`) does not change at all, for
+ any store.
+
+The sessions policy holds:
-Resource: `arn:<partition>:sts::<account>:federated-user/carlos-write-*`,
-the account and partition taken from the record's `user_arn`.
+```json
+{"Version": "2012-10-17", "Statement": [
+ {"Effect": "Allow", "Action": ["sts:GetFederationToken"], "Resource": "*"},
+ {"Effect": "Deny", "Action": ["*"], "Resource": "*",
+ "Condition": {"DateLessThan": {"aws:TokenIssueTime": "<revoked_before>"}}}
+]}
+```
-That statement is also reachable with the app's own delivered key, because
-IAM cannot tell one access key of a user from another. With it the app can
-mint itself federation sessions no wider than its own key. That is no new
-power over the store, with one exception, which this design closes:
+The Deny is present once the store has a revocation instant. The STS
+Resource is `*` here because IAM caps a user's inline policies at 2,048
+characters in total and the worst-case store policy is already about
+1,800; the boundary pins it to
+`arn:aws:sts::<account>:federated-user/carlos-write-*`. A test asserts the
+worst case (63-character bucket, scan enforcement and the storage-grace
+Deny on) stays under 2,048 with the sessions policy beside it.
+
+Its state lives in its own object, **`apps/<acct>/<app>/write-credentials.json`**
+(an environment store: `write-credentials/<env>.json`), not in the store
+record **(astra 5)**: `{"schema", "account", "app", "environment", "at",
+"by", "revoked_before"}`. Two reasons it is separate, both about keeping a
+revocation once made:
+
+- **Older consoles.** An older console rewrites `store.json` through a
+ struct that does not know a new block, and rewrites `carlos-store`
+ wholesale. It never reads or writes this object or the sessions policy,
+ so during a rollback a revocation stays in force in IAM and in the
+ bucket, and the next new console carries it on.
+- **Concurrent policy writers (astra 1).** Storage-limit convergence runs
+ `GrantIn` under the account lock without the store walk lock and
+ rewrites `carlos-store` from a record it read earlier. It cannot touch
+ the sessions policy. The sessions policy and the state object are
+ written only by the write-credential walks (mint, revoke) and the two
+ rotation walks, and every one of their doors holds the store walk lock
+ for that store, so they never interleave. A test runs a stale
+ `GrantIn` after a revocation and checks the revocation is still in
+ force.
+
+What it costs: an older console's teardown fails at `DeleteUser`
+(IAM refuses a user that still has an inline policy), so the store stays
+standing until a current console tears it down. That is the safe
+direction.
+
+**Why a revocation is needed at all.** The sessions policy is reachable with
+the app's own delivered key too, because IAM cannot tell one access key of
+a user from another. With it the app can mint itself federation sessions no
+wider than its own key: no new power over the store, with one exception,
**persistence past a rotation**. AWS does not document that deleting the
access key that minted a federation token revokes the token; it documents
only that permissions "are evaluated each time they are used" against the
user's policies. A thief holding a leaked app key could mint 36-hour
-sessions before the member rotates, and they would survive
-`carlos store rotate --finish`.
-
-So for a store with `write_credentials`:
-
-- the inline policy carries a revocation Deny once `revoked_before` is set:
- `Deny s3:*` on the bucket and its objects when
- `DateLessThan aws:TokenIssueTime <revoked_before>`. `aws:TokenIssueTime`
- is present only for temporary credentials, so the app's long-term key is
- never matched;
-- `RotateFinish` sets `revoked_before` and converges the policy, so a
- finished rotation kills every federation session minted before it, the
- console's and any the app minted itself;
-- `carlos store credential --revoke` does the same without rotating, for a
- leaked write credential.
-
-`revoked_before` is the console's clock plus one minute, to cover skew
-against AWS's clock (the Deny compares AWS's issue time). Mints are refused
-until that minute has passed, so a fresh credential is never born revoked.
+sessions before the member rotates.
+
+So **retiring a key revokes every session issued before it**, wherever the
+platform retires one **(astra 2)**:
+
+- `RotateFinish` (deletes the pending key), and
+- `RotateIn` when it deletes the pending key of an unfinished earlier
+ rotation (walk.go step 1),
+
+for a store that has a state object. Each sets `revoked_before`, writes the
+sessions policy, and only then deletes the key, so a failure part way
+leaves an over-revoked store with the key still live, never a deleted key
+with live sessions. Re-running the walk converges. `carlos store
+credential --revoke` does the same without rotating, for a leaked write
+credential.
+
+**Clocks (astra 4).** The Deny compares AWS's issue time with
+`revoked_before`. The design assumes the console's clock is within
+ε = 1 minute of AWS's (consoles run on EC2 with the Amazon Time Sync
+Service; SigV4 itself refuses requests more than 15 minutes off).
+
+- `revoked_before` = console now + ε, so a session issued just before the
+ revocation is caught even with the console up to ε behind AWS.
+- A mint is refused while console now < `revoked_before` + ε, which covers
+ the console up to ε ahead.
+- The exact check: the adapter reports AWS's issue time (the response's
+ `Expiration` minus the duration asked for), and a session issued less
+ than one second after `revoked_before` is discarded and the mint
+ refused. So no credential is ever handed out born revoked, whatever the
+ skew. Tests cover the console ahead of and behind AWS.
+
AWS notes that "it might take a few minutes for policy updates to take
effect", and the CLI says revocation can take a few minutes.
@@ -134,28 +198,29 @@ again for the same app reuses the user and bucket names. AWS ties a role's
sessions to the role's unique id; it does not say the same for a federated
user's parent. If it went by name, a write credential from the old store
could write into the new one under its prefix until it expires (24 hours at
-most). The new record has no `write_credentials` block, so nothing in the
-new user's policy refers to it.
+most). Teardown deletes the state object along with the user.
## 3. The scope: the core's session policy
Built in `internal/objstore` (provider-neutral, no SDK), from the bucket in
-the store's record and the validated prefix:
+the store's record and the validated prefix. With `R` =
+`arn:aws:s3:::<bucket>/<prefix>*` and `W` = the three write actions:
```json
{"Version": "2012-10-17", "Statement": [
- {"Effect": "Allow",
- "Action": ["s3:PutObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts"],
- "Resource": "arn:aws:s3:::<bucket>/<prefix>*"},
- {"Effect": "Deny", "Action": ["s3:PutObject"],
- "Resource": "arn:aws:s3:::<bucket>/<prefix>*",
+ {"Effect": "Allow", "Action": W, "Resource": R},
+ {"Effect": "Deny", "NotAction": W, "Resource": "*"},
+ {"Effect": "Deny", "Action": W, "NotResource": R},
+ {"Effect": "Deny", "Action": ["s3:PutObject"], "Resource": R,
"Condition": {"Null": {"s3:RequestObjectTagKeys": "false"}}}
]}
```
-The Deny refuses any upload that carries tags at all (`x-amz-tagging`),
-beside the user policy's Deny on the platform's own tag keys: the lesson in
-AGENTS.md ("absence is not the property") applied to the new credential.
+The two scope Denies are what make the scope hold against a resource
+policy **(astra 6)**. The last Deny refuses any upload that carries tags at
+all (`x-amz-tagging`), beside the user policy's Deny on the platform's own
+tag keys: the lesson in AGENTS.md ("absence is not the property") applied
+to the new credential. The MinIO contract runs this exact document.
The prefix is validated before it goes near a policy:
@@ -172,11 +237,11 @@ The docs say to give each third party a prefix of its own.
## 4. Lifetime
-`ttl` is required, 15 minutes (STS's floor) to 24 hours. LiveKit Cloud's
-longest egress is 12 hours (track or segments; a file output is 3 hours)
-and it uploads a file when the recording stops, so 24 hours covers the
-longest recording plus its upload. STS itself allows up to 36 hours; the
-lower cap shortens a leak.
+`ttl` is required, 15 minutes (STS's floor) to 24 hours, whole seconds.
+LiveKit Cloud's longest egress is 12 hours (a track or segments; a file
+output is 3 hours) and it uploads a file when the recording stops, so 24
+hours covers the longest recording plus its upload. STS itself allows up to
+36 hours; the lower cap shortens a leak.
## 5. The key slot and failure handling
@@ -185,27 +250,33 @@ the walks (`release.WithAppMutation`, the console's account lock and store
walk lock), so it never overlaps a grant, rotation or teardown of the same
store.
-1. `ListAccessKeys`: two keys already (a rotation not yet finished, or a
- stray key) is a 409 telling the member to finish the rotation first.
-2. `CreateAccessKey`.
-3. `GetFederationToken`, retried with backoff for up to 30 seconds while
+1. A record with a pending rotation (`prev_key_id`) is refused, 409
+ `rotation_unfinished`: "finish the rotation first: carlos store rotate
+ --finish" **(astra 7)**.
+2. `ListAccessKeys`: two keys with no rotation pending means a stray key
+ (a crashed mint). 409 `key_slot_full`: "run carlos store rotate, then
+ carlos store rotate --finish", which reaps it (walk.go step 2).
+ Both recoveries revoke live write credentials (2.3), and the message
+ says so.
+3. `CreateAccessKey`.
+4. `GetFederationToken`, retried with backoff for up to 30 seconds while
STS answers `InvalidClientTokenId` or `AccessDenied` (a new key and a
just-written policy both take seconds to propagate).
-4. `DeleteAccessKey`, always, also after 3 fails, on a context detached
+5. `DeleteAccessKey`, always, also after 4 fails, on a context detached
from the request's cancellation and bounded to 15 seconds.
The mint never reaps keys it did not create: the rotation walk's
"delivered but not yet recorded" gap means an unnamed key can be one the
-app is using. A key a crashed mint leaves behind has no holder, and the
-next `carlos store rotate` reaps it.
+app is using.
## 6. Provider boundary
- **Core** (`internal/objstore/writecred.go`): the prefix and lifetime
- rules, the session policy, the record block, the policy statements, the
- walk. No SDK.
-- **AWS adapter** (`internal/objstore/aws_writecred.go`): the single-use
- key and `GetFederationToken`. STS client from `internal/rootaws`.
+ rules, the session policy, the sessions policy, the state object, the
+ walks. No SDK.
+- **AWS adapter** (`internal/objstore/aws_writecred.go`): the sessions
+ policy write, the single-use key and `GetFederationToken`. STS client
+ from `internal/rootaws`.
- **S3-compatible stores** (a record with an `endpoint`): refused with
409 `write_credentials_unsupported`, saying a write credential needs AWS
S3 and STS. The console also refuses to boot with both
@@ -220,14 +291,18 @@ next `carlos store rotate` reaps it.
future MinIO provisioner implements the same `MintSession` seam with that
call.
-The provisioner seam gains one method:
+The provisioner seam gains two methods:
```go
-// MintSession mints a temporary credential for store user `user`, narrowed by
-// the IAM session policy `policy`, lasting ttl.
+// PutSessionPolicy writes the store user's sessions policy (2.3).
+PutSessionPolicy(ctx context.Context, user, policy string) error
+// MintSession mints a temporary credential for store user `user`, narrowed
+// by the IAM session policy `policy`, lasting ttl.
MintSession(ctx context.Context, user, policy string, ttl time.Duration) (Session, error)
```
+`DeleteUser` removes both inline policies.
+
What a non-AWS deployment loses: write credentials. Its apps keep their
full credential.
@@ -237,32 +312,35 @@ full credential.
- variable `store_write_credentials` (bool, default false), precondition:
needs `store_bucket_prefix`;
-- when true, one statement appended to the store user boundary:
- `Allow sts:GetFederationToken` on
- `arn:aws:sts::<account>:federated-user/carlos-write-*`. Managed fleet
- users share the boundary but their inline policies do not grant it, so
- they gain nothing;
+- when true, the store user boundary gains `Allow sts:GetFederationToken`
+ on `arn:aws:sts::<account>:federated-user/carlos-write-*`, and the two
+ multipart actions (already there under `store_conversion`) are included
+ when either switch is on **(astra 3)**. Managed fleet users share the
+ boundary but their inline policies grant neither, so they gain nothing;
- no change to the console role: `host_store` already grants every IAM
- call the mint makes, and the STS call is made as the store user.
+ call the walks make (`CreateAccessKey`, `DeleteAccessKey`,
+ `ListAccessKeys`, `PutUserPolicy` conditioned on the boundary,
+ `DeleteUserPolicy`), and the STS call is made as the store user.
## 8. Surface
-Console door (registered through `routedecls.go`, refused to linked
+Console doors (registered through `routedecls.go`, refused to linked
accounts, refused on a host-claim console):
```
-POST /api/cli/apps/{account}/{app}/store/credentials
-{"access": "write", "prefix": "recordings/", "ttl_seconds": 14400, "environment": ""}
+POST /api/cli/apps/{account}/{app}/store/credentials[?environment=e]
+{"access": "write", "prefix": "recordings/", "ttl_seconds": 14400}
-> 200 {"access_key", "secret", "session_token", "region", "bucket",
"prefix", "expires_at"} Cache-Control: no-store
-POST /api/cli/apps/{account}/{app}/store/credentials/revoke
+POST /api/cli/apps/{account}/{app}/store/credentials/revoke[?environment=e]
-> 200 {"revoked_before"}
```
Roles: `svcrole.Allow(svcrole.Service)`, so the app's server can mint one
per recording with the same Service credential media conversion uses (and
-Admin). A member's CLI token reaches it through membership as usual.
+Admin). A member's CLI token reaches it through membership as usual. Both
+doors take the account lock and then the store walk lock, as uploads does.
CLI, named like `store rotate`:
@@ -276,42 +354,43 @@ with the expiry and the scope, then the five values; `--json` prints the
door's answer, whose names match LiveKit's `S3Upload`. The secret and token
go to stdout only; nothing logs them, console or CLI.
-The door needs `CARLOS_STORE_WRITE_CREDENTIALS=1` on the console (the
+The doors need `CARLOS_STORE_WRITE_CREDENTIALS=1` on the console (the
operator applies the module switch first); without it, 503
`write_credentials_not_configured`.
-## 9. Record
-
-Additive block on the store record:
-
-```json
-"write_credentials": {"at": "...", "by": "...", "revoked_before": "..."}
-```
+## 9. Rollout and rollback
-An older console that rewrites the record drops it; the store's policy then
-loses the STS statement at its next convergence and the next mint writes
-it back. An older console's `RotateFinish` does not revoke: roll consoles
-forward before turning the switch on.
+- Roll every console forward before setting the switch: an older console's
+ rotation walks do not revoke.
+- After the switch is on, rolling a console back keeps every revocation
+ already made (2.3), but while the older console runs, a rotation it
+ performs does not revoke sessions, and its teardown of a store that used
+ write credentials fails at `DeleteUser` until a current console runs it.
## 10. Tests
- Unit, test-first: prefix and ttl validation; the session policy; the
- inline policy with and without the block and `revoked_before` (and byte
- identical without); the walk on the in-memory provisioner (refusals, the
- two-key 409, the key always deleted, the retry, revocation's minute);
- the AWS adapter against stub IAM and STS clients; the door and the CLI.
+ sessions policy and the 2,048-character worst case; the state object; the
+ walks on the in-memory provisioner (refusals, both two-key cases, the key
+ always deleted, the retry, revocation's margin and the exact AWS-time
+ check with the console ahead and behind, rotate-twice and finish
+ revoking before deleting, a stale `GrantIn` leaving a revocation in
+ force); the AWS adapter against stub IAM and STS clients; the doors and
+ the CLI.
- Policy evaluation: a small IAM evaluator in the tests, run over the
- three layers (boundary, inline, session), proving the minted scope
- cannot read, list, delete, tag, write outside the prefix, write another
- store or a deployment bucket, and that `revoked_before` cuts it off while
- leaving the app's long-term key alone.
+ layers (boundary, both inline policies, session policy, and a resource
+ policy naming the session), proving the minted scope cannot read, list,
+ delete, tag, write outside the prefix, write another store or a
+ deployment bucket, and that a revocation cuts it off while leaving the
+ app's long-term key alone.
- MinIO contract (`.amadan/ci.d/30-minio-contract`): a real session from
MinIO's STS narrowed by the core's session policy, against a user with
the store policy: put and multipart under the prefix succeed; read,
head, list, delete, tag, put outside the prefix, put tagged and put to
another bucket are denied.
- `tofu test`: the boundary byte for byte without the switch, the
- statement with it, the precondition.
+ statements with it (with and without `store_conversion`), the
+ precondition.
## 11. For Paul
@@ -319,8 +398,8 @@ forward before turning the switch on.
recording, but every existing Service credential can then mint write
credentials for its app's store.
- A store that has used write credentials lets its own delivered key call
- `GetFederationToken` (2.3). Revocation on `rotate --finish` closes the
- rotation gap; the cost is that finishing a rotation also ends every live
- write credential, which the LiveKit page already warns about for the old
- key.
+ `GetFederationToken` (2.3). Revocation on every key retirement closes
+ the rotation gap; the cost is that finishing a rotation also ends every
+ live write credential, which the LiveKit page already warns about for
+ the old key.
- A mint while a rotation is unfinished is refused (two-key ceiling).