Skip to content

Commit 697f6c8

Browse files
authored
Merge pull request #1433 from spack/fix/notary-s3-overprivilege
Scope down the notary service account's S3 access
2 parents 4a42224 + a9ca418 commit 697f6c8

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

terraform/modules/spack_aws_k8s/iam_service_accounts.tf

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,38 @@ module "notary" {
219219
],
220220
"Resource" : "arn:aws:kms:us-east-1:588562868276:key/e811e4c5-ea63-4da3-87d4-664dc5395169"
221221
},
222-
# S3 Full Access
222+
# The signing job needs to list the spec manifests it is about to sign,
223+
# and (via `spack gpg publish --update-index`) every spec manifest in the
224+
# stack mirror in order to rebuild the buildcache index.
225+
{
226+
"Effect" : "Allow",
227+
"Action" : "s3:ListBucket",
228+
"Resource" : module.protected_binary_mirror.bucket_arn
229+
},
230+
# The signing job syncs unsigned `*.spec.manifest.json` files down from
231+
# the stack mirror, re-signs them with the reputational key, syncs them
232+
# back up, then publishes the public key and regenerates the key and
233+
# buildcache indices (each a blob write plus a manifest write). Reads
234+
# cover the spec manifests and the blobs they point at; writes cover
235+
# `v3/manifests/{spec,key,index}/`, `blobs/`, and `v3/layout.json`.
236+
#
237+
# Signing only ever runs in protected-branch pipelines, whose mirrors
238+
# live at s3://spack-binaries/<ref>/<stack> for ref `develop` or
239+
# `releases/v*` -- so release tag prefixes (`v0.23.1/`), develop
240+
# snapshots (`develop-YYYY-MM-DD/`) and everything else in the bucket
241+
# stay out of reach. AbortMultipartUpload is only needed so that a
242+
# failed multipart upload of a large index can clean up after itself.
223243
{
224244
"Effect" : "Allow",
225245
"Action" : [
226-
"s3:*",
227-
"s3-object-lambda:*"
246+
"s3:GetObject",
247+
"s3:PutObject",
248+
"s3:AbortMultipartUpload"
228249
],
229-
"Resource" : "*"
250+
"Resource" : [
251+
"${module.protected_binary_mirror.bucket_arn}/develop/*",
252+
"${module.protected_binary_mirror.bucket_arn}/releases/*"
253+
]
230254
}
231255
]
232256
})

0 commit comments

Comments
 (0)