grada-run 0.49.3 → 0.49.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/terraform/oidc.tf +34 -27
package/package.json
CHANGED
|
@@ -43,17 +43,21 @@ locals {
|
|
|
43
43
|
preview_boundary_arn = terraform.workspace == "default" ? aws_iam_policy.preview_boundary[0].arn : data.aws_iam_policy.preview_boundary[0].arn
|
|
44
44
|
# Shared twin resource lists: every Deny*/BoundaryDeny* pair consumes
|
|
45
45
|
# one list, so a one-sided resource edit is impossible. New pairs add
|
|
46
|
-
# their list here and reference it from both sides.
|
|
46
|
+
# their list here and reference it from both sides. Wildcards below
|
|
47
|
+
# anchor on prod_prefix (never on the bare project): preview names
|
|
48
|
+
# carry -pr-<n>- where prod carries the hex suffix, so a
|
|
49
|
+
# ${prod_prefix}-* pattern matches prod only. Anchoring also keeps
|
|
50
|
+
# the boundary under the 6144-char managed-policy quota that broke
|
|
51
|
+
# tier1 E2E at a 24-char prefix — prefer one anchored wildcard over
|
|
52
|
+
# several exact ARNs when adding entries.
|
|
47
53
|
guardrail_compute_abuse_resources = ["*"]
|
|
48
54
|
guardrail_snapshot_sharing_resources = ["*"]
|
|
49
55
|
guardrail_state_destruction_resources = [
|
|
50
|
-
"arn:aws:s3:::{{STATE_BUCKET}}",
|
|
51
|
-
"arn:aws:s3:::{{STATE_BUCKET}}/*",
|
|
56
|
+
"arn:aws:s3:::{{STATE_BUCKET}}*",
|
|
52
57
|
]
|
|
53
58
|
guardrail_ecs_shutdown_resources = [
|
|
54
59
|
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:cluster/${local.prod_prefix}-cluster",
|
|
55
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster
|
|
56
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster/${local.prod_prefix}-worker-service",
|
|
60
|
+
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster/*",
|
|
57
61
|
]
|
|
58
62
|
guardrail_image_deletion_resources = [
|
|
59
63
|
"arn:aws:ecr:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:repository/${local.prod_prefix}-repo",
|
|
@@ -62,12 +66,10 @@ locals {
|
|
|
62
66
|
"arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:${local.prod_prefix}-fn",
|
|
63
67
|
]
|
|
64
68
|
guardrail_queue_destruction_resources = [
|
|
65
|
-
"arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${local.prod_prefix}
|
|
66
|
-
"arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${local.prod_prefix}-dlq",
|
|
69
|
+
"arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${local.prod_prefix}-*",
|
|
67
70
|
]
|
|
68
71
|
guardrail_database_destruction_resources = [
|
|
69
|
-
"arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:db:${local.prod_prefix}-db",
|
|
70
|
-
"arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:db:${local.prod_prefix}-db-instance-1",
|
|
72
|
+
"arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:db:${local.prod_prefix}-db*",
|
|
71
73
|
]
|
|
72
74
|
guardrail_aurora_destruction_resources = [
|
|
73
75
|
"arn:aws:rds:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:cluster:${local.prod_prefix}-db-cluster",
|
|
@@ -92,24 +94,21 @@ locals {
|
|
|
92
94
|
]
|
|
93
95
|
guardrail_task_execution_resources = [
|
|
94
96
|
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:cluster/${local.prod_prefix}-cluster",
|
|
95
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster
|
|
96
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster/${local.prod_prefix}-worker-service",
|
|
97
|
+
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:service/${local.prod_prefix}-cluster/*",
|
|
97
98
|
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task/${local.prod_prefix}-cluster/*",
|
|
98
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}
|
|
99
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}-worker-task:*",
|
|
99
|
+
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}-*:*",
|
|
100
100
|
]
|
|
101
101
|
guardrail_task_definition_resources = [
|
|
102
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}
|
|
103
|
-
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}-worker-task:*",
|
|
102
|
+
"arn:aws:ecs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:task-definition/${local.prod_prefix}-*:*",
|
|
104
103
|
]
|
|
105
104
|
# String-built (not HCL refs): static trees define no IAM roles, so
|
|
106
105
|
# refs would dangle and fail validate. ECS and Lambda use identical
|
|
107
106
|
# physical role names, so one pattern covers both and matches
|
|
108
|
-
# nothing on static.
|
|
107
|
+
# nothing on static. The wildcard also covers the CI roles (same
|
|
108
|
+
# prefix, -github-actions-*-role): capped callers never legitimately
|
|
109
|
+
# pass or mutate those, so the overlap only tightens the boundary.
|
|
109
110
|
guardrail_app_role_resources = [
|
|
110
|
-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}
|
|
111
|
-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}-execution-role",
|
|
112
|
-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}-cron-scheduler-role",
|
|
111
|
+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.prod_prefix}-*-role",
|
|
113
112
|
]
|
|
114
113
|
}
|
|
115
114
|
|
|
@@ -231,8 +230,10 @@ resource "aws_iam_role_policy" "deploy_boundary" {
|
|
|
231
230
|
|
|
232
231
|
# Preview guardrails: PR-triggered runs (preview/teardown/plan) keep full
|
|
233
232
|
# build power but cannot destroy production data, mint compute, or open
|
|
234
|
-
# IAM backdoors. Every Resource below names
|
|
235
|
-
#
|
|
233
|
+
# IAM backdoors. Every Resource below names production only — exact ARNs
|
|
234
|
+
# or prod_prefix-anchored wildcards (preview names carry -pr-<n>- where
|
|
235
|
+
# prod carries the hex suffix, so anchored patterns never match preview
|
|
236
|
+
# resources and pr-suffixed workflows keep working).
|
|
236
237
|
resource "aws_iam_role_policy" "preview_guardrails" {
|
|
237
238
|
count = terraform.workspace == "default" ? 1 : 0
|
|
238
239
|
name = "${local.prod_prefix}-preview-guardrails"
|
|
@@ -386,8 +387,8 @@ resource "aws_iam_role_policy" "preview_guardrails" {
|
|
|
386
387
|
]
|
|
387
388
|
},
|
|
388
389
|
{
|
|
389
|
-
# BUG-215: close by target — deny the execution APIs on
|
|
390
|
-
#
|
|
390
|
+
# BUG-215: close by target — deny the execution APIs on prod
|
|
391
|
+
# ARNs while pr-* stays allowed. No describes: plan.yml
|
|
391
392
|
# refreshes prod state with preview credentials, so describing
|
|
392
393
|
# prod is legitimate traffic.
|
|
393
394
|
Sid = "DenyProdTaskExecution"
|
|
@@ -449,10 +450,16 @@ resource "aws_iam_policy" "preview_boundary" {
|
|
|
449
450
|
# BUG-214: capped roles must pass their task roles to ECS (the
|
|
450
451
|
# scheduler role passes at invocation time), so PassRole is
|
|
451
452
|
# carved out here and re-gated on service + target below.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
# Explicit Action list on purpose: a Deny with NotAction would
|
|
454
|
+
# veto every AWS service, not just IAM (tier2 E2E proved it on
|
|
455
|
+
# secretsmanager:GetSecretValue, SES, and Bedrock). IAM reads
|
|
456
|
+
# and cosmetic writes (UpdateRole, tagging) stay allowed: they
|
|
457
|
+
# cannot escalate a backdoor role, and a missing entry must
|
|
458
|
+
# weaken security instead of breaking prod tasks.
|
|
459
|
+
Sid = "BoundaryDenyIAM"
|
|
460
|
+
Effect = "Deny"
|
|
461
|
+
Action = ["iam:CreateRole", "iam:DeleteRole", "iam:UpdateAssumeRolePolicy", "iam:PutRolePolicy", "iam:DeleteRolePolicy", "iam:AttachRolePolicy", "iam:DetachRolePolicy", "iam:PutRolePermissionsBoundary", "iam:DeleteRolePermissionsBoundary", "iam:CreatePolicy", "iam:DeletePolicy", "iam:CreatePolicyVersion", "iam:DeletePolicyVersion", "iam:CreateUser", "iam:DeleteUser", "iam:CreateAccessKey", "iam:DeleteAccessKey"]
|
|
462
|
+
Resource = "*"
|
|
456
463
|
},
|
|
457
464
|
{
|
|
458
465
|
Sid = "BoundaryDenyAuditBilling"
|