Commit 6003c60
chore(template): drop dead IAM grants and standardize on AWS::Partition
Housekeeping pass on template.yaml after the #533 / fix-permissions
work surfaced several never-reached or never-matched grants. No
runtime behavior change.
Lambda role (CustomLambdaPolicy):
* Drop S3ListBucketPolicy. internal/repository/s3.go only issues
GetObject and PutObject on the single state object; ListBucket /
ListObjectsV2 / HeadObject are never called, so the statement and
its s3:prefix condition were unreachable.
* Drop KMSGetDataPolicy. kms:GenerateDataKeyPair is an asymmetric-key
API; the state CMK is the default symmetric key, so the action
could never be invoked against it. The needed symmetric action
(kms:GenerateDataKey) is already in the renamed KMSStateObjectPolicy.
* Drop secretsmanager:GetResourcePolicy. pkg/aws/secretsmanager.go
only calls GetSecretValue.
* Rename SSMGetParameterPolicy -> SecretsManagerGetSecretValuePolicy
(the old name was a copy-paste from a different service).
* Rename KMSDecryptPolicy -> KMSStateObjectPolicy to reflect that it
now covers all SSE-KMS operations on the state object (Decrypt,
Encrypt, GenerateDataKey).
KMS key policy:
* Drop AllowAWSLambdaToRetrieveKMSKey. Its principal was the lambda
service (Service: lambda.amazonaws.com), but at runtime KMS sees
the function's assumed-role ARN — not the Lambda service — when S3
forwards the kms:* calls on the role's behalf. The statement
granted nothing at runtime; the real grant is AllowIAMThisAccount
combined with the role's identity-based policy. Removing the dead
statement makes the grant model unambiguous.
Partition portability:
* Replace four hardcoded "arn:aws:..." ARNs with "arn:${AWS::Partition}:...":
- KMSKey AllowIAMThisAccount principal
- Bucket BucketEncryption.KMSMasterKeyID
- BucketPolicy AllowAWSLambdaFunction principal
- (The rest of the template already used ${AWS::Partition}.)
docs/Whats-New.md updated with a new "Template housekeeping" entry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a11d144 commit 6003c60
2 files changed
Lines changed: 27 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
7 | 29 | | |
8 | 30 | | |
9 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
339 | 338 | | |
340 | 339 | | |
341 | 340 | | |
| |||
352 | 351 | | |
353 | 352 | | |
354 | 353 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 354 | + | |
376 | 355 | | |
377 | 356 | | |
378 | 357 | | |
| |||
420 | 399 | | |
421 | 400 | | |
422 | 401 | | |
423 | | - | |
| 402 | + | |
424 | 403 | | |
425 | 404 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | 405 | | |
443 | 406 | | |
444 | 407 | | |
| |||
461 | 424 | | |
462 | 425 | | |
463 | 426 | | |
464 | | - | |
| 427 | + | |
465 | 428 | | |
466 | 429 | | |
467 | 430 | | |
| |||
475 | 438 | | |
476 | 439 | | |
477 | 440 | | |
478 | | - | |
| 441 | + | |
479 | 442 | | |
480 | 443 | | |
481 | 444 | | |
| |||
0 commit comments