carlos / platform Public

tests: store multipart cleanup in policy pins; media pass in jobPassFuncs

Media conversion (spec 5.6) gave every store user s3:AbortMultipartUpload
and s3:ListMultipartUploadParts on its own bucket's objects. Two tests
pinned the old store policy:

- awsmanaged TestManagedFleetRenderedPolicyIsolation banned every
  Multipart action in the app store policy. It now allows exactly those
  two, and only on the store bucket's objects (<bucket>/*); bucket-wide
  s3:ListBucketMultipartUploads, Version actions and wildcards stay
  banned, and every resource must still be the store bucket.
- console TestManaged2B1Disabled/app_store_policy_unchanged pins the
  three policy variants byte for byte; the pins gain the two actions.

TestPassFailureLogsAlsoFailTheJob needs a jobPassFuncs entry for every
claim worker; StartMediaPass (Task 8) had none. Its run body, mediaPass,
returns the mediajobs pass error, which the run records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e446cfce95a91a31a2f2f9c560413470ebec042b parent 6314666
3 files changed, +18 −4
  • internal/awsmanaged/infra_policy_test.go +11 −0
  • internal/console/jobs_test.go +1 −0
  • internal/console/managed_e2e_test.go +6 −4

CI passed — run details

diff --git a/internal/awsmanaged/infra_policy_test.go b/internal/awsmanaged/infra_policy_test.go
index e3dde878c..8609e7c47 100644
--- a/internal/awsmanaged/infra_policy_test.go
+++ b/internal/awsmanaged/infra_policy_test.go
@@ -482,6 +482,7 @@ func TestManagedFleetRenderedPolicyIsolation(t *testing.T) {
t.Run("app store inline policy carries no fleet power", func(t *testing.T) {
p := objstore.NewMemProvisioner("eu-west-1")
const appBucket = "arn:aws:s3:::carlos-store-test-0123"
+ storeMultipart := map[string]bool{"s3:AbortMultipartUpload": true, "s3:ListMultipartUploadParts": true}
for i, v := range []struct {
deny *objstore.DenyTag
denyWrites bool
@@ -510,6 +511,16 @@ func TestManagedFleetRenderedPolicyIsolation(t *testing.T) {
continue
}
for _, act := range st.Action {
+ // The store's own multipart cleanup (media conversion spec
+ // §5.6) is the one multipart power an app holds: abandon an
+ // upload and list its parts, on its own bucket's objects
+ // only. Listing every upload in a bucket stays a fleet power.
+ if storeMultipart[act] {
+ if !slices.Equal(st.Resource, infraValues{appBucket + "/*"}) {
+ t.Errorf("app policy allows %s on %v, want only %s/*", act, st.Resource, appBucket)
+ }
+ continue
+ }
if strings.Contains(act, "Version") || strings.Contains(act, "Multipart") || strings.ContainsAny(act, "*?") {
t.Errorf("app policy allows %s", act)
}
diff --git a/internal/console/jobs_test.go b/internal/console/jobs_test.go
index b2106f8b7..0af3a4c18 100644
--- a/internal/console/jobs_test.go
+++ b/internal/console/jobs_test.go
@@ -73,6 +73,7 @@ var jobPassFuncs = map[string][]string{
"FleetRelabel": {"fleetRelabelPass", "relabelFleet", "writeRelabels"},
"ManagedFleets": {"managedFleetsPass", "stepManagedBox", "cleanupManagedBox"},
"LinkSync": {"linkSyncPass", "syncLinkChannel"},
+ "StartMediaPass": {"mediaPass"},
}
// TestJobRegistryRecordsRuns pins the registry's bookkeeping (not
diff --git a/internal/console/managed_e2e_test.go b/internal/console/managed_e2e_test.go
index e0a8793a9..a0a5cb40a 100644
--- a/internal/console/managed_e2e_test.go
+++ b/internal/console/managed_e2e_test.go
@@ -459,11 +459,13 @@ func managedProductionSources(t *testing.T, visit func(path string, src []byte))
// managedAppStorePolicies pins object storage's per-user inline policy, the
// one part of the app-store effective policy built in Go. The slice changes
// no objstore source; the region-host tofu tests pin the host and boundary
-// halves byte for byte.
+// halves byte for byte. Media conversion (spec §5.6) added
+// s3:AbortMultipartUpload and s3:ListMultipartUploadParts to the object
+// Allow, on the store's own objects; nothing managed fleets build moved.
var managedAppStorePolicies = []string{
- `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}}]}`,
- `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}},{"Effect":"Deny","Action":["s3:GetObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"StringEquals":{"s3:ExistingObjectTag/carlos-scan":"infected"}}}]}`,
- `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"}]}`,
+ `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging","s3:AbortMultipartUpload","s3:ListMultipartUploadParts"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}}]}`,
+ `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging","s3:AbortMultipartUpload","s3:ListMultipartUploadParts"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}},{"Effect":"Deny","Action":["s3:GetObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"StringEquals":{"s3:ExistingObjectTag/carlos-scan":"infected"}}}]}`,
+ `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":"arn:aws:s3:::carlos-store-shop-0123"},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject","s3:GetObjectTagging","s3:AbortMultipartUpload","s3:ListMultipartUploadParts"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObjectTagging","s3:DeleteObjectTagging","s3:PutObjectVersionTagging","s3:DeleteObjectVersionTagging"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*","Condition":{"ForAnyValue:StringEquals":{"s3:RequestObjectTagKeys":["carlos-scan","carlos-scan-version","carlos-scan-at"]}}},{"Effect":"Deny","Action":["s3:PutObject"],"Resource":"arn:aws:s3:::carlos-store-shop-0123/*"}]}`,
}
// TestManaged2B1Disabled: 2b-1 ships off. Production wires no provider,