From 75eb64a26817b18b83eaedf41d0335d1c7b51087 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Tue, 10 Nov 2026 12:28:04 -0500 Subject: [PATCH] Scope the install helper's key use to the table key's ARN The helper's own policy allowed kms:Decrypt on every key tagged for the install, which Security Hub reads as every key (KMS.2). The helper is made before the parts, so its own policy can't name the key: a separate inline policy, table-key, made once the Database part is, names the table key by its ARN (a new Database output), and the allowlist waits for it. The IAM simulator fixture is regenerated (deploy-role-sim.py --native). It now maps AWS::IAM::RolePolicy and a function URL's FunctionArn, and checks that the helper can't decrypt with any other key. --- docs/self-host/security.md | 4 +-- infra/lib/database-stack.ts | 2 ++ infra/lib/native/parent.ts | 21 +++++++++++++++- infra/scripts/deploy-role-sim.py | 7 ++++++ infra/test/fixtures/native-sim.json | 28 ++++++++++++++++++--- infra/test/security-hub.test.ts | 39 +++++++++++++++++++++++++++++ 6 files changed, 94 insertions(+), 7 deletions(-) diff --git a/docs/self-host/security.md b/docs/self-host/security.md index 3bc174888..e74501dee 100644 --- a/docs/self-host/security.md +++ b/docs/self-host/security.md @@ -113,7 +113,7 @@ The helper's role carries the boundary and can only do this (`helperPolicy()` in - list and delete objects in buckets named `coderhelm--*` (to empty the data buckets on delete); - delete an older release's progress bucket, `coderhelm-setup-`: its policy, its files and the bucket (never write to it or make anything public); - read and write the install's secret, `coderhelm//secrets`, and delete it (only on a stack delete with **KeepDataOnDelete** `false`); -- write items to, describe, update and delete the tables named `coderhelm-` and `coderhelm--*` (the allowlist at launch; the tables on delete), and use the KMS keys tagged `coderhelm:install = coderhelm-` to encrypt and decrypt for them; +- write items to, describe, update and delete the tables named `coderhelm-` and `coderhelm--*` (the allowlist at launch; the tables on delete), and use the install's table key, named by its ARN, to encrypt and decrypt for them (a policy of its own, `table-key`, made once the Database part is: the helper is made before the key); - invoke `coderhelm--updater` (the domain); - describe the root stack and read its events; - list log groups, and read the tags of and delete those named `/aws/lambda/coderhelm--*` or `/aws/codebuild/coderhelm--*`. The code deletes the exact names the parts declare, and otherwise only those tagged `coderhelm:install = coderhelm-`; @@ -314,7 +314,7 @@ Mark these as accepted in Security Hub (workflow status **Suppressed**, with the | S3.9 | The release bucket and the log bucket | The release bucket is made before every other part (it holds their templates), so before the log bucket exists. Only the install helper may write to it (its bucket policy), and CloudTrail records each write. A log bucket that logged to itself would log forever. | | Cognito.1, Cognito.4 | The user pool | Threat protection needs Cognito's Plus tier, billed for every monthly active user. The gateway rate-limits sign-in attempts itself. Turn it on in the console if your account requires it. | | Cognito.5 | The user pool | Two-factor is optional, with an authenticator app. An admin can require it for everyone (the **RequireTwoFactor** launch parameter, or **Settings, Sign-in**), and CoderHelm enforces that at sign-in. Requiring it in Cognito would force it on every install, including those that chose not to. | -| KMS.2 | The roles `coderhelm--deploy-stack` and `coderhelm--install-helper` | Both allow `kms:Decrypt` only on keys tagged `coderhelm:install = coderhelm-` (the install's own keys), but Security Hub reads only the resource, not the condition. The deploy role creates those keys, so their ids can't be known when its policy is written, and no update can change that role (see [Updates and the deploy role](#updates-and-the-deploy-role)). The helper is made before the part that makes the keys, for the same reason. | +| KMS.2 | The role `coderhelm--deploy-stack` | It allows `kms:Decrypt` only on keys tagged `coderhelm:install = coderhelm-` (the install's own keys), but Security Hub reads only the resource, not the condition. The deploy role creates those keys, so their ids can't be known when its policy is written, and no update can change that role (see [Updates and the deploy role](#updates-and-the-deploy-role)). The install helper names its one key by ARN. | | SecretsManager.1 | `coderhelm//secrets` | It holds the GitHub App's keys, which only GitHub can issue, and the session signing key: rotating that key signs everyone out. | | SecretsManager.1 | `coderhelm-readonly-*` | You create these for a data source: a read-only database user of yours. Rotate them with your database's own rotation. | | CloudFormation.3 | `coderhelm-`, `coderhelm--access`, `CoderHelmLogReader*` | Uninstalling is deleting the stack. To protect it, turn termination protection on: `aws cloudformation update-termination-protection --enable-termination-protection --stack-name coderhelm-`. Updates still apply. Turn it off with `--no-enable-termination-protection` before you uninstall. | diff --git a/infra/lib/database-stack.ts b/infra/lib/database-stack.ts index ce907f376..35141646b 100644 --- a/infra/lib/database-stack.ts +++ b/infra/lib/database-stack.ts @@ -572,6 +572,8 @@ export class DatabaseStack extends cdk.Stack { // Outputs new cdk.CfnOutput(this, "TableName", { value: this.table.tableName }); new cdk.CfnOutput(this, "TableArn", { value: this.table.tableArn }); + // The table key, by ARN: a native install's helper may use only this key (native/parent.ts). + new cdk.CfnOutput(this, "TableKeyArn", { value: this.encryptionKey.keyArn }); new cdk.CfnOutput(this, "TeamsTableName", { value: this.teamsTable.tableName, }); diff --git a/infra/lib/native/parent.ts b/infra/lib/native/parent.ts index 3074e16f5..f4ec83ae3 100644 --- a/infra/lib/native/parent.ts +++ b/infra/lib/native/parent.ts @@ -229,7 +229,6 @@ export function helperPolicy(): PolicyDocument { // DeleteSecret: only on a stack delete with KeepDataOnDelete=false (Final). { Sid: "Secret", Effect: "Allow", Action: ["secretsmanager:GetSecretValue", "secretsmanager:PutSecretValue", "secretsmanager:DeleteSecret"], Resource: `${at("secretsmanager")}:secret:coderhelm/\${Stage}/secrets-??????` }, { Sid: "AllowlistAndTablesOnDelete", Effect: "Allow", Action: ["dynamodb:BatchWriteItem", "dynamodb:DescribeTable", "dynamodb:DeleteTable", "dynamodb:UpdateTable"], Resource: [`${at("dynamodb")}:table/${p}`, `${at("dynamodb")}:table/${p}-*`] }, - { Sid: "TableKey", Effect: "Allow", Action: ["kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey*", "kms:DescribeKey"], Resource: "*", Condition: { StringEquals: { [`aws:ResourceTag/${INSTALL_TAG}`]: p } } }, { Sid: "Domain", Effect: "Allow", Action: "lambda:InvokeFunction", Resource: `${at("lambda")}:function:${p}-updater` }, { Sid: "RootStack", Effect: "Allow", Action: ["cloudformation:DescribeStacks", "cloudformation:DescribeStackEvents"], Resource: "arn:${AWS::Partition}:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${AWS::StackName}/*" }, // stage_held: the root stack's own deploy role and boundaries, read from its current template (read-only, that stack only). @@ -254,6 +253,10 @@ export function helperPolicy(): PolicyDocument { }; } +/** The helper's own policy on the install's table key, by its ARN (the Database part's output). */ +export const HELPER_TABLE_KEY_POLICY = "table-key"; +export const HELPER_TABLE_KEY_ACTIONS = ["kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey*", "kms:DescribeKey"]; + /** The auto-update role's policy: the deploy policy, the parent stack, the release files. */ export function deployRolePolicy(n: AccessNames): PolicyDocument { const base = deployPolicy(n); @@ -487,8 +490,24 @@ export function buildParent(input: ParentInput): Json { }, }; if (names.has("Database")) { + // The allowlist goes into a table encrypted with the install's table key. + // The helper is made before the parts, so it can't name the key in its + // own policy: this one, made once the Database part is, names that one + // key (never every key: Security Hub KMS.2). + R.HelperTableKey = { + Type: "AWS::IAM::RolePolicy", + Properties: { + RoleName: { Ref: "HelperRole" }, + PolicyName: HELPER_TABLE_KEY_POLICY, + PolicyDocument: { + Version: "2012-10-17", + Statement: [{ Sid: "TableKey", Effect: "Allow", Action: HELPER_TABLE_KEY_ACTIONS, Resource: { "Fn::GetAtt": ["Database", "Outputs.TableKeyArn"] } }], + }, + }, + }; R.Allowlist = { Type: "Custom::Allowlist", + DependsOn: ["HelperTableKey"], Properties: { ...helper, Table: { "Fn::GetAtt": ["Database", "Outputs.SettingsTableName"] }, Admin: { Ref: "AdminEmail" }, Domain: { Ref: "SignupDomain" }, TwoFactor: { Ref: "RequireTwoFactor" } }, }; } diff --git a/infra/scripts/deploy-role-sim.py b/infra/scripts/deploy-role-sim.py index 343f136ae..fab7c6b38 100644 --- a/infra/scripts/deploy-role-sim.py +++ b/infra/scripts/deploy-role-sim.py @@ -226,6 +226,8 @@ def resolve(self, v): if attr == "ApiId": return self.ident(lid)[0] if attr == "UserPoolId": return self.ident(lid)[0] if attr == "Id" and ty == "AWS::CloudFront::Distribution": return self.ident(lid)[0] + # A function URL's function (the web part's OAC permissions name the streaming function). + if attr == "FunctionArn" and ty == "AWS::Lambda::Url": return self.resolve(self.res[lid]["Properties"]["TargetFunctionArn"]) return f"<{lid}.{attr}>" if "Fn::Join" in v: sep, parts = v["Fn::Join"] @@ -310,6 +312,9 @@ def targets(st, lid, r, action): "AWS::Cognito::UserPool": "email.cognito-idp.amazonaws.com/AWSServiceRoleForAmazonCognitoIdpEmailService", "AWS::Cognito::UserPoolClient": "email.cognito-idp.amazonaws.com/AWSServiceRoleForAmazonCognitoIdpEmailService"}[ty] return [(f"arn:aws:iam::{ACCT}:role/aws-service-role/{slr}", {"iam:AWSServiceName": slr.split("/")[0]})] + # One inline policy on one role (the native helper's table-key policy). + if svc == "iam" and ty == "AWS::IAM::RolePolicy": + return [(f"arn:aws:iam::{ACCT}:role/{st.resolve(p['RoleName'])}", {})] if svc == "iam" and ty in ("AWS::IAM::Policy",): roles = [st.resolve(x) for x in p.get("Roles", [])] if action.startswith("iam:") and ("User" in action or "Group" in action): @@ -738,6 +743,8 @@ def helper_rows(): ("ssm:PutParameter", f"{at('ssm')}:parameter/{P}/uninstall/delete-data"), ("ssm:DeleteParameter", f"{at('ssm')}:parameter/{P}/public-url"), ("s3:DeleteBucket", f"{s3}someone-else"), ("s3:DeleteBucket", f"{s3}{P}-dashboard-{ACCT}"), ("kms:DeleteAlias", f"{at('kms')}:alias/my-app"), ("kms:ScheduleKeyDeletion", f"{at('kms')}:key/0f0f0f0f-1111-2222-3333-444455556666"), + # No key use in its own policy: the table key, by ARN, is its table-key policy (Security Hub KMS.2). + ("kms:Decrypt", f"{at('kms')}:key/0f0f0f0f-1111-2222-3333-444455556666"), ("kms:Decrypt", "*"), ("cognito-idp:DeleteUserPool", f"{at('cognito-idp')}:userpool/us-east-1_someones"), # Nothing public: progress goes to CoderHelm with the guide's key. ("s3:PutObject", f"{s3}coderhelm-setup-0123456789abcdef/status.json"), ("s3:PutBucketPolicy", f"{s3}coderhelm-setup-0123456789abcdef"), diff --git a/infra/test/fixtures/native-sim.json b/infra/test/fixtures/native-sim.json index daafe2ae7..33ec22471 100644 --- a/infra/test/fixtures/native-sim.json +++ b/infra/test/fixtures/native-sim.json @@ -811,6 +811,7 @@ "AWS::IAM::ManagedPolicy", "AWS::IAM::Policy", "AWS::IAM::Role", + "AWS::IAM::RolePolicy", "AWS::KMS::Alias", "AWS::KMS::Key", "AWS::Lambda::EventSourceMapping", @@ -1142,6 +1143,11 @@ {"actions": {"iam:PassRole": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PassedToService": "lambda.amazonaws.com"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-aa97ebdf"}, {"actions": {"iam:AttachRolePolicy": "allowed", "iam:DeleteRolePolicy": "allowed", "iam:DetachRolePolicy": "allowed", "iam:PutRolePermissionsBoundary": "allowed", "iam:PutRolePolicy": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-aa97ebdf"}, {"actions": {"iam:DeleteRole": "allowed", "iam:DeleteRolePermissionsBoundary": "explicitDeny", "iam:GetRole": "allowed", "iam:GetRolePolicy": "allowed", "iam:ListAttachedRolePolicies": "allowed", "iam:ListRolePolicies": "allowed", "iam:ListRoleTags": "allowed", "iam:UntagRole": "allowed", "iam:UpdateAssumeRolePolicy": "allowed", "iam:UpdateRole": "allowed", "iam:UpdateRoleDescription": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role read", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-aa97ebdf"}, + {"actions": {"iam:TagRole": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-ad0e355b"}, + {"actions": {"iam:CreateRole": "allowed"}, "calls": ["AWS::IAM::Role create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"], "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-ad0e355b"}, + {"actions": {"iam:PassRole": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PassedToService": "lambda.amazonaws.com"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-ad0e355b"}, + {"actions": {"iam:AttachRolePolicy": "allowed", "iam:DeleteRolePolicy": "allowed", "iam:DetachRolePolicy": "allowed", "iam:PutRolePermissionsBoundary": "allowed", "iam:PutRolePolicy": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-ad0e355b"}, + {"actions": {"iam:DeleteRole": "allowed", "iam:DeleteRolePermissionsBoundary": "explicitDeny", "iam:GetRole": "allowed", "iam:GetRolePolicy": "allowed", "iam:ListAttachedRolePolicies": "allowed", "iam:ListRolePolicies": "allowed", "iam:ListRoleTags": "allowed", "iam:UntagRole": "allowed", "iam:UpdateAssumeRolePolicy": "allowed", "iam:UpdateRole": "allowed", "iam:UpdateRoleDescription": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role read", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-Role-ad0e355b"}, {"actions": {"iam:TagRole": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-ServiceRole-1e19356c"}, {"actions": {"iam:CreateRole": "allowed"}, "calls": ["AWS::IAM::Role create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"], "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-ServiceRole-1e19356c"}, {"actions": {"iam:PassRole": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PassedToService": "lambda.amazonaws.com"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-ServiceRole-1e19356c"}, @@ -1204,8 +1210,8 @@ {"actions": {"iam:TagRole": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, {"actions": {"iam:CreateRole": "allowed"}, "calls": ["AWS::IAM::Role create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"], "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, {"actions": {"iam:PassRole": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PassedToService": "lambda.amazonaws.com"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, - {"actions": {"iam:AttachRolePolicy": "allowed", "iam:DeleteRolePolicy": "allowed", "iam:DetachRolePolicy": "allowed", "iam:PutRolePermissionsBoundary": "allowed", "iam:PutRolePolicy": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, - {"actions": {"iam:DeleteRole": "allowed", "iam:DeleteRolePermissionsBoundary": "explicitDeny", "iam:GetRole": "allowed", "iam:GetRolePolicy": "allowed", "iam:ListAttachedRolePolicies": "allowed", "iam:ListRolePolicies": "allowed", "iam:ListRoleTags": "allowed", "iam:UntagRole": "allowed", "iam:UpdateAssumeRolePolicy": "allowed", "iam:UpdateRole": "allowed", "iam:UpdateRoleDescription": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role read", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, + {"actions": {"iam:AttachRolePolicy": "allowed", "iam:DeleteRolePolicy": "allowed", "iam:DetachRolePolicy": "allowed", "iam:PutRolePermissionsBoundary": "allowed", "iam:PutRolePolicy": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role update", "AWS::IAM::RolePolicy create", "AWS::IAM::RolePolicy delete", "AWS::IAM::RolePolicy update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, + {"actions": {"iam:DeleteRole": "allowed", "iam:DeleteRolePermissionsBoundary": "explicitDeny", "iam:GetRole": "allowed", "iam:GetRolePolicy": "allowed", "iam:ListAttachedRolePolicies": "allowed", "iam:ListRolePolicies": "allowed", "iam:ListRoleTags": "allowed", "iam:UntagRole": "allowed", "iam:UpdateAssumeRolePolicy": "allowed", "iam:UpdateRole": "allowed", "iam:UpdateRoleDescription": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role read", "AWS::IAM::Role tag", "AWS::IAM::Role update", "AWS::IAM::RolePolicy create", "AWS::IAM::RolePolicy delete", "AWS::IAM::RolePolicy read", "AWS::IAM::RolePolicy update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-install-helper"}, {"actions": {"iam:TagRole": "allowed"}, "calls": ["AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role tag", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-plugin-scheduler"}, {"actions": {"iam:CreateRole": "allowed"}, "calls": ["AWS::IAM::Role create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"], "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-plugin-scheduler"}, {"actions": {"iam:AttachRolePolicy": "allowed", "iam:DeleteRolePolicy": "allowed", "iam:DetachRolePolicy": "allowed", "iam:PutRolePermissionsBoundary": "allowed", "iam:PutRolePolicy": "allowed"}, "calls": ["AWS::IAM::Policy create", "AWS::IAM::Policy delete", "AWS::IAM::Policy update", "AWS::IAM::Role create", "AWS::IAM::Role delete", "AWS::IAM::Role update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/coderhelm-prod-boundary-stack"}, "resource": "arn:aws:iam::111122223333:role/coderhelm-prod-plugin-scheduler"}, @@ -1243,6 +1249,10 @@ {"actions": {"lambda:CreateFunction": "allowed"}, "calls": ["AWS::Lambda::Function create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-40a21f30"}, {"actions": {"lambda:AssociateRuntimeAlias": "allowed", "lambda:DeleteFunction": "allowed", "lambda:DeleteFunctionCodeSigningConfig": "allowed", "lambda:DeleteFunctionConcurrency": "allowed", "lambda:GetFunction": "allowed", "lambda:GetFunctionCodeSigningConfig": "allowed", "lambda:GetFunctionRecursionConfig": "allowed", "lambda:GetFunctionScalingConfig": "allowed", "lambda:GetRuntimeManagementConfig": "allowed", "lambda:ListTags": "allowed", "lambda:PublishVersion": "allowed", "lambda:PutFunctionCodeSigningConfig": "allowed", "lambda:PutFunctionConcurrency": "allowed", "lambda:PutFunctionRecursionConfig": "allowed", "lambda:PutFunctionScalingConfig": "allowed", "lambda:PutRuntimeManagementConfig": "allowed", "lambda:UntagResource": "allowed", "lambda:UpdateFunctionCode": "allowed", "lambda:UpdateFunctionConfiguration": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function delete", "AWS::Lambda::Function read", "AWS::Lambda::Function tag", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-40a21f30"}, {"actions": {"lambda:InvokeFunction": "allowed", "lambda:PutRuntimeManagementConfig": "allowed"}, "calls": ["AWS::Lambda::Function create", "Custom::S3AutoDeleteObjects create/update/delete"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-40a21f30"}, + {"actions": {"lambda:TagResource": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function tag", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"lambda:CreateFunction": "allowed"}, "calls": ["AWS::Lambda::Function create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"lambda:AssociateRuntimeAlias": "allowed", "lambda:DeleteFunction": "allowed", "lambda:DeleteFunctionCodeSigningConfig": "allowed", "lambda:DeleteFunctionConcurrency": "allowed", "lambda:GetFunction": "allowed", "lambda:GetFunctionCodeSigningConfig": "allowed", "lambda:GetFunctionRecursionConfig": "allowed", "lambda:GetFunctionScalingConfig": "allowed", "lambda:GetRuntimeManagementConfig": "allowed", "lambda:ListTags": "allowed", "lambda:PublishVersion": "allowed", "lambda:PutFunctionCodeSigningConfig": "allowed", "lambda:PutFunctionConcurrency": "allowed", "lambda:PutFunctionRecursionConfig": "allowed", "lambda:PutFunctionScalingConfig": "allowed", "lambda:PutRuntimeManagementConfig": "allowed", "lambda:UntagResource": "allowed", "lambda:UpdateFunctionCode": "allowed", "lambda:UpdateFunctionConfiguration": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function delete", "AWS::Lambda::Function read", "AWS::Lambda::Function tag", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"lambda:InvokeFunction": "allowed", "lambda:PutRuntimeManagementConfig": "allowed"}, "calls": ["AWS::Lambda::Function create", "Custom::S3AutoDeleteObjects create/update/delete"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-5d0b7aae"}, {"actions": {"lambda:TagResource": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function tag", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-cd8e80af"}, {"actions": {"lambda:CreateFunction": "allowed"}, "calls": ["AWS::Lambda::Function create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-cd8e80af"}, {"actions": {"lambda:AssociateRuntimeAlias": "allowed", "lambda:DeleteFunction": "allowed", "lambda:DeleteFunctionCodeSigningConfig": "allowed", "lambda:DeleteFunctionConcurrency": "allowed", "lambda:GetFunction": "allowed", "lambda:GetFunctionCodeSigningConfig": "allowed", "lambda:GetFunctionRecursionConfig": "allowed", "lambda:GetFunctionScalingConfig": "allowed", "lambda:GetRuntimeManagementConfig": "allowed", "lambda:ListTags": "allowed", "lambda:PublishVersion": "allowed", "lambda:PutFunctionCodeSigningConfig": "allowed", "lambda:PutFunctionConcurrency": "allowed", "lambda:PutFunctionRecursionConfig": "allowed", "lambda:PutFunctionScalingConfig": "allowed", "lambda:PutRuntimeManagementConfig": "allowed", "lambda:UntagResource": "allowed", "lambda:UpdateFunctionCode": "allowed", "lambda:UpdateFunctionConfiguration": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function delete", "AWS::Lambda::Function read", "AWS::Lambda::Function tag", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-Handler-cd8e80af"}, @@ -1312,6 +1322,10 @@ {"actions": {"logs:CreateLogGroup": "allowed"}, "calls": ["AWS::Logs::LogGroup create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-40a21f30"}, {"actions": {"logs:AssociateKmsKey": "allowed", "logs:DeleteDataProtectionPolicy": "allowed", "logs:DeleteLogGroup": "allowed", "logs:DeleteRetentionPolicy": "allowed", "logs:DisassociateKmsKey": "allowed", "logs:GetDataProtectionPolicy": "allowed", "logs:ListTagsForResource": "allowed", "logs:PutDataProtectionPolicy": "allowed", "logs:PutLogGroupDeletionProtection": "allowed", "logs:PutRetentionPolicy": "allowed", "logs:UntagResource": "allowed"}, "calls": ["AWS::Logs::LogGroup create", "AWS::Logs::LogGroup delete", "AWS::Logs::LogGroup read", "AWS::Logs::LogGroup tag", "AWS::Logs::LogGroup update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-40a21f30"}, {"actions": {"logs:PutDataProtectionPolicy": "allowed", "logs:PutRetentionPolicy": "allowed"}, "calls": ["AWS::Logs::LogGroup create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-40a21f30"}, + {"actions": {"logs:TagLogGroup": "allowed", "logs:TagResource": "allowed"}, "calls": ["AWS::Logs::LogGroup create", "AWS::Logs::LogGroup tag", "AWS::Logs::LogGroup update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"logs:CreateLogGroup": "allowed"}, "calls": ["AWS::Logs::LogGroup create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"logs:AssociateKmsKey": "allowed", "logs:DeleteDataProtectionPolicy": "allowed", "logs:DeleteLogGroup": "allowed", "logs:DeleteRetentionPolicy": "allowed", "logs:DisassociateKmsKey": "allowed", "logs:GetDataProtectionPolicy": "allowed", "logs:ListTagsForResource": "allowed", "logs:PutDataProtectionPolicy": "allowed", "logs:PutLogGroupDeletionProtection": "allowed", "logs:PutRetentionPolicy": "allowed", "logs:UntagResource": "allowed"}, "calls": ["AWS::Logs::LogGroup create", "AWS::Logs::LogGroup delete", "AWS::Logs::LogGroup read", "AWS::Logs::LogGroup tag", "AWS::Logs::LogGroup update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-5d0b7aae"}, + {"actions": {"logs:PutDataProtectionPolicy": "allowed", "logs:PutRetentionPolicy": "allowed"}, "calls": ["AWS::Logs::LogGroup create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-5d0b7aae"}, {"actions": {"logs:TagLogGroup": "allowed", "logs:TagResource": "allowed"}, "calls": ["AWS::Logs::LogGroup create", "AWS::Logs::LogGroup tag", "AWS::Logs::LogGroup update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-cd8e80af"}, {"actions": {"logs:CreateLogGroup": "allowed"}, "calls": ["AWS::Logs::LogGroup create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-cd8e80af"}, {"actions": {"logs:AssociateKmsKey": "allowed", "logs:DeleteDataProtectionPolicy": "allowed", "logs:DeleteLogGroup": "allowed", "logs:DeleteRetentionPolicy": "allowed", "logs:DisassociateKmsKey": "allowed", "logs:GetDataProtectionPolicy": "allowed", "logs:ListTagsForResource": "allowed", "logs:PutDataProtectionPolicy": "allowed", "logs:PutLogGroupDeletionProtection": "allowed", "logs:PutRetentionPolicy": "allowed", "logs:UntagResource": "allowed"}, "calls": ["AWS::Logs::LogGroup create", "AWS::Logs::LogGroup delete", "AWS::Logs::LogGroup read", "AWS::Logs::LogGroup tag", "AWS::Logs::LogGroup update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-Handler-cd8e80af"}, @@ -1370,6 +1384,10 @@ {"actions": {"s3:CreateBucket": "allowed", "s3:PutBucketTagging": "allowed"}, "calls": ["AWS::S3::Bucket create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:s3:::coderhelm-prod-data-111122223333"}, {"actions": {"s3:BypassGovernanceRetention": "allowed", "s3:CreateBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucket": "allowed", "s3:DeleteBucketAnalyticsConfiguration": "allowed", "s3:DeleteBucketCors": "allowed", "s3:DeleteBucketEncryption": "allowed", "s3:DeleteBucketLifecycle": "allowed", "s3:DeleteBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucketMetricsConfiguration": "allowed", "s3:DeleteBucketPolicy": "allowed", "s3:DeleteBucketReplication": "allowed", "s3:DeleteBucketTagging": "allowed", "s3:DeleteBucketWebsite": "allowed", "s3:DeleteObject": "allowed", "s3:DeleteObjectVersion": "allowed", "s3:GetAccelerateConfiguration": "allowed", "s3:GetAnalyticsConfiguration": "allowed", "s3:GetBucketAbac": "allowed", "s3:GetBucketAcl": "allowed", "s3:GetBucketCORS": "allowed", "s3:GetBucketDefaultStorageClass": "allowed", "s3:GetBucketLogging": "allowed", "s3:GetBucketMetadataTableConfiguration": "allowed", "s3:GetBucketNotification": "allowed", "s3:GetBucketObjectLockConfiguration": "allowed", "s3:GetBucketOwnershipControls": "allowed", "s3:GetBucketPolicy": "allowed", "s3:GetBucketPublicAccessBlock": "allowed", "s3:GetBucketTagging": "allowed", "s3:GetBucketVersioning": "allowed", "s3:GetBucketWebsite": "allowed", "s3:GetEncryptionConfiguration": "allowed", "s3:GetIntelligentTieringConfiguration": "allowed", "s3:GetInventoryConfiguration": "allowed", "s3:GetLifecycleConfiguration": "allowed", "s3:GetMetricsConfiguration": "allowed", "s3:GetReplicationConfiguration": "allowed", "s3:ListBucket": "allowed", "s3:ListTagsForResource": "allowed", "s3:PutAccelerateConfiguration": "allowed", "s3:PutAnalyticsConfiguration": "allowed", "s3:PutBucketAbac": "allowed", "s3:PutBucketAcl": "allowed", "s3:PutBucketCORS": "allowed", "s3:PutBucketDefaultStorageClass": "allowed", "s3:PutBucketLogging": "allowed", "s3:PutBucketNotification": "allowed", "s3:PutBucketObjectLockConfiguration": "allowed", "s3:PutBucketOwnershipControls": "allowed", "s3:PutBucketPolicy": "allowed", "s3:PutBucketPublicAccessBlock": "allowed", "s3:PutBucketReplication": "allowed", "s3:PutBucketVersioning": "allowed", "s3:PutBucketWebsite": "allowed", "s3:PutEncryptionConfiguration": "allowed", "s3:PutIntelligentTieringConfiguration": "allowed", "s3:PutInventoryConfiguration": "allowed", "s3:PutLifecycleConfiguration": "allowed", "s3:PutMetricsConfiguration": "allowed", "s3:PutObjectLockConfiguration": "allowed", "s3:PutReplicationConfiguration": "allowed", "s3:UntagResource": "allowed", "s3:UpdateBucketMetadataAnnotationTableConfiguration": "allowed", "s3:UpdateBucketMetadataInventoryTableConfiguration": "allowed", "s3:UpdateBucketMetadataJournalTableConfiguration": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::Bucket delete", "AWS::S3::Bucket read", "AWS::S3::Bucket tag", "AWS::S3::Bucket update", "AWS::S3::BucketPolicy create", "AWS::S3::BucketPolicy delete", "AWS::S3::BucketPolicy read", "AWS::S3::BucketPolicy update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-data-111122223333"}, {"actions": {"s3:CreateBucketMetadataTableConfiguration": "allowed", "s3:PutAccelerateConfiguration": "allowed", "s3:PutAnalyticsConfiguration": "allowed", "s3:PutBucketAbac": "allowed", "s3:PutBucketAcl": "allowed", "s3:PutBucketCORS": "allowed", "s3:PutBucketDefaultStorageClass": "allowed", "s3:PutBucketLogging": "allowed", "s3:PutBucketNotification": "allowed", "s3:PutBucketObjectLockConfiguration": "allowed", "s3:PutBucketOwnershipControls": "allowed", "s3:PutBucketPolicy": "allowed", "s3:PutBucketPublicAccessBlock": "allowed", "s3:PutBucketReplication": "allowed", "s3:PutBucketVersioning": "allowed", "s3:PutBucketWebsite": "allowed", "s3:PutEncryptionConfiguration": "allowed", "s3:PutIntelligentTieringConfiguration": "allowed", "s3:PutInventoryConfiguration": "allowed", "s3:PutLifecycleConfiguration": "allowed", "s3:PutMetricsConfiguration": "allowed", "s3:PutObjectAcl": "allowed", "s3:PutObjectLockConfiguration": "allowed", "s3:PutObjectVersionAcl": "allowed", "s3:PutReplicationConfiguration": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::BucketPolicy create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:s3:::coderhelm-prod-data-111122223333"}, + {"actions": {"s3:PutBucketTagging": "allowed", "s3:TagResource": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::Bucket tag", "AWS::S3::Bucket update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:s3:::coderhelm-prod-logs-111122223333"}, + {"actions": {"s3:CreateBucket": "allowed", "s3:PutBucketTagging": "allowed"}, "calls": ["AWS::S3::Bucket create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:s3:::coderhelm-prod-logs-111122223333"}, + {"actions": {"s3:BypassGovernanceRetention": "allowed", "s3:CreateBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucket": "allowed", "s3:DeleteBucketAnalyticsConfiguration": "allowed", "s3:DeleteBucketCors": "allowed", "s3:DeleteBucketEncryption": "allowed", "s3:DeleteBucketLifecycle": "allowed", "s3:DeleteBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucketMetricsConfiguration": "allowed", "s3:DeleteBucketPolicy": "allowed", "s3:DeleteBucketReplication": "allowed", "s3:DeleteBucketTagging": "allowed", "s3:DeleteBucketWebsite": "allowed", "s3:DeleteObject": "allowed", "s3:DeleteObjectVersion": "allowed", "s3:GetAccelerateConfiguration": "allowed", "s3:GetAnalyticsConfiguration": "allowed", "s3:GetBucketAbac": "allowed", "s3:GetBucketAcl": "allowed", "s3:GetBucketCORS": "allowed", "s3:GetBucketDefaultStorageClass": "allowed", "s3:GetBucketLogging": "allowed", "s3:GetBucketMetadataTableConfiguration": "allowed", "s3:GetBucketNotification": "allowed", "s3:GetBucketObjectLockConfiguration": "allowed", "s3:GetBucketOwnershipControls": "allowed", "s3:GetBucketPolicy": "allowed", "s3:GetBucketPublicAccessBlock": "allowed", "s3:GetBucketTagging": "allowed", "s3:GetBucketVersioning": "allowed", "s3:GetBucketWebsite": "allowed", "s3:GetEncryptionConfiguration": "allowed", "s3:GetIntelligentTieringConfiguration": "allowed", "s3:GetInventoryConfiguration": "allowed", "s3:GetLifecycleConfiguration": "allowed", "s3:GetMetricsConfiguration": "allowed", "s3:GetReplicationConfiguration": "allowed", "s3:ListBucket": "allowed", "s3:ListTagsForResource": "allowed", "s3:PutAccelerateConfiguration": "allowed", "s3:PutAnalyticsConfiguration": "allowed", "s3:PutBucketAbac": "allowed", "s3:PutBucketAcl": "allowed", "s3:PutBucketCORS": "allowed", "s3:PutBucketDefaultStorageClass": "allowed", "s3:PutBucketLogging": "allowed", "s3:PutBucketNotification": "allowed", "s3:PutBucketObjectLockConfiguration": "allowed", "s3:PutBucketOwnershipControls": "allowed", "s3:PutBucketPolicy": "allowed", "s3:PutBucketPublicAccessBlock": "allowed", "s3:PutBucketReplication": "allowed", "s3:PutBucketVersioning": "allowed", "s3:PutBucketWebsite": "allowed", "s3:PutEncryptionConfiguration": "allowed", "s3:PutIntelligentTieringConfiguration": "allowed", "s3:PutInventoryConfiguration": "allowed", "s3:PutLifecycleConfiguration": "allowed", "s3:PutMetricsConfiguration": "allowed", "s3:PutObjectLockConfiguration": "allowed", "s3:PutReplicationConfiguration": "allowed", "s3:UntagResource": "allowed", "s3:UpdateBucketMetadataAnnotationTableConfiguration": "allowed", "s3:UpdateBucketMetadataInventoryTableConfiguration": "allowed", "s3:UpdateBucketMetadataJournalTableConfiguration": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::Bucket delete", "AWS::S3::Bucket read", "AWS::S3::Bucket tag", "AWS::S3::Bucket update", "AWS::S3::BucketPolicy create", "AWS::S3::BucketPolicy delete", "AWS::S3::BucketPolicy read", "AWS::S3::BucketPolicy update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-logs-111122223333"}, + {"actions": {"s3:CreateBucketMetadataTableConfiguration": "allowed", "s3:PutAccelerateConfiguration": "allowed", "s3:PutAnalyticsConfiguration": "allowed", "s3:PutBucketAbac": "allowed", "s3:PutBucketAcl": "allowed", "s3:PutBucketCORS": "allowed", "s3:PutBucketDefaultStorageClass": "allowed", "s3:PutBucketLogging": "allowed", "s3:PutBucketNotification": "allowed", "s3:PutBucketObjectLockConfiguration": "allowed", "s3:PutBucketOwnershipControls": "allowed", "s3:PutBucketPolicy": "allowed", "s3:PutBucketPublicAccessBlock": "allowed", "s3:PutBucketReplication": "allowed", "s3:PutBucketVersioning": "allowed", "s3:PutBucketWebsite": "allowed", "s3:PutEncryptionConfiguration": "allowed", "s3:PutIntelligentTieringConfiguration": "allowed", "s3:PutInventoryConfiguration": "allowed", "s3:PutLifecycleConfiguration": "allowed", "s3:PutMetricsConfiguration": "allowed", "s3:PutObjectAcl": "allowed", "s3:PutObjectLockConfiguration": "allowed", "s3:PutObjectVersionAcl": "allowed", "s3:PutReplicationConfiguration": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::BucketPolicy create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack"}, "resource": "arn:aws:s3:::coderhelm-prod-logs-111122223333"}, {"actions": {"s3:PutBucketTagging": "allowed", "s3:TagResource": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::Bucket tag", "AWS::S3::Bucket update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:ResourceTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333"}, {"actions": {"s3:CreateBucket": "allowed", "s3:PutBucketTagging": "allowed"}, "calls": ["AWS::S3::Bucket create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:RequestTag/coderhelm:install": "coderhelm-prod", "aws:TagKeys": ["coderhelm:install"]}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333"}, {"actions": {"s3:BypassGovernanceRetention": "allowed", "s3:CreateBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucket": "allowed", "s3:DeleteBucketAnalyticsConfiguration": "allowed", "s3:DeleteBucketCors": "allowed", "s3:DeleteBucketEncryption": "allowed", "s3:DeleteBucketLifecycle": "allowed", "s3:DeleteBucketMetadataTableConfiguration": "allowed", "s3:DeleteBucketMetricsConfiguration": "allowed", "s3:DeleteBucketPolicy": "allowed", "s3:DeleteBucketReplication": "allowed", "s3:DeleteBucketTagging": "allowed", "s3:DeleteBucketWebsite": "allowed", "s3:DeleteObject": "allowed", "s3:DeleteObjectVersion": "allowed", "s3:GetAccelerateConfiguration": "allowed", "s3:GetAnalyticsConfiguration": "allowed", "s3:GetBucketAbac": "allowed", "s3:GetBucketAcl": "allowed", "s3:GetBucketCORS": "allowed", "s3:GetBucketDefaultStorageClass": "allowed", "s3:GetBucketLogging": "allowed", "s3:GetBucketMetadataTableConfiguration": "allowed", "s3:GetBucketNotification": "allowed", "s3:GetBucketObjectLockConfiguration": "allowed", "s3:GetBucketOwnershipControls": "allowed", "s3:GetBucketPolicy": "allowed", "s3:GetBucketPublicAccessBlock": "allowed", "s3:GetBucketTagging": "allowed", "s3:GetBucketVersioning": "allowed", "s3:GetBucketWebsite": "allowed", "s3:GetEncryptionConfiguration": "allowed", "s3:GetIntelligentTieringConfiguration": "allowed", "s3:GetInventoryConfiguration": "allowed", "s3:GetLifecycleConfiguration": "allowed", "s3:GetMetricsConfiguration": "allowed", "s3:GetReplicationConfiguration": "allowed", "s3:ListBucket": "allowed", "s3:ListTagsForResource": "allowed", "s3:PutAccelerateConfiguration": "allowed", "s3:PutAnalyticsConfiguration": "allowed", "s3:PutBucketAbac": "allowed", "s3:PutBucketAcl": "allowed", "s3:PutBucketCORS": "allowed", "s3:PutBucketDefaultStorageClass": "allowed", "s3:PutBucketLogging": "allowed", "s3:PutBucketNotification": "allowed", "s3:PutBucketObjectLockConfiguration": "allowed", "s3:PutBucketOwnershipControls": "allowed", "s3:PutBucketPolicy": "allowed", "s3:PutBucketPublicAccessBlock": "allowed", "s3:PutBucketReplication": "allowed", "s3:PutBucketVersioning": "allowed", "s3:PutBucketWebsite": "allowed", "s3:PutEncryptionConfiguration": "allowed", "s3:PutIntelligentTieringConfiguration": "allowed", "s3:PutInventoryConfiguration": "allowed", "s3:PutLifecycleConfiguration": "allowed", "s3:PutMetricsConfiguration": "allowed", "s3:PutObjectLockConfiguration": "allowed", "s3:PutReplicationConfiguration": "allowed", "s3:UntagResource": "allowed", "s3:UpdateBucketMetadataAnnotationTableConfiguration": "allowed", "s3:UpdateBucketMetadataInventoryTableConfiguration": "allowed", "s3:UpdateBucketMetadataJournalTableConfiguration": "allowed"}, "calls": ["AWS::S3::Bucket create", "AWS::S3::Bucket delete", "AWS::S3::Bucket read", "AWS::S3::Bucket tag", "AWS::S3::Bucket update", "AWS::S3::BucketPolicy create", "AWS::S3::BucketPolicy delete", "AWS::S3::BucketPolicy read", "AWS::S3::BucketPolicy update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333"}, @@ -1378,9 +1396,9 @@ {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/3423a042b818e31c1e34a19d6689ab2e5f9b70fcbe9e71df66f241b20a200bd9.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/3c7ee2b1963d304a27fa0796383c8924fe298b4dd2c3730fc94af6b62be134b7.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/4a591e9289d3102697d4a891189fc90352ce38222e0b201ae637147e5fd55142.zip"}, - {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/9b53b6528f4c8e84d8a67b0bc4e36270272a5e6d8a795aef2c93ec2df25aaa3c.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/a77bb41544bf739e532a3faedb5ecda0bba5d9e19ab56eaa0fc6ec92f1bf5827.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/ae46d59f832d7b7e8ed231a7a3af7955b7585bf1cef81350968eb356db6a79e0.zip"}, + {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/b2b5353f1cc4d0c95b693523553628ef04945049db6712c6932db8e470613d21.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/bc4e026165204dddfc22a4d9b0dd1cc9b8f53c37b8575a9c4638b289303f2da4.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::Function create", "AWS::Lambda::Function update"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/e2323f040b88a4c0ffdb662a75b62cad20b096cc1a873043f7b71c3927548590.zip"}, {"actions": {"s3:GetObject": "allowed", "s3:GetObjectVersion": "allowed"}, "calls": ["AWS::Lambda::LayerVersion create"], "context": {"aws:PrincipalArn": "arn:aws:iam::111122223333:role/coderhelm-prod-deploy-stack", "aws:ResourceTag/coderhelm:install": "coderhelm-prod"}, "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/e2659170a0721541efa761a8d5d04d5e36cbbf691c4b15a9053002b7c825055d.zip"}, @@ -1532,7 +1550,7 @@ ] }, "helper": { - "policy": {"Statement": [{"Action": ["logs:CreateLogStream", "logs:PutLogEvents"], "Effect": "Allow", "Resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-install-helper:*", "Sid": "OwnLog"}, {"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-prod-release-111122223333", "arn:aws:s3:::coderhelm-prod-release-111122223333/*"], "Sid": "ReleaseFiles"}, {"Action": ["s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObject", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-prod-*", "arn:aws:s3:::coderhelm-prod-*/*"], "Sid": "EmptyDataBucketsOnDelete"}, {"Action": ["s3:DeleteBucketPolicy", "s3:DeleteBucket", "s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObject", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-setup-0123456789abcdef", "arn:aws:s3:::coderhelm-setup-0123456789abcdef/*"], "Sid": "RetireProgressBucket"}, {"Action": ["secretsmanager:GetSecretValue", "secretsmanager:PutSecretValue", "secretsmanager:DeleteSecret"], "Effect": "Allow", "Resource": "arn:aws:secretsmanager:us-east-1:111122223333:secret:coderhelm/prod/secrets-??????", "Sid": "Secret"}, {"Action": ["dynamodb:BatchWriteItem", "dynamodb:DescribeTable", "dynamodb:DeleteTable", "dynamodb:UpdateTable"], "Effect": "Allow", "Resource": ["arn:aws:dynamodb:us-east-1:111122223333:table/coderhelm-prod", "arn:aws:dynamodb:us-east-1:111122223333:table/coderhelm-prod-*"], "Sid": "AllowlistAndTablesOnDelete"}, {"Action": ["kms:Encrypt", "kms:Decrypt", "kms:GenerateDataKey*", "kms:DescribeKey"], "Condition": {"StringEquals": {"aws:ResourceTag/coderhelm:install": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "*", "Sid": "TableKey"}, {"Action": "lambda:InvokeFunction", "Effect": "Allow", "Resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-updater", "Sid": "Domain"}, {"Action": ["cloudformation:DescribeStacks", "cloudformation:DescribeStackEvents"], "Effect": "Allow", "Resource": "arn:aws:cloudformation:us-east-1:111122223333:stack/coderhelm-prod/*", "Sid": "RootStack"}, {"Action": "cloudformation:GetTemplate", "Effect": "Allow", "Resource": "arn:aws:cloudformation:us-east-1:111122223333:stack/coderhelm-prod/*", "Sid": "RootStackTemplate"}, {"Action": ["logs:DescribeLogGroups"], "Effect": "Allow", "Resource": "*", "Sid": "LogGroupsOnDelete"}, {"Action": ["logs:DeleteLogGroup", "logs:ListTagsForResource"], "Effect": "Allow", "Resource": ["arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-*", "arn:aws:logs:us-east-1:111122223333:log-group:/aws/codebuild/coderhelm-prod-*"], "Sid": "InstallLogGroupsOnDelete"}, {"Action": ["acm:ListCertificates", "acm:ListTagsForCertificate", "acm:DescribeCertificate"], "Condition": {"StringEquals": {"aws:RequestedRegion": "us-east-1"}}, "Effect": "Allow", "Resource": "*", "Sid": "FindCertificates"}, {"Action": "acm:DeleteCertificate", "Condition": {"StringEquals": {"aws:RequestedRegion": "us-east-1", "aws:ResourceTag/coderhelm": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "*", "Sid": "CertificatesOnDelete"}, {"Action": ["ssm:GetParameter", "ssm:DeleteParameter"], "Effect": "Allow", "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/coderhelm-prod/uninstall/delete-data", "Sid": "UninstallSwitch"}, {"Action": "s3:DeleteBucket", "Effect": "Allow", "Resource": "arn:aws:s3:::coderhelm-prod-data-111122223333", "Sid": "DataBucketOnSwitch"}, {"Action": ["cognito-idp:DescribeUserPool", "cognito-idp:UpdateUserPool", "cognito-idp:DeleteUserPool", "cognito-idp:DeleteUserPoolDomain"], "Condition": {"StringEquals": {"aws:ResourceTag/coderhelm:install": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "arn:aws:cognito-idp:us-east-1:111122223333:userpool/*", "Sid": "UserPoolOnSwitch"}, {"Action": "kms:ListAliases", "Effect": "Allow", "Resource": "*", "Sid": "FindKeyAliases"}, {"Action": "kms:DeleteAlias", "Effect": "Allow", "Resource": "arn:aws:kms:us-east-1:111122223333:alias/coderhelm-prod-*", "Sid": "KeyAliasesOnSwitch"}, {"Action": ["kms:ScheduleKeyDeletion", "kms:DeleteAlias"], "Condition": {"StringEquals": {"aws:ResourceTag/coderhelm:install": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "arn:aws:kms:us-east-1:111122223333:key/*", "Sid": "KeysOnSwitch"}], "Version": "2012-10-17"}, + "policy": {"Statement": [{"Action": ["logs:CreateLogStream", "logs:PutLogEvents"], "Effect": "Allow", "Resource": "arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-install-helper:*", "Sid": "OwnLog"}, {"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-prod-release-111122223333", "arn:aws:s3:::coderhelm-prod-release-111122223333/*"], "Sid": "ReleaseFiles"}, {"Action": ["s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObject", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-prod-*", "arn:aws:s3:::coderhelm-prod-*/*"], "Sid": "EmptyDataBucketsOnDelete"}, {"Action": ["s3:DeleteBucketPolicy", "s3:DeleteBucket", "s3:ListBucket", "s3:ListBucketVersions", "s3:DeleteObject", "s3:DeleteObjectVersion"], "Effect": "Allow", "Resource": ["arn:aws:s3:::coderhelm-setup-0123456789abcdef", "arn:aws:s3:::coderhelm-setup-0123456789abcdef/*"], "Sid": "RetireProgressBucket"}, {"Action": ["secretsmanager:GetSecretValue", "secretsmanager:PutSecretValue", "secretsmanager:DeleteSecret"], "Effect": "Allow", "Resource": "arn:aws:secretsmanager:us-east-1:111122223333:secret:coderhelm/prod/secrets-??????", "Sid": "Secret"}, {"Action": ["dynamodb:BatchWriteItem", "dynamodb:DescribeTable", "dynamodb:DeleteTable", "dynamodb:UpdateTable"], "Effect": "Allow", "Resource": ["arn:aws:dynamodb:us-east-1:111122223333:table/coderhelm-prod", "arn:aws:dynamodb:us-east-1:111122223333:table/coderhelm-prod-*"], "Sid": "AllowlistAndTablesOnDelete"}, {"Action": "lambda:InvokeFunction", "Effect": "Allow", "Resource": "arn:aws:lambda:us-east-1:111122223333:function:coderhelm-prod-updater", "Sid": "Domain"}, {"Action": ["cloudformation:DescribeStacks", "cloudformation:DescribeStackEvents"], "Effect": "Allow", "Resource": "arn:aws:cloudformation:us-east-1:111122223333:stack/coderhelm-prod/*", "Sid": "RootStack"}, {"Action": "cloudformation:GetTemplate", "Effect": "Allow", "Resource": "arn:aws:cloudformation:us-east-1:111122223333:stack/coderhelm-prod/*", "Sid": "RootStackTemplate"}, {"Action": ["logs:DescribeLogGroups"], "Effect": "Allow", "Resource": "*", "Sid": "LogGroupsOnDelete"}, {"Action": ["logs:DeleteLogGroup", "logs:ListTagsForResource"], "Effect": "Allow", "Resource": ["arn:aws:logs:us-east-1:111122223333:log-group:/aws/lambda/coderhelm-prod-*", "arn:aws:logs:us-east-1:111122223333:log-group:/aws/codebuild/coderhelm-prod-*"], "Sid": "InstallLogGroupsOnDelete"}, {"Action": ["acm:ListCertificates", "acm:ListTagsForCertificate", "acm:DescribeCertificate"], "Condition": {"StringEquals": {"aws:RequestedRegion": "us-east-1"}}, "Effect": "Allow", "Resource": "*", "Sid": "FindCertificates"}, {"Action": "acm:DeleteCertificate", "Condition": {"StringEquals": {"aws:RequestedRegion": "us-east-1", "aws:ResourceTag/coderhelm": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "*", "Sid": "CertificatesOnDelete"}, {"Action": ["ssm:GetParameter", "ssm:DeleteParameter"], "Effect": "Allow", "Resource": "arn:aws:ssm:us-east-1:111122223333:parameter/coderhelm-prod/uninstall/delete-data", "Sid": "UninstallSwitch"}, {"Action": "s3:DeleteBucket", "Effect": "Allow", "Resource": "arn:aws:s3:::coderhelm-prod-data-111122223333", "Sid": "DataBucketOnSwitch"}, {"Action": ["cognito-idp:DescribeUserPool", "cognito-idp:UpdateUserPool", "cognito-idp:DeleteUserPool", "cognito-idp:DeleteUserPoolDomain"], "Condition": {"StringEquals": {"aws:ResourceTag/coderhelm:install": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "arn:aws:cognito-idp:us-east-1:111122223333:userpool/*", "Sid": "UserPoolOnSwitch"}, {"Action": "kms:ListAliases", "Effect": "Allow", "Resource": "*", "Sid": "FindKeyAliases"}, {"Action": "kms:DeleteAlias", "Effect": "Allow", "Resource": "arn:aws:kms:us-east-1:111122223333:alias/coderhelm-prod-*", "Sid": "KeyAliasesOnSwitch"}, {"Action": ["kms:ScheduleKeyDeletion", "kms:DeleteAlias"], "Condition": {"StringEquals": {"aws:ResourceTag/coderhelm:install": "coderhelm-prod"}}, "Effect": "Allow", "Resource": "arn:aws:kms:us-east-1:111122223333:key/*", "Sid": "KeysOnSwitch"}], "Version": "2012-10-17"}, "rows": [ {"action": "s3:PutObject", "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/a.zip", "simulator": "allowed", "want": "allowed"}, {"action": "s3:DeleteObject", "resource": "arn:aws:s3:::coderhelm-prod-release-111122223333/assets/a.zip", "simulator": "allowed", "want": "allowed"}, @@ -1580,6 +1598,8 @@ {"action": "s3:DeleteBucket", "resource": "arn:aws:s3:::coderhelm-prod-dashboard-111122223333", "simulator": "implicitDeny", "want": "denied"}, {"action": "kms:DeleteAlias", "resource": "arn:aws:kms:us-east-1:111122223333:alias/my-app", "simulator": "implicitDeny", "want": "denied"}, {"action": "kms:ScheduleKeyDeletion", "resource": "arn:aws:kms:us-east-1:111122223333:key/0f0f0f0f-1111-2222-3333-444455556666", "simulator": "implicitDeny", "want": "denied"}, + {"action": "kms:Decrypt", "resource": "arn:aws:kms:us-east-1:111122223333:key/0f0f0f0f-1111-2222-3333-444455556666", "simulator": "implicitDeny", "want": "denied"}, + {"action": "kms:Decrypt", "resource": "*", "simulator": "implicitDeny", "want": "denied"}, {"action": "cognito-idp:DeleteUserPool", "resource": "arn:aws:cognito-idp:us-east-1:111122223333:userpool/us-east-1_someones", "simulator": "implicitDeny", "want": "denied"}, {"action": "s3:PutObject", "resource": "arn:aws:s3:::coderhelm-setup-0123456789abcdef/status.json", "simulator": "implicitDeny", "want": "denied"}, {"action": "s3:PutBucketPolicy", "resource": "arn:aws:s3:::coderhelm-setup-0123456789abcdef", "simulator": "implicitDeny", "want": "denied"} diff --git a/infra/test/security-hub.test.ts b/infra/test/security-hub.test.ts index f62ad72f8..e9936956c 100644 --- a/infra/test/security-hub.test.ts +++ b/infra/test/security-hub.test.ts @@ -16,6 +16,7 @@ import { Template } from "aws-cdk-lib/assertions"; import { buildApp } from "../lib/app"; import { loadConfigFile, resolveConfig, ResolvedConfig } from "../lib/config"; import { buildNative } from "../lib/native/build"; +import { HELPER_TABLE_KEY_ACTIONS, helperPolicy } from "../lib/native/parent"; import { ACCESS_LOG_DAYS } from "../lib/storage-stack"; import { CLOUDFRONT_LOG_REGIONS } from "../lib/web-stack"; @@ -237,3 +238,41 @@ test("SES.3: email is only sent over TLS", () => { for (const c of sets) assert.equal(c.r.Properties.DeliveryOptions?.TlsPolicy, "REQUIRE", `${name} ${c.where}.${c.id}`); } }); + +test("KMS.2: the install helper decrypts with the table key by its ARN, never with every key", () => { + const R = rel.parent.Resources; + const decrypts = (st: any) => ([] as string[]).concat(st.Action ?? []).some((a) => /^kms:(\*|Decrypt|ReEncrypt\*|ReEncryptFrom)$/.test(a)); + // Its own inline policy uses no key at all. + for (const s of helperPolicy().Statement) assert.ok(!decrypts(s), `helper ${s.Sid}`); + const p = R.HelperTableKey; + assert.equal(p.Type, "AWS::IAM::RolePolicy"); + assert.deepEqual(p.Properties.RoleName, { Ref: "HelperRole" }); + assert.deepEqual(p.Properties.PolicyDocument.Statement, [ + { Sid: "TableKey", Effect: "Allow", Action: HELPER_TABLE_KEY_ACTIONS, Resource: { "Fn::GetAtt": ["Database", "Outputs.TableKeyArn"] } }, + ]); + // That output is the table key itself, and the allowlist is written only once the policy is there. + const out = rel.children.Database.Outputs.TableKeyArn.Value["Fn::GetAtt"]; + assert.equal(out[1], "Arn"); + const key = rel.children.Database.Resources[out[0]]; + assert.equal(key.Type, "AWS::KMS::Key"); + assert.equal(key.Properties.Description, "Coderhelm DynamoDB encryption key"); + assert.deepEqual(R.Allowlist.DependsOn, ["HelperTableKey"]); + // No role the release makes (its parts included) decrypts with every key; the + // pinned deploy role, which creates the keys, is the one exception (security.md). + for (const [name, t] of Object.entries(native)) { + for (const [id, r] of Object.entries(t.Resources ?? {})) { + if (id === "DeployRole") continue; + const docs = r.Type === "AWS::IAM::Role" ? (r.Properties.Policies ?? []).map((x: any) => x.PolicyDocument) + : r.Type === "AWS::IAM::Policy" || r.Type === "AWS::IAM::RolePolicy" ? [r.Properties.PolicyDocument] : []; + for (const d of docs) { + for (const s of ([] as any[]).concat(d.Statement)) { + if (s.Effect !== "Allow" || !decrypts(s)) continue; + for (const res of ([] as any[]).concat(s.Resource)) { + const txt = JSON.stringify(res); + assert.ok(res !== "*" && !/:key\/\*"?$/.test(txt.replace(/"\]+\}*$/, '"')), `${name}.${id}: ${txt}`); + } + } + } + } + } +});