Fix round 2 for the phase 7 policies (amends plan E1):
- Per-user EC2 names: triple-c-<env>--u-<user tag> for the cluster,
capacity provider, Auto Scaling group and launch template
(user_ec2_stem, validate_ec2_user_tag; `--` can't occur in environment
names or user tags, so the patterns are unambiguous); the instance
role/profile stay owner-key named (user_instance_role_name, <= 64).
- workspace-user-tasks.json: RunTask/StartTask on a triple-c-*--u-*
cluster is denied unless it is the caller's own
(${aws:PrincipalTag/triple-c-user}), and denied without the tag.
- Admin: capacity providers and groups narrowed to triple-c-*--u-*; the
boundary's agent cluster tag must match triple-c-*--u-*.
- Instance-type fail-open closed: ec2:InstanceType required (StringEquals,
volumes in their own statement); group create requires
autoscaling:InstanceTypes present.
- The compute file is split: environment-admin-scaling.json (groups,
instance profiles, service-linked roles) is the admin tier's fourth file.
- Evaluator learns ArnNotLike. README: triple-c-user setup, sizes,
still-open probes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
129 lines
2.8 KiB
JSON
129 lines
2.8 KiB
JSON
{
|
|
"Version": "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Sid": "RegisterOwnTaskDefinitions",
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"ecs:RegisterTaskDefinition"
|
|
],
|
|
"Resource": [
|
|
"arn:aws:ecs:*:*:task-definition/triple-c-*"
|
|
],
|
|
"Condition": {
|
|
"StringEquals": {
|
|
"aws:RequestTag/triple-c:owner": "${aws:userid}"
|
|
},
|
|
"ForAllValues:StringEquals": {
|
|
"aws:TagKeys": [
|
|
"triple-c:owner",
|
|
"triple-c:project",
|
|
"triple-c:environment"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Sid": "TagOwnTaskDefinitionsAtRegister",
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"ecs:TagResource"
|
|
],
|
|
"Resource": [
|
|
"arn:aws:ecs:*:*:task-definition/triple-c-*"
|
|
],
|
|
"Condition": {
|
|
"StringEquals": {
|
|
"ecs:CreateAction": "RegisterTaskDefinition",
|
|
"aws:RequestTag/triple-c:owner": "${aws:userid}"
|
|
},
|
|
"ForAllValues:StringEquals": {
|
|
"aws:TagKeys": [
|
|
"triple-c:owner",
|
|
"triple-c:project",
|
|
"triple-c:environment"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Sid": "ReadOwnSecrets",
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"secretsmanager:GetSecretValue"
|
|
],
|
|
"Resource": [
|
|
"arn:aws:secretsmanager:*:*:secret:triple-c/*"
|
|
],
|
|
"Condition": {
|
|
"StringEquals": {
|
|
"aws:ResourceTag/triple-c:owner": "${aws:userid}"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Sid": "ReadFargatePrices",
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"pricing:GetProducts"
|
|
],
|
|
"Resource": [
|
|
"*"
|
|
]
|
|
},
|
|
{
|
|
"Sid": "NeverReadEnvironmentSecrets",
|
|
"Effect": "Deny",
|
|
"Action": [
|
|
"secretsmanager:GetSecretValue"
|
|
],
|
|
"Resource": [
|
|
"arn:aws:secretsmanager:*:*:secret:triple-c/*"
|
|
],
|
|
"Condition": {
|
|
"Null": {
|
|
"aws:ResourceTag/triple-c:component": "false"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Sid": "RunOnlyOnOwnEc2Cluster",
|
|
"Effect": "Deny",
|
|
"Action": [
|
|
"ecs:RunTask",
|
|
"ecs:StartTask"
|
|
],
|
|
"Resource": [
|
|
"*"
|
|
],
|
|
"Condition": {
|
|
"ArnLike": {
|
|
"ecs:cluster": "arn:aws:ecs:*:*:cluster/triple-c-*--u-*"
|
|
},
|
|
"ArnNotLike": {
|
|
"ecs:cluster": "arn:aws:ecs:*:*:cluster/triple-c-*--u-${aws:PrincipalTag/triple-c-user}"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Sid": "NoEc2ClusterWithoutUserTag",
|
|
"Effect": "Deny",
|
|
"Action": [
|
|
"ecs:RunTask",
|
|
"ecs:StartTask"
|
|
],
|
|
"Resource": [
|
|
"*"
|
|
],
|
|
"Condition": {
|
|
"ArnLike": {
|
|
"ecs:cluster": "arn:aws:ecs:*:*:cluster/triple-c-*--u-*"
|
|
},
|
|
"Null": {
|
|
"aws:PrincipalTag/triple-c-user": "true"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|