Commit 13587b4
fix(template): scope Lambda role S3+KMS perms to the state object
Tighten the Lambda execution role in template.yaml so it can only touch
the single state object via the single intended path. No behavior change
for normal operation; the role is now strictly scoped.
S3:
- s3:GetObject*/PutObject* scoped to the exact <bucket>/<BucketKey> ARN
instead of <bucket>/*.
- s3:ListBucket stays on the bucket ARN (required by S3) but is gated by
an s3:prefix condition matching BucketKey.
KMS (both KMSGetDataPolicy and KMSDecryptPolicy):
- kms:ViaService = s3.<region>.amazonaws.com — the CMK can only be used
through S3-forwarded requests, not via direct kms:Decrypt/Encrypt.
- kms:EncryptionContext:aws:s3:arn pinned to the state object ARN — S3
always populates this context for SSE-KMS objects, so legitimate
reads/writes continue to work; any other object path is rejected.
Refs: #521
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bf36ac5 commit 13587b4
2 files changed
Lines changed: 39 additions & 3 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 | + | |
7 | 27 | | |
8 | 28 | | |
9 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
353 | 358 | | |
354 | 359 | | |
355 | | - | |
356 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
357 | 365 | | |
358 | 366 | | |
359 | 367 | | |
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
363 | 375 | | |
364 | 376 | | |
365 | 377 | | |
| |||
368 | 380 | | |
369 | 381 | | |
370 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
371 | 387 | | |
372 | 388 | | |
373 | 389 | | |
| |||
0 commit comments