diff --git a/app/src-tauri/src/aws/policies.rs b/app/src-tauri/src/aws/policies.rs index b1984c5..7e8e435 100644 --- a/app/src-tauri/src/aws/policies.rs +++ b/app/src-tauri/src/aws/policies.rs @@ -288,7 +288,6 @@ const GROUP_CREATE: Context = &[ "autoscaling:LaunchTemplateVersionSpecified", Literal("true"), ), - ("autoscaling:InstanceTypes", Literal("m7i.large")), ]; const GROUP_UPDATE: Context = &[ (COMPONENT_RESOURCE_TAG, Literal("user-onboarding")), @@ -2816,15 +2815,17 @@ mod tests { ); } } - // Creating always names the template version and its types; an - // update may leave the template alone (a size change, the drain - // before destroy). - assert!(!allowed( + // Creating always names the template version; an update may leave + // the template alone (a size change, the drain before destroy). + // A template-only create sends no `autoscaling:InstanceTypes` + // (verified live, phase 7): it must pass, and the type is held by + // the caller's own `ec2:RunInstances` launch check instead. + assert!(allowed( tier, &write( "autoscaling:CreateAutoScalingGroup", PROBE_AUTO_SCALING_GROUP, - without(GROUP_CREATE, "autoscaling:InstanceTypes") + GROUP_CREATE ), ME, ME diff --git a/app/src-tauri/src/aws/tofu_modules/tests.rs b/app/src-tauri/src/aws/tofu_modules/tests.rs index e85274d..0b9a8b0 100644 --- a/app/src-tauri/src/aws/tofu_modules/tests.rs +++ b/app/src-tauri/src/aws/tofu_modules/tests.rs @@ -1789,7 +1789,6 @@ const GROUP_CREATE: Context = &[ "autoscaling:LaunchTemplateVersionSpecified", Literal("true"), ), - ("autoscaling:InstanceTypes", Literal("m7i.large")), ]; const GROUP_UPDATE: Context = &[ (RESOURCE_COMPONENT, Literal("user-onboarding")), diff --git a/aws/README.md b/aws/README.md index 1d68b38..987b41c 100644 --- a/aws/README.md +++ b/aws/README.md @@ -237,7 +237,7 @@ the proof; an action it shows missing is added to the table, the policy, the che | `aws_ecs_capacity_provider` | `ecs:CreateCapacityProvider`, `TagResource` (at create), `ListTagsForResource`, `UpdateCapacityProvider`, `UntagResource`, `DeleteCapacityProvider` (`capacity-provider/triple-c-*--u-*`), `DescribeCapacityProviders` (`*`); `iam:CreateServiceLinkedRole` for `ecs.amazonaws.com` (managed scaling runs as ECS's service-linked role) | | `aws_ecs_cluster_capacity_providers` (the user's) | `ecs:PutClusterCapacityProviders` (the cluster and, expected, the capacity provider) | | `aws_launch_template` | `ec2:CreateLaunchTemplate` (request tag), `CreateTags` (at create), `CreateLaunchTemplateVersion`, `CreateTags`/`DeleteTags`, `DeleteLaunchTemplate` (tagged), `Describe*`. Never `ModifyLaunchTemplate`: the default version never moves (the module must not set `update_default_version` or `default_version`) | -| `aws_autoscaling_group` | `autoscaling:CreateAutoScalingGroup` (`triple-c-*--u-*`, request tag, `autoscaling:LaunchTemplateVersionSpecified = true`, no `TargetGroupARNs`/`LoadBalancerNames`, `autoscaling:InstanceTypes` present and supported), `UpdateAutoScalingGroup` (tagged; the same, except that an update which leaves the template alone passes the version check), `SetInstanceProtection`, `CreateOrUpdateTags`/`DeleteTags`, `DeleteAutoScalingGroup` (tagged), `Describe*` (`*`); `iam:CreateServiceLinkedRole` for `autoscaling.amazonaws.com`. Creating a group checks that the caller could launch its template: `ec2:RunInstances` on the tagged launch template; on the instance and its volume only with the component request tag, `ec2:LaunchTemplate` set and (instance) a supported `ec2:InstanceType` (required: a launch whose type IAM doesn't see is denied); on the network interface and subnet with `ec2:LaunchTemplate`; on the security group only the template's own (`ec2:IsLaunchTemplateResource`) component-tagged group; on images only Amazon's, named by the template; `ec2:CreateTags` at `RunInstances`; `iam:PassRole` of the instance role to `ec2.amazonaws.com`. ASG tags are **not** the provider's `default_tags`: the module must set the component tag on the group itself | +| `aws_autoscaling_group` | `autoscaling:CreateAutoScalingGroup` (`triple-c-*--u-*`, request tag, `autoscaling:LaunchTemplateVersionSpecified = true`, no `TargetGroupARNs`/`LoadBalancerNames`, `autoscaling:InstanceTypes` supported when present — a template-only create sends none, verified live, so the type is held by the launch check below), `UpdateAutoScalingGroup` (tagged; the same, except that an update which leaves the template alone passes the version check), `SetInstanceProtection`, `CreateOrUpdateTags`/`DeleteTags`, `DeleteAutoScalingGroup` (tagged), `Describe*` (`*`); `iam:CreateServiceLinkedRole` for `autoscaling.amazonaws.com`. Creating a group checks that the caller could launch its template: `ec2:RunInstances` on the tagged launch template; on the instance and its volume only with the component request tag, `ec2:LaunchTemplate` set and (instance) a supported `ec2:InstanceType` (required: a launch whose type IAM doesn't see is denied); on the network interface and subnet with `ec2:LaunchTemplate`; on the security group only the template's own (`ec2:IsLaunchTemplateResource`) component-tagged group; on images only Amazon's, named by the template; `ec2:CreateTags` at `RunInstances`; `iam:PassRole` of the instance role to `ec2.amazonaws.com`. ASG tags are **not** the provider's `default_tags`: the module must set the component tag on the group itself | | `aws_iam_role` (instance), `aws_iam_role_policy` | as the other per-user roles (bounded), on `triple-c---instance`, tagged `triple-c:cluster = triple-c---u-` (`iam:TagRole`) | | `aws_iam_instance_profile` | `iam:CreateInstanceProfile`, `TagInstanceProfile`, `AddRoleToInstanceProfile` (expected to need `iam:PassRole` of the role too), `GetInstanceProfile`, `ListInstanceProfileTags`, `UntagInstanceProfile`, `RemoveRoleFromInstanceProfile`, `DeleteInstanceProfile` (`instance-profile/triple-c-*`) | | `data.aws_ssm_parameter` (AMI) | `ssm:GetParameter`/`GetParameters` on the public `parameter/aws/service/ecs/optimized-ami/*` | @@ -585,14 +585,12 @@ expected, not verified: - **`ec2:IsLaunchTemplateResource`** is expected to be `true` on the image and security group the template names, and `aws:RequestTag` to carry the template's tag specifications for the instance and volume. If the group's launch check doesn't send either, that statement denies the create. -- **`autoscaling:InstanceTypes`** is required on a group create (`Null: false`) and checked - against the supported list (`ForAllValues`). Expected: Auto Scaling fills it with the launch - template's instance type. If it is absent for a template-only create, every create is denied: - then drop the `Null` and rely on the `RunInstances` check (instance type required there). On - update it is not required (an update that leaves the template alone, such as the drain before - destroy, names no type). There is **no condition key for `MixedInstancesPolicy` or - `InstanceRequirements`**; their overrides are expected to appear in `autoscaling:InstanceTypes` - and in the launch check, which is what keeps them to the list. +- ~~**`autoscaling:InstanceTypes`** required on a group create.~~ **Verified live (phase 7):** a + template-only create sends **no** `autoscaling:InstanceTypes`, so the `Null: false` denied every + group (the first live onboarding failed on it); it is dropped. Creating a group runs the caller's + own `ec2:RunInstances` check on the template ("You are not authorized to use launch template" + otherwise), so `ec2:InstanceType` holds the type; a `MixedInstancesPolicy` override of an + unsupported type is denied by both checks. - **Instance types in templates.** `ec2:CreateLaunchTemplate`/`CreateLaunchTemplateVersion` are not known to support `ec2:InstanceType` (not in the service authorization reference as I know it), so a template may *name* any type; it can only be *launched* (directly or by a group) with a diff --git a/aws/policies/environment-admin-scaling.json b/aws/policies/environment-admin-scaling.json index a8104fc..e1c7326 100644 --- a/aws/policies/environment-admin-scaling.json +++ b/aws/policies/environment-admin-scaling.json @@ -14,8 +14,7 @@ "Null": { "aws:RequestTag/triple-c:component": "false", "autoscaling:TargetGroupARNs": "true", - "autoscaling:LoadBalancerNames": "true", - "autoscaling:InstanceTypes": "false" + "autoscaling:LoadBalancerNames": "true" }, "Bool": { "autoscaling:LaunchTemplateVersionSpecified": "true"