objstore: separate write-credential session policies for AWS and MinIO
Phase 2 fix 2 (Paul's option 1). The action-family Deny that MinIO's STS accepts left s3:ListObjectAnnotations, s3:PutObjectAnnotation, s3:UpdateObjectEncryption and any later S3 action open to a resource policy granting the session directly (Astra code round 3). The core now decides a WriteScope and each backend renders it. AWS denies NotAction the three writes; MinIO keeps the families its STS accepts, and the MinIO contract runs that document. The evaluator test checks the AWS document against every S3 action the pinned SDK names, plus names it does not have yet, and tests NotAction itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 files changed,
+401
−103
internal/console/claim_backend_recorders_test.go+3 −3internal/console/claim_backends.go+1 −1internal/console/claim_purge_backend.go+1 −1internal/console/claim_store_effects.go+1 −1internal/objstore/aws_writecred.go+25 −2internal/objstore/aws_writecred_test.go+19 −8internal/objstore/contract_writecred_test.go+4 −2internal/objstore/memprovisioner.go+3 −3internal/objstore/minio_writecred.go+36 −0internal/objstore/provisioner.go+4 −3internal/objstore/writecred.go+52 −41internal/objstore/writecred_actions_test.go+205 −0internal/objstore/writecred_policy_test.go+19 −15internal/objstore/writecred_test.go+28 −23
diff --git a/internal/console/claim_backend_recorders_test.go b/internal/console/claim_backend_recorders_test.go| index 2aafe845a..b16a682ce 100644 |
| --- a/internal/console/claim_backend_recorders_test.go |
| +++ b/internal/console/claim_backend_recorders_test.go |
| @@ -123,15 +123,15 @@ func (w *StoreProvisionerBoundary) EnsureWriter(ctx context.Context, name, path, |
| } |
| return w.raw.EnsureWriter(ctx, name, path, policy) |
| } |
| -func (w *StoreProvisionerBoundary) MintSession(ctx context.Context, user, policy string, ttl time.Duration) (objstore.Session, error) { |
| - body, err := json.Marshal(map[string]any{"user": user, "policy": policy, "ttl": ttl.String()}) |
| +func (w *StoreProvisionerBoundary) MintSession(ctx context.Context, user string, scope objstore.WriteScope, ttl time.Duration) (objstore.Session, error) { |
| + body, err := json.Marshal(map[string]any{"user": user, "scope": scope, "ttl": ttl.String()}) |
| if err != nil { |
| return objstore.Session{}, err |
| } |
| if err := w.check(ctx, hostops.MutationTarget{Surface: "objstore.Provisioner", Method: "MintSession", Key: user, After: body}); err != nil { |
| return objstore.Session{}, err |
| } |
| - return w.raw.MintSession(ctx, user, policy, ttl) |
| + return w.raw.MintSession(ctx, user, scope, ttl) |
| } |
| type ScannerBoundary struct { |
diff --git a/internal/console/claim_backends.go b/internal/console/claim_backends.go| index dec0d7d1d..0f6c55962 100644 |
| --- a/internal/console/claim_backends.go |
| +++ b/internal/console/claim_backends.go |
| @@ -819,6 +819,6 @@ func (w claimDNSWriter) DeleteRecord(ctx context.Context, r dnsrec.Record) error |
| func (p claimStoreProvisioner) EnsureWriter(context.Context, string, string, string) error { |
| return objstore.ErrWriteCredentialsUnsupported |
| } |
| -func (p claimStoreProvisioner) MintSession(context.Context, string, string, time.Duration) (objstore.Session, error) { |
| +func (p claimStoreProvisioner) MintSession(context.Context, string, objstore.WriteScope, time.Duration) (objstore.Session, error) { |
| return objstore.Session{}, objstore.ErrWriteCredentialsUnsupported |
| } |
diff --git a/internal/console/claim_purge_backend.go b/internal/console/claim_purge_backend.go| index b4647dec6..883b9e090 100644 |
| --- a/internal/console/claim_purge_backend.go |
| +++ b/internal/console/claim_purge_backend.go |
| @@ -192,6 +192,6 @@ func (p claimPurgeDNS) EnsureRecord(ctx context.Context, record dnsrec.Record) e |
| func (p claimPurgeStore) EnsureWriter(context.Context, string, string, string) error { |
| return objstore.ErrWriteCredentialsUnsupported |
| } |
| -func (p claimPurgeStore) MintSession(context.Context, string, string, time.Duration) (objstore.Session, error) { |
| +func (p claimPurgeStore) MintSession(context.Context, string, objstore.WriteScope, time.Duration) (objstore.Session, error) { |
| return objstore.Session{}, objstore.ErrWriteCredentialsUnsupported |
| } |
diff --git a/internal/console/claim_store_effects.go b/internal/console/claim_store_effects.go| index ed7a269ee..981066e7c 100644 |
| --- a/internal/console/claim_store_effects.go |
| +++ b/internal/console/claim_store_effects.go |
| @@ -162,6 +162,6 @@ func claimStoreAdapters(ctx context.Context, store release.Store, p objstore.Pro |
| func (p claimEffectProvisioner) EnsureWriter(context.Context, string, string, string) error { |
| return objstore.ErrWriteCredentialsUnsupported |
| } |
| -func (p claimEffectProvisioner) MintSession(context.Context, string, string, time.Duration) (objstore.Session, error) { |
| +func (p claimEffectProvisioner) MintSession(context.Context, string, objstore.WriteScope, time.Duration) (objstore.Session, error) { |
| return objstore.Session{}, objstore.ErrWriteCredentialsUnsupported |
| } |
diff --git a/internal/objstore/aws_writecred.go b/internal/objstore/aws_writecred.go| index e00fc1a41..9802c4011 100644 |
| --- a/internal/objstore/aws_writecred.go |
| +++ b/internal/objstore/aws_writecred.go |
| @@ -70,18 +70,41 @@ func (p *awsProvisioner) EnsureWriter(ctx context.Context, name, path, policy st |
| return nil |
| } |
| +// awsWriteSessionPolicy is AWS's rendering of a write credential's scope |
| +// (spec §3, Paul's option 1 of 2026-11-25): scopeStatements, with every |
| +// action that is not one of writeActions denied by NotAction, everywhere. |
| +// |
| +// NotAction is the point. A Deny that names what it denies covers only the |
| +// actions it names, and S3 keeps adding object actions |
| +// (s3:PutObjectAnnotation, s3:ListObjectAnnotations and |
| +// s3:UpdateObjectEncryption came after the action families phase 1 named, |
| +// Astra code round 3). A Deny of everything but the three writes covers |
| +// them all, and any action added later, with no change here. Resource "*" |
| +// takes in every service, so the session can do nothing outside S3 either. |
| +// MinIO's STS refuses NotAction, so MinIO has its own rendering |
| +// (minioWriteSessionPolicy). |
| +func awsWriteSessionPolicy(w WriteScope) string { |
| + return marshalSessionDocument(w.scopeStatements( |
| + sessionStatement{Effect: "Deny", NotAction: writeActions, Resource: "*"}, |
| + )...) |
| +} |
| + |
| // MintSession is GetFederationToken as user (the store's writer), through |
| -// a single-use key. |
| +// a single-use key, narrowed by awsWriteSessionPolicy(scope). |
| // |
| // A provisioner whose S3 is at a custom endpoint refuses: its IAM is AWS's, |
| // and an AWS STS session means nothing to another store. |
| -func (p *awsProvisioner) MintSession(ctx context.Context, user, policy string, ttl time.Duration) (Session, error) { |
| +func (p *awsProvisioner) MintSession(ctx context.Context, user string, scope WriteScope, ttl time.Duration) (Session, error) { |
| if p.endpoint != "" { |
| return Session{}, ErrWriteCredentialsUnsupported |
| } |
| if err := ValidWriteTTL(ttl); err != nil { |
| return Session{}, err |
| } |
| + if err := scope.valid(); err != nil { |
| + return Session{}, err |
| + } |
| + policy := awsWriteSessionPolicy(scope) |
| // The writer is never given a key and mints never overlap (the caller |
| // holds the store's walk lock), so any key it has is one a crashed mint |
| // left behind, whose secret died with that process. Reaping them all |
diff --git a/internal/objstore/aws_writecred_test.go b/internal/objstore/aws_writecred_test.go| index 351540d84..c7ff23a55 100644 |
| --- a/internal/objstore/aws_writecred_test.go |
| +++ b/internal/objstore/aws_writecred_test.go |
| @@ -77,13 +77,16 @@ func (m *mintStub) provisioner(t *testing.T, st *stubSTS) *awsProvisioner { |
| } |
| } |
| +// testScope is a scope the core would build. |
| +var testScope = WriteScope{Bucket: "carlos-store-bab-titogo", Prefix: "recordings/"} |
| + |
| func TestAWSMintSession(t *testing.T) { |
| expires := time.Date(2026, 11, 25, 14, 0, 0, 0, time.UTC) |
| st := &stubSTS{answer: federationOK(expires)} |
| m := &mintStub{keys: []string{"AKIASTRAY"}} |
| p := m.provisioner(t, st) |
| - policy := writeSessionPolicy("carlos-store-bab-titogo", "recordings/") |
| - sess, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", policy, 4*time.Hour) |
| + scope := WriteScope{Bucket: "carlos-store-bab-titogo", Prefix: "recordings/"} |
| + sess, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", scope, 4*time.Hour) |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -100,7 +103,8 @@ func TestAWSMintSession(t *testing.T) { |
| t.Fatalf("STS signed as %v", m.signedAs) |
| } |
| in := st.calls[0] |
| - if aws.ToString(in.Policy) != policy || aws.ToInt32(in.DurationSeconds) != 4*3600 || |
| + // The scope reaches STS as AWS's rendering: the NotAction one. |
| + if aws.ToString(in.Policy) != awsWriteSessionPolicy(scope) || !strings.Contains(aws.ToString(in.Policy), `"NotAction"`) || aws.ToInt32(in.DurationSeconds) != 4*3600 || |
| !strings.HasPrefix(aws.ToString(in.Name), FederatedNamePrefix) || len(aws.ToString(in.Name)) > 32 { |
| t.Fatalf("GetFederationToken input = %+v", in) |
| } |
| @@ -121,7 +125,7 @@ func TestAWSMintSessionRetriesPropagation(t *testing.T) { |
| return ok(attempt, in) |
| }} |
| m := &mintStub{} |
| - if _, err := m.provisioner(t, st).MintSession(context.Background(), "carlos-w-bab-titogo", "{}", time.Hour); err != nil { |
| + if _, err := m.provisioner(t, st).MintSession(context.Background(), "carlos-w-bab-titogo", testScope, time.Hour); err != nil { |
| t.Fatal(err) |
| } |
| if len(st.calls) != 3 || len(m.sleeps) != 2 || m.sleeps[0] != federationBackoff[0] { |
| @@ -139,7 +143,7 @@ func TestAWSMintSessionFailureDeletesKeyAndKeepsSecrets(t *testing.T) { |
| return nil, &smithyAPIErrorStub{code: "MalformedPolicyDocument", msg: "bad"} |
| }} |
| m := &mintStub{} |
| - _, err := m.provisioner(t, st).MintSession(context.Background(), "carlos-w-bab-titogo", "{}", time.Hour) |
| + _, err := m.provisioner(t, st).MintSession(context.Background(), "carlos-w-bab-titogo", testScope, time.Hour) |
| if err == nil || len(st.calls) != 1 || len(m.sleeps) != 0 { |
| t.Fatalf("err %v after %d calls", err, len(st.calls)) |
| } |
| @@ -154,7 +158,7 @@ func TestAWSMintSessionFailureDeletesKeyAndKeepsSecrets(t *testing.T) { |
| st2 := &stubSTS{answer: func(int, *sts.GetFederationTokenInput) (*sts.GetFederationTokenOutput, error) { |
| return nil, &smithyAPIErrorStub{code: "AccessDenied", msg: "never"} |
| }} |
| - if _, err := m2.provisioner(t, st2).MintSession(context.Background(), "carlos-w-bab-titogo", "{}", time.Hour); err == nil { |
| + if _, err := m2.provisioner(t, st2).MintSession(context.Background(), "carlos-w-bab-titogo", testScope, time.Hour); err == nil { |
| t.Fatal("a mint STS never accepted succeeded") |
| } |
| if len(st2.calls) != len(federationBackoff)+1 || strings.Join(m2.deleted, ",") != "AKIASINGLEUSE" { |
| @@ -167,13 +171,20 @@ func TestAWSMintSessionRefusals(t *testing.T) { |
| m := &mintStub{} |
| p := m.provisioner(t, st) |
| p.endpoint = "https://s3.example.com" |
| - if _, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", "{}", time.Hour); !errors.Is(err, ErrWriteCredentialsUnsupported) { |
| + if _, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", testScope, time.Hour); !errors.Is(err, ErrWriteCredentialsUnsupported) { |
| t.Fatalf("mint behind an S3-compatible endpoint: %v", err) |
| } |
| p.endpoint = "" |
| - if _, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", "{}", 48*time.Hour); !errors.Is(err, ErrBadWriteTTL) { |
| + if _, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", testScope, 48*time.Hour); !errors.Is(err, ErrBadWriteTTL) { |
| t.Fatalf("mint for 48h: %v", err) |
| } |
| + // A scope the core would not build is refused before any key or call. |
| + for _, bad := range []WriteScope{{Bucket: "", Prefix: "recordings/"}, {Bucket: "carlos-store-bab-titogo", Prefix: ""}, |
| + {Bucket: "carlos-store-bab-titogo", Prefix: "rec*/"}, {Bucket: "carlos-store-*", Prefix: "recordings/"}} { |
| + if _, err := p.MintSession(context.Background(), "carlos-w-bab-titogo", bad, time.Hour); err == nil { |
| + t.Fatalf("mint for scope %+v succeeded", bad) |
| + } |
| + } |
| if len(m.created) != 0 || len(st.calls) != 0 { |
| t.Fatal("a refused mint made a key or called STS") |
| } |
diff --git a/internal/objstore/contract_writecred_test.go b/internal/objstore/contract_writecred_test.go| index f951e7817..116ed5454 100644 |
| --- a/internal/objstore/contract_writecred_test.go |
| +++ b/internal/objstore/contract_writecred_test.go |
| @@ -23,7 +23,9 @@ import ( |
| // policy engine (store write credential spec §6, §11): a session from |
| // MinIO's STS, signed by a user carrying the writer policy's S3 statements |
| // (the CI fixture, which TestMinioFixtureTracksWriterPolicy keeps in step), |
| -// narrowed by the core's own writeSessionPolicy. MinIO's AssumeRole for a |
| +// narrowed by MinIO's rendering of the core's scope, minioWriteSessionPolicy |
| +// (MinIO's STS refuses the AWS rendering's NotAction; the AWS rendering is |
| +// proved by the evaluator in writecred_policy_test.go). MinIO's AssumeRole for a |
| // user grants the intersection of the user's policy and the session policy, |
| // as GetFederationToken does on AWS. .amadan/ci.d/30-minio-contract stands |
| // the server up. |
| @@ -49,7 +51,7 @@ func TestWriteCredentialContractMinio(t *testing.T) { |
| RoleArn: aws.String("arn:minio:iam:::role/carlos-write"), |
| RoleSessionName: aws.String(FederatedNamePrefix + "contract"), |
| DurationSeconds: aws.Int32(900), |
| - Policy: aws.String(writeSessionPolicy(bucket, "recordings/")), |
| + Policy: aws.String(minioWriteSessionPolicy(WriteScope{Bucket: bucket, Prefix: "recordings/"})), |
| }) |
| if err != nil { |
| t.Fatalf("AssumeRole with the session policy: %v", err) |
diff --git a/internal/objstore/memprovisioner.go b/internal/objstore/memprovisioner.go| index 63340021f..e9a43cd05 100644 |
| --- a/internal/objstore/memprovisioner.go |
| +++ b/internal/objstore/memprovisioner.go |
| @@ -25,7 +25,7 @@ type MemUser struct { |
| // narrowed by. |
| type MemSession struct { |
| User string |
| - Policy string |
| + Scope WriteScope |
| TTL time.Duration |
| Issued time.Time |
| } |
| @@ -265,7 +265,7 @@ func (p *MemProvisioner) EnsureWriter(ctx context.Context, name, path, policy st |
| // whose policy does not let it call GetFederationToken (IAM would answer |
| // AccessDenied), reaps any key the user holds (a crashed mint's), and |
| // otherwise records the session and its scope. |
| -func (p *MemProvisioner) MintSession(ctx context.Context, user, policy string, ttl time.Duration) (Session, error) { |
| +func (p *MemProvisioner) MintSession(ctx context.Context, user string, scope WriteScope, ttl time.Duration) (Session, error) { |
| p.mu.Lock() |
| defer p.mu.Unlock() |
| if err := p.takeFailure("MintSession"); err != nil { |
| @@ -286,7 +286,7 @@ func (p *MemProvisioner) MintSession(ctx context.Context, user, policy string, t |
| if p.AWSClock != nil { |
| now = p.AWSClock() |
| } |
| - p.Sessions = append(p.Sessions, MemSession{User: user, Policy: policy, TTL: ttl, Issued: now}) |
| + p.Sessions = append(p.Sessions, MemSession{User: user, Scope: scope, TTL: ttl, Issued: now}) |
| n := len(p.Sessions) |
| return Session{ |
| AccessKeyID: fmt.Sprintf("MEMSESSION%d", n), |
diff --git a/internal/objstore/minio_writecred.go b/internal/objstore/minio_writecred.go| new file mode 100644 |
| index 000000000..5cb56467f |
| --- /dev/null |
| +++ b/internal/objstore/minio_writecred.go |
| @@ -0,0 +1,36 @@ |
| +package objstore |
| + |
| +// minioObjectDenies are the object actions MinIO's rendering of a write |
| +// scope denies by name, everywhere: every read, delete, tag, retention, |
| +// legal hold, restore and replication action on an object, as action |
| +// families. MinIO's STS refuses a session policy with NotAction (it cannot |
| +// marshal the empty action set that leaves), refuses an action name it does |
| +// not know, and accepts a wildcard only when it matches one it does, so the |
| +// AWS rendering cannot be used there and each family here is one MinIO |
| +// accepts. |
| +// |
| +// What this leaves undenied by name is what MinIO has no action for, so a |
| +// MinIO server cannot be asked for it: the AWS-only object actions |
| +// (s3:PutObjectAcl, s3:PutObjectAnnotation, s3:ListObjectAnnotations, |
| +// s3:UpdateObjectEncryption, s3:ObjectOwnerOverrideToBucketOwner, |
| +// s3:InitiateReplication and any S3 adds). That is why this is MinIO's |
| +// rendering and never AWS's: AWS gets awsWriteSessionPolicy's NotAction. |
| +var minioObjectDenies = []string{ |
| + "s3:Get*", "s3:Delete*", "s3:Replicate*", "s3:Restore*", "s3:Bypass*", |
| + "s3:PutObjectV*", "s3:PutObjectR*", "s3:PutObjectL*", "s3:PutObjectT*", |
| +} |
| + |
| +// minioWriteSessionPolicy is MinIO's rendering of a write credential's |
| +// scope (spec §3, §6): scopeStatements, with minioObjectDenies denied on |
| +// every object. MinIO's AssumeRole, signed with a MinIO user's key, takes |
| +// it as the session policy and grants the intersection of the user's |
| +// policy and it, as GetFederationToken does on AWS. The MinIO contract |
| +// (TestWriteCredentialContractMinio) runs this document on a real MinIO; |
| +// a MinIO provisioner's MintSession would send it. This build has none: |
| +// a store at an S3-compatible endpoint is refused write credentials |
| +// (ErrWriteCredentialsUnsupported). |
| +func minioWriteSessionPolicy(w WriteScope) string { |
| + return marshalSessionDocument(w.scopeStatements( |
| + sessionStatement{Effect: "Deny", Action: minioObjectDenies, Resource: "arn:aws:s3:::*"}, |
| + )...) |
| +} |
diff --git a/internal/objstore/provisioner.go b/internal/objstore/provisioner.go| index 0784e28f0..14e801098 100644 |
| --- a/internal/objstore/provisioner.go |
| +++ b/internal/objstore/provisioner.go |
| @@ -39,9 +39,10 @@ type Provisioner interface { |
| // store boundary if absent, and writes its inline policy: an overwrite, |
| // like EnsureUser's. |
| EnsureWriter(ctx context.Context, name, path, policy string) error |
| - // MintSession mints a temporary credential for user, narrowed by the |
| - // IAM session policy policy, lasting ttl. It never answers a lasting |
| + // MintSession mints a temporary credential for user, narrowed to scope |
| + // by a session policy the backend renders for its own engine from the |
| + // core's WriteScope, lasting ttl. It never answers a lasting |
| // credential: a backend that cannot narrow a session answers |
| // ErrWriteCredentialsUnsupported. Session.Issued is the backend's clock. |
| - MintSession(ctx context.Context, user, policy string, ttl time.Duration) (Session, error) |
| + MintSession(ctx context.Context, user string, scope WriteScope, ttl time.Duration) (Session, error) |
| } |
diff --git a/internal/objstore/writecred.go b/internal/objstore/writecred.go| index e44438b11..74cdbe7b8 100644 |
| --- a/internal/objstore/writecred.go |
| +++ b/internal/objstore/writecred.go |
| @@ -218,9 +218,9 @@ func ValidWriteTTL(d time.Duration) error { |
| return nil |
| } |
| -// sessionStatement is one statement of the two policies this file writes. |
| -// Unlike policyStatement it can say NotAction and NotResource, which the |
| -// write scope's Denies need. |
| +// sessionStatement is one statement of a write credential's session |
| +// policy, as a backend renders it from a WriteScope. Unlike policyStatement |
| +// it can say NotAction and NotResource, which the scope's Denies need. |
| type sessionStatement struct { |
| Effect string `json:"Effect"` |
| Action []string `json:"Action,omitempty"` |
| @@ -249,49 +249,60 @@ func marshalSessionDocument(st ...sessionStatement) string { |
| // the other two let an uploader list and abandon its own parts. |
| var writeActions = []string{"s3:PutObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts"} |
| -// writeObjectDenies are the object actions a write credential is denied by |
| -// name, everywhere: every read, delete, tag, retention, legal hold, restore |
| -// and replication action on an object, as action families. MinIO refuses a |
| -// policy that names an action it does not know, and accepts a wildcard only |
| -// when it matches one it does, so each family here is one both engines |
| -// accept. Three AWS object actions fit no such family and stay denied only |
| -// by absence (nothing allows them): s3:PutObjectAcl (store buckets are made |
| -// with ACLs disabled, so S3 refuses it anyway), |
| -// s3:ObjectOwnerOverrideToBucketOwner and s3:InitiateReplication (both need |
| -// a replication configuration, which a store's own policy denies setting). |
| -// TestWriteCredentialScopeEvaluation pins that list. |
| -var writeObjectDenies = []string{ |
| - "s3:Get*", "s3:Delete*", "s3:Replicate*", "s3:Restore*", "s3:Bypass*", |
| - "s3:PutObjectV*", "s3:PutObjectR*", "s3:PutObjectL*", "s3:PutObjectT*", |
| +// WriteScope is what a write credential may do, and the core decides it |
| +// (spec §3): writeActions on the objects under Prefix in Bucket, nothing |
| +// else, and never an upload that carries tags. Prefix has passed |
| +// ValidWritePrefix. A backend renders it into the session policy its own |
| +// engine takes (Provisioner.MintSession): AWS as awsWriteSessionPolicy |
| +// (aws_writecred.go), MinIO as minioWriteSessionPolicy |
| +// (minio_writecred.go). Both start from scopeStatements, so the allowed |
| +// writes, the resource and the tag rule cannot drift between them; they |
| +// differ only in how they deny every other action, which is the engines' |
| +// difference. |
| +type WriteScope struct { |
| + Bucket string |
| + Prefix string |
| } |
| -// writeSessionPolicy is the scope of a write credential: writeActions under |
| -// prefix in bucket, and nothing else (spec §3). |
| +// objects is the scope's one resource: every key under Prefix. |
| +func (w WriteScope) objects() string { return "arn:aws:s3:::" + w.Bucket + "/" + w.Prefix + "*" } |
| + |
| +// valid refuses a scope the core did not build: no bucket, or a prefix |
| +// ValidWritePrefix refuses. A backend asks before it renders. |
| +func (w WriteScope) valid() error { |
| + if w.Bucket == "" || strings.ContainsAny(w.Bucket, "*?/$") { |
| + return fmt.Errorf("objstore: write credential scope names no bucket") |
| + } |
| + return ValidWritePrefix(w.Prefix) |
| +} |
| + |
| +// scopeStatements are the statements every rendering shares, around the |
| +// backend's own denial of every action that is not a write (deny): |
| // |
| -// The Denies after the Allow make the scope explicit rather than an |
| -// absence: a resource policy naming the session could otherwise grant |
| -// beyond it, and an explicit Deny wins over any Allow. Every S3 action |
| -// outside the prefix is denied, and everywhere, by family, every object |
| -// action that is not a write (writeObjectDenies, which says what is left). Bucket-level actions name a |
| -// bucket ARN, which is outside the prefix. The last Deny refuses any upload |
| -// that carries tags at all. The store's writer already denies the |
| -// platform's tag keys, and AWS asks for s3:PutObjectTagging, which nothing |
| -// here allows, for any x-amz-tagging; this states the same property where |
| -// the credential is defined, for a policy engine that reads the header |
| -// differently (AGENTS.md: absence is not the property). |
| +// - Allow writeActions on the scope's objects; |
| +// - deny, which each backend writes for its engine; |
| +// - Deny every S3 action outside the scope's objects, the writes |
| +// included: bucket-level actions name a bucket ARN, which is outside; |
| +// - Deny any upload that carries tags at all. The store's writer already |
| +// denies the platform's tag keys, and AWS asks for s3:PutObjectTagging, |
| +// which nothing here allows, for any x-amz-tagging; this states the |
| +// same property where the credential is defined, for an engine that |
| +// reads the header differently (AGENTS.md: absence is not the |
| +// property). |
| // |
| -// No NotAction: MinIO's STS refuses a session policy with one (it cannot |
| -// marshal the empty action set it leaves), which the MinIO contract found. |
| -func writeSessionPolicy(bucket, prefix string) string { |
| - res := "arn:aws:s3:::" + bucket + "/" + prefix + "*" |
| - return marshalSessionDocument( |
| - sessionStatement{Effect: "Allow", Action: writeActions, Resource: res}, |
| - sessionStatement{Effect: "Deny", Action: []string{"s3:*"}, NotResource: res}, |
| - sessionStatement{Effect: "Deny", Action: writeObjectDenies, Resource: "arn:aws:s3:::*"}, |
| - sessionStatement{Effect: "Deny", Action: []string{"s3:PutObject"}, Resource: "arn:aws:s3:::*", Condition: map[string]map[string]any{ |
| +// The Denies make the scope explicit rather than an absence: a resource |
| +// policy naming the session could otherwise grant beyond it, and an |
| +// explicit Deny wins over any Allow (astra 1.6). |
| +func (w WriteScope) scopeStatements(deny sessionStatement) []sessionStatement { |
| + res := w.objects() |
| + return []sessionStatement{ |
| + {Effect: "Allow", Action: writeActions, Resource: res}, |
| + deny, |
| + {Effect: "Deny", Action: []string{"s3:*"}, NotResource: res}, |
| + {Effect: "Deny", Action: []string{"s3:PutObject"}, Resource: "arn:aws:s3:::*", Condition: map[string]map[string]any{ |
| "Null": {"s3:RequestObjectTagKeys": "false"}, |
| }}, |
| - ) |
| + } |
| } |
| // WriterName is the writer user of the store whose user is storeUser: |
| @@ -503,7 +514,7 @@ func claimRawMintWriteCredentialIn(ctx context.Context, s release.Store, p Provi |
| if err := claimRawConvergeWriterIn(ctx, s, p, acct, app, env, bucket); err != nil { |
| return nil, err |
| } |
| - sess, err := p.MintSession(ctx, WriterName(user), writeSessionPolicy(bucket, prefix), ttl) |
| + sess, err := p.MintSession(ctx, WriterName(user), WriteScope{Bucket: bucket, Prefix: prefix}, ttl) |
| if err != nil { |
| return nil, err |
| } |
diff --git a/internal/objstore/writecred_actions_test.go b/internal/objstore/writecred_actions_test.go| new file mode 100644 |
| index 000000000..ed5c08052 |
| --- /dev/null |
| +++ b/internal/objstore/writecred_actions_test.go |
| @@ -0,0 +1,205 @@ |
| +package objstore |
| + |
| +import ( |
| + "context" |
| + "os" |
| + "os/exec" |
| + "path/filepath" |
| + "reflect" |
| + "regexp" |
| + "sort" |
| + "strings" |
| + "testing" |
| + |
| + awss3 "github.com/aws/aws-sdk-go-v2/service/s3" |
| +) |
| + |
| +// sdkS3Actions is every S3 action the pinned AWS SDK knows (go.mod's |
| +// github.com/aws/aws-sdk-go-v2/service/s3), from two sources, so neither a |
| +// hand-picked list nor the gap between an operation's name and its IAM |
| +// action can hide one: |
| +// |
| +// - s3:<Operation> for every operation method of the SDK's S3 client; |
| +// - every s3:<Name> the SDK's operation docs name (api_op_*.go), which |
| +// is where an IAM action whose name is not an operation's appears |
| +// (s3:ListBucket for ListObjectsV2, s3:GetObjectVersion, |
| +// s3:BypassGovernanceRetention, and so on). |
| +// |
| +// Some operation names are not IAM actions (CreateMultipartUpload and |
| +// UploadPart are authorised as s3:PutObject, HeadObject as s3:GetObject). |
| +// They are judged as names like any other: the property is that every name |
| +// but the three writes is denied, so an extra name can only make the test |
| +// stricter. |
| +func sdkS3Actions(t *testing.T) []string { |
| + t.Helper() |
| + set := map[string]bool{} |
| + ctxType := reflect.TypeOf((*context.Context)(nil)).Elem() |
| + client := reflect.TypeOf(&awss3.Client{}) |
| + ops := 0 |
| + for i := 0; i < client.NumMethod(); i++ { |
| + m := client.Method(i) |
| + // func(*Client, context.Context, *XInput, ...func(*Options)) (*XOutput, error) |
| + if m.Type.NumIn() == 4 && m.Type.In(1) == ctxType && m.Type.IsVariadic() && m.Type.NumOut() == 2 { |
| + set["s3:"+m.Name] = true |
| + ops++ |
| + } |
| + } |
| + out, err := exec.Command("go", "list", "-m", "-f", "{{.Dir}} {{.Version}}", "github.com/aws/aws-sdk-go-v2/service/s3").Output() |
| + if err != nil { |
| + t.Fatalf("locate the pinned S3 SDK: %v", err) |
| + } |
| + dir, version, _ := strings.Cut(strings.TrimSpace(string(out)), " ") |
| + files, err := filepath.Glob(filepath.Join(dir, "api_op_*.go")) |
| + if err != nil || len(files) < 50 { |
| + t.Fatalf("the S3 SDK at %s has %d operation files: %v", dir, len(files), err) |
| + } |
| + named := regexp.MustCompile(`\bs3:[A-Z][A-Za-z0-9]*\b`) |
| + for _, f := range files { |
| + b, err := os.ReadFile(f) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, a := range named.FindAll(b, -1) { |
| + set[string(a)] = true |
| + } |
| + } |
| + var all []string |
| + for a := range set { |
| + all = append(all, a) |
| + } |
| + sort.Strings(all) |
| + // The SDK is the one go.mod pins; these are what round 3 found, and |
| + // must be in any list worth the name. |
| + for _, must := range []string{"s3:PutObject", "s3:GetObject", "s3:ListBucket", "s3:PutObjectAnnotation", "s3:ListObjectAnnotations", "s3:UpdateObjectEncryption"} { |
| + if !set[must] { |
| + t.Fatalf("the S3 SDK %s does not name %s; the action list is not the SDK's", version, must) |
| + } |
| + } |
| + if ops < 100 { |
| + t.Fatalf("the S3 SDK %s client has %d operations; reflection is not seeing them", version, ops) |
| + } |
| + t.Logf("S3 SDK %s: %d operations, %d action names", version, ops, len(all)) |
| + return all |
| +} |
| + |
| +// AWS's rendering against every S3 action the pinned SDK knows, and a few |
| +// it does not yet: under a resource policy that grants the session |
| +// everything directly (the case a named Deny does not survive, Astra code |
| +// round 3), and under the identity layers alone, the only things a write |
| +// credential can do are the three writes on objects under its prefix, |
| +// with no tags. NotAction is what makes the future names fail closed. |
| +func TestAWSWriteScopeAgainstEverySDKAction(t *testing.T) { |
| + layers := sessionLayers(t, false, &WriteCredentials{}) |
| + direct := parseIAM(t, `{"Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]}`) |
| + issued := map[string][]string{"aws:TokenIssueTime": {"2026-11-25T10:00:00Z"}} |
| + tagged := map[string][]string{"aws:TokenIssueTime": {"2026-11-25T10:00:00Z"}, "s3:RequestObjectTagKeys": {"colour"}} |
| + writes := map[string]bool{} |
| + for _, a := range writeActions { |
| + writes[strings.ToLower(a)] = true |
| + } |
| + inPrefix := []string{obj(evalBucket, "recordings/a.mp4"), obj(evalBucket, "recordings/2026/11/a.mp4")} |
| + outside := []string{ |
| + obj(evalBucket, "private/a.mp4"), obj(evalBucket, "recordings-private/a.mp4"), obj(evalBucket, "recordings"), |
| + "arn:aws:s3:::" + evalBucket, obj("carlos-store-bab-other", "recordings/a.mp4"), "arn:aws:s3:::*", "*", |
| + } |
| + actions := append(sdkS3Actions(t), |
| + // Not in this SDK: an action S3 adds later must be denied too. |
| + "s3:PutObjectFutureThing", "s3:GetObjectFutureThing", "s3:ListObjectFutureThings", "s3:FutureAction", |
| + // Action names are case-insensitive. |
| + "S3:GETOBJECT", "s3:putobjectannotation", |
| + ) |
| + checked := 0 |
| + for _, a := range actions { |
| + for _, rp := range []*iamDoc{&direct, nil} { |
| + for _, res := range inPrefix { |
| + want := writes[strings.ToLower(a)] |
| + if got := evalIAM(t, iamRequest{a, res, issued}, layers, rp); got != want { |
| + t.Errorf("%s on %s (direct grant %v): allowed %v, want %v", a, res, rp != nil, got, want) |
| + } |
| + if a == "s3:PutObject" && evalIAM(t, iamRequest{a, res, tagged}, layers, rp) { |
| + t.Errorf("a tagged upload on %s was allowed (direct grant %v)", res, rp != nil) |
| + } |
| + checked++ |
| + } |
| + for _, res := range outside { |
| + if evalIAM(t, iamRequest{a, res, issued}, layers, rp) { |
| + t.Errorf("%s on %s (direct grant %v) was allowed", a, res, rp != nil) |
| + } |
| + checked++ |
| + } |
| + } |
| + } |
| + t.Logf("%d requests judged", checked) |
| +} |
| + |
| +// The evaluator's NotAction is IAM's: a statement with NotAction applies to |
| +// every action that matches none of its patterns, case-insensitively and |
| +// with wildcards, including actions of other services and names no list has |
| +// seen; and it never applies to a listed one. The test above rests on it. |
| +func TestEvaluatorNotActionSemantics(t *testing.T) { |
| + deny := parseIAM(t, `{"Statement":[{"Effect":"Deny","NotAction":["s3:PutObject","s3:Abort*"],"Resource":"*"}]}`) |
| + for action, applies := range map[string]bool{ |
| + "s3:PutObject": false, |
| + "S3:PUTOBJECT": false, |
| + "s3:AbortMultipartUpload": false, |
| + "s3:abortanything": false, |
| + "s3:PutObjectAcl": true, |
| + "s3:PutObjectAnnotation": true, |
| + "s3:GetObject": true, |
| + "s3:SomeActionNotYetNamed": true, |
| + "iam:CreateAccessKey": true, |
| + "sts:GetFederationToken": true, |
| + "kms:Decrypt": true, |
| + } { |
| + _, denied := deny.decide(t, iamRequest{action, obj(evalBucket, "recordings/a.mp4"), nil}) |
| + if denied != applies { |
| + t.Errorf("Deny NotAction [s3:PutObject s3:Abort*] on %s: applies %v, want %v", action, denied, applies) |
| + } |
| + } |
| + // NotAction with a resource applies only on that resource. |
| + scoped := parseIAM(t, `{"Statement":[{"Effect":"Deny","NotAction":"s3:PutObject","Resource":"arn:aws:s3:::b/*"}]}`) |
| + if _, d := scoped.decide(t, iamRequest{"s3:GetObject", "arn:aws:s3:::other/k", nil}); d { |
| + t.Error("a NotAction statement applied outside its Resource") |
| + } |
| + if _, d := scoped.decide(t, iamRequest{"s3:GetObject", "arn:aws:s3:::b/k", nil}); !d { |
| + t.Error("a NotAction statement did not apply inside its Resource") |
| + } |
| + // An Allow with NotAction grants everything it does not list. |
| + allow := parseIAM(t, `{"Statement":[{"Effect":"Allow","NotAction":"s3:DeleteObject","Resource":"*"}]}`) |
| + if a, _ := allow.decide(t, iamRequest{"s3:GetObject", "x", nil}); !a { |
| + t.Error("Allow NotAction did not grant an unlisted action") |
| + } |
| + if a, _ := allow.decide(t, iamRequest{"s3:DeleteObject", "x", nil}); a { |
| + t.Error("Allow NotAction granted a listed action") |
| + } |
| +} |
| + |
| +// MinIO's rendering, judged by the same evaluator under the identity layers |
| +// it is meant for: the writes under the prefix, and none of the requests |
| +// TestWriteCredentialScopeEvaluation refuses on AWS that MinIO has an action |
| +// for. Under a direct grant it would leave AWS-only actions open, which is |
| +// why AWS never gets it (minioObjectDenies); the MinIO contract runs it on |
| +// a real MinIO, which has no such actions. |
| +func TestMinioWriteScopeEvaluation(t *testing.T) { |
| + layers := layersWith(t, false, &WriteCredentials{}, minioWriteSessionPolicy(evalScope)) |
| + issued := map[string][]string{"aws:TokenIssueTime": {"2026-11-25T10:00:00Z"}} |
| + for _, a := range writeActions { |
| + if !evalIAM(t, iamRequest{a, obj(evalBucket, "recordings/a.mp4"), issued}, layers, nil) { |
| + t.Errorf("MinIO rendering refused %s under the prefix", a) |
| + } |
| + } |
| + for _, r := range []iamRequest{ |
| + {"s3:GetObject", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + {"s3:ListBucket", "arn:aws:s3:::" + evalBucket, issued}, |
| + {"s3:DeleteObject", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + {"s3:PutObjectTagging", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + {"s3:PutObjectRetention", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + {"s3:PutObject", obj(evalBucket, "other/a.mp4"), issued}, |
| + {"s3:PutObject", obj("carlos-store-bab-other", "recordings/a.mp4"), issued}, |
| + {"s3:PutObject", obj(evalBucket, "recordings/a.mp4"), map[string][]string{"s3:RequestObjectTagKeys": {"colour"}}}, |
| + } { |
| + if evalIAM(t, r, layers, nil) { |
| + t.Errorf("MinIO rendering allowed %s on %s (%v)", r.action, r.resource, r.keys) |
| + } |
| + } |
| +} |
diff --git a/internal/objstore/writecred_policy_test.go b/internal/objstore/writecred_policy_test.go| index 001d5bcff..6001a0702 100644 |
| --- a/internal/objstore/writecred_policy_test.go |
| +++ b/internal/objstore/writecred_policy_test.go |
| @@ -193,13 +193,19 @@ const ( |
| evalPrefix = "recordings/" |
| ) |
| -// sessionLayers is what a write credential's request is judged against: |
| -// the boundary, the writer's policy, the session policy. |
| +var evalScope = WriteScope{Bucket: evalBucket, Prefix: evalPrefix} |
| + |
| +// sessionLayers is what a write credential's request is judged against on |
| +// AWS: the boundary, the writer's policy, AWS's rendering of the scope. |
| func sessionLayers(t *testing.T, denyWrites bool, wc *WriteCredentials) []iamDoc { |
| + return layersWith(t, denyWrites, wc, awsWriteSessionPolicy(evalScope)) |
| +} |
| + |
| +func layersWith(t *testing.T, denyWrites bool, wc *WriteCredentials, session string) []iamDoc { |
| return []iamDoc{ |
| parseIAM(t, testStoreBoundary()), |
| parseIAM(t, writerPolicyJSON("arn:aws:s3:::"+evalBucket, denyWrites, wc)), |
| - parseIAM(t, writeSessionPolicy(evalBucket, evalPrefix)), |
| + parseIAM(t, session), |
| } |
| } |
| @@ -269,23 +275,21 @@ func TestWriteCredentialScopeEvaluation(t *testing.T) { |
| } |
| // A resource policy naming the session and granting everything cannot |
| - // widen it: the session policy's explicit Denies win (astra 1.6), for |
| - // every action but the three writeObjectDenies documents (no family |
| - // both AWS and MinIO accept covers them), which stay denied by absence. |
| + // widen it: the session policy's explicit Denies win (astra 1.6). That |
| + // includes the object actions phase 1's action families left open |
| + // (Astra code round 3) and the three it left to absence: AWS's |
| + // rendering denies everything but the writes by NotAction. |
| + // TestAWSWriteScopeAgainstEverySDKAction does the same for every |
| + // action the pinned SDK names. |
| rp := parseIAM(t, `{"Statement":[{"Effect":"Allow","Action":"s3:*","Resource":["arn:aws:s3:::`+evalBucket+`","arn:aws:s3:::`+evalBucket+`/*"]}]}`) |
| - absenceOnly := map[string]bool{"s3:PutObjectAcl": true, "s3:ObjectOwnerOverrideToBucketOwner": true, "s3:InitiateReplication": true} |
| for _, r := range append(denied, |
| iamRequest{"s3:ObjectOwnerOverrideToBucketOwner", obj(evalBucket, "recordings/a.mp4"), issued}, |
| iamRequest{"s3:InitiateReplication", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + iamRequest{"s3:PutObjectAnnotation", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + iamRequest{"s3:ListObjectAnnotations", obj(evalBucket, "recordings/a.mp4"), issued}, |
| + iamRequest{"s3:UpdateObjectEncryption", obj(evalBucket, "recordings/a.mp4"), issued}, |
| ) { |
| - widened := evalIAM(t, r, layers, &rp) |
| - if inPrefix := strings.HasPrefix(r.resource, obj(evalBucket, evalPrefix)); absenceOnly[r.action] && inPrefix { |
| - if !widened { |
| - t.Errorf("%s is now denied by name; drop it from the absence-only list and the writeObjectDenies comment", r.action) |
| - } |
| - continue |
| - } |
| - if widened { |
| + if evalIAM(t, r, layers, &rp) { |
| t.Errorf("a resource policy widened the write credential to %s on %s", r.action, r.resource) |
| } |
| if evalIAM(t, r, layers, nil) { |
diff --git a/internal/objstore/writecred_test.go b/internal/objstore/writecred_test.go| index 15a3a8125..63b044f6c 100644 |
| --- a/internal/objstore/writecred_test.go |
| +++ b/internal/objstore/writecred_test.go |
| @@ -69,36 +69,41 @@ func TestValidWriteTTL(t *testing.T) { |
| } |
| } |
| -// TestWriteSessionPolicyShape pins the session policy byte for byte. It is |
| -// the scope every write credential gets, and the MinIO contract runs this |
| -// same document against a real policy engine. |
| -func TestWriteSessionPolicyShape(t *testing.T) { |
| - got := writeSessionPolicy("carlos-store-bab-titogo", "recordings/") |
| +// The two renderings of one scope, byte for byte. AWS's denies every |
| +// action but the three writes with NotAction (Paul's option 1, 2026-11-25); |
| +// MinIO's, which its STS takes, names the object action families instead |
| +// and never says NotAction. Everything else is the same statements. |
| +func TestWriteSessionPolicyShapes(t *testing.T) { |
| + scope := WriteScope{Bucket: "carlos-store-bab-titogo", Prefix: "recordings/"} |
| r := "arn:aws:s3:::carlos-store-bab-titogo/recordings/*" |
| w := `["s3:PutObject","s3:AbortMultipartUpload","s3:ListMultipartUploadParts"]` |
| - denies, _ := json.Marshal(writeObjectDenies) |
| - want := `{"Version":"2012-10-17","Statement":[` + |
| - `{"Effect":"Allow","Action":` + w + `,"Resource":"` + r + `"},` + |
| - `{"Effect":"Deny","Action":["s3:*"],"NotResource":"` + r + `"},` + |
| - `{"Effect":"Deny","Action":` + string(denies) + `,"Resource":"arn:aws:s3:::*"},` + |
| - `{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::*","Condition":{"Null":{"s3:RequestObjectTagKeys":"false"}}}]}` |
| - if strings.Contains(got, "NotAction") { |
| - t.Fatal("the session policy uses NotAction, which MinIO's STS refuses") |
| + allow := `{"Effect":"Allow","Action":` + w + `,"Resource":"` + r + `"},` |
| + outside := `{"Effect":"Deny","Action":["s3:*"],"NotResource":"` + r + `"},` |
| + tagged := `{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::*","Condition":{"Null":{"s3:RequestObjectTagKeys":"false"}}}]}` |
| + head := `{"Version":"2012-10-17","Statement":[` |
| + |
| + aws := awsWriteSessionPolicy(scope) |
| + if want := head + allow + `{"Effect":"Deny","NotAction":` + w + `,"Resource":"*"},` + outside + tagged; aws != want { |
| + t.Fatalf("awsWriteSessionPolicy =\n%s\nwant\n%s", aws, want) |
| } |
| - if got != want { |
| - t.Fatalf("writeSessionPolicy =\n%s\nwant\n%s", got, want) |
| + minio := minioWriteSessionPolicy(scope) |
| + denies, _ := json.Marshal(minioObjectDenies) |
| + if want := head + allow + `{"Effect":"Deny","Action":` + string(denies) + `,"Resource":"arn:aws:s3:::*"},` + outside + tagged; minio != want { |
| + t.Fatalf("minioWriteSessionPolicy =\n%s\nwant\n%s", minio, want) |
| } |
| - if len(got) > 2048 { |
| - t.Fatalf("session policy is %d bytes, over STS's 2,048", len(got)) |
| + if strings.Contains(minio, "NotAction") { |
| + t.Fatal("MinIO's session policy uses NotAction, which MinIO's STS refuses") |
| } |
| } |
| -// The longest prefix and bucket still fit STS's 2,048-character limit. |
| +// The longest prefix and bucket still fit STS's 2,048-character limit, in |
| +// both renderings. |
| func TestWriteSessionPolicyFitsSTSLimit(t *testing.T) { |
| - bucket := strings.Repeat("b", 63) |
| - prefix := strings.Repeat("a", 199) + "/" |
| - if n := len(writeSessionPolicy(bucket, prefix)); n > 2048 { |
| - t.Fatalf("longest session policy is %d bytes, over STS's 2,048", n) |
| + scope := WriteScope{Bucket: strings.Repeat("b", 63), Prefix: strings.Repeat("a", 199) + "/"} |
| + for name, doc := range map[string]string{"aws": awsWriteSessionPolicy(scope), "minio": minioWriteSessionPolicy(scope)} { |
| + if n := len(doc); n > 2048 { |
| + t.Fatalf("longest %s session policy is %d bytes, over STS's 2,048", name, n) |
| + } |
| } |
| } |
| @@ -194,7 +199,7 @@ func TestMintWriteCredential(t *testing.T) { |
| t.Fatalf("%d sessions minted, want 1", len(p.Sessions)) |
| } |
| ms := p.Sessions[0] |
| - if ms.User != WriterName(storeUser) || ms.Policy != writeSessionPolicy(rec.Provisioned.Bucket, "recordings/") || ms.TTL != 4*time.Hour { |
| + if ms.User != WriterName(storeUser) || ms.Scope != (WriteScope{Bucket: rec.Provisioned.Bucket, Prefix: "recordings/"}) || ms.TTL != 4*time.Hour { |
| t.Fatalf("session = %+v", ms) |
| } |
| // The writer exists with its policy and no key; the app's own user and |