Skip to content

Commit 6df700d

Browse files
fix(docs): scope X-Ray resource policy, add KMS tightening, unify placeholders
- Scope X-Ray resource policy Resource from * to arn:aws:logs:*:ACCOUNT_ID:log-group:aws/spans in QUICK_START.md and setup SKILL.md (item 7) - Add KMS kms:ResourceAliases tightening recommendation (item 6) - Unify placeholder to ACCOUNT_ID everywhere with substitution note (item 8) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ca33f47 commit 6df700d

5 files changed

Lines changed: 21 additions & 15 deletions

File tree

docs/abca-plugin/skills/setup/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ On a fresh AWS account, X-Ray needs a CloudWatch Logs resource policy before it
5858
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
5959
aws logs put-resource-policy \
6060
--policy-name xray-spans-policy \
61-
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":\"*\"}]}"
61+
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":[\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans\",\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans:*\"]}]}"
6262
aws xray update-trace-segment-destination --destination CloudWatchLogs
6363
```
6464

docs/design/DEPLOYMENT_ROLES.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ The policies are split into three IAM managed policies (each under the 6,144-cha
2525
| `IaCRole-ABCA-Application` | DynamoDB, Lambda, API Gateway, Cognito, WAFv2, EventBridge, Secrets Manager |
2626
| `IaCRole-ABCA-Observability` | Bedrock AgentCore, Bedrock Guardrails, CloudWatch, X-Ray, S3, ECR, KMS, SSM, STS |
2727

28+
> **Placeholder substitution**: Replace `ACCOUNT_ID` with your 12-digit AWS account ID and `REGION` with your deployment region (e.g., `us-east-1`) throughout this document.
29+
2830
```bash
2931
# Create all three policies in your account, then re-bootstrap:
30-
cdk bootstrap aws://ACCOUNT/REGION \
31-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Infrastructure" \
32-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Application" \
33-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Observability"
32+
cdk bootstrap aws://ACCOUNT_ID/REGION \
33+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Infrastructure" \
34+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Application" \
35+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Observability"
3436
```
3537

3638
The `--cloudformation-execution-policies` flag can be repeated to attach multiple policies to the CloudFormation execution role.
@@ -684,8 +686,9 @@ These policies are conservative-but-scoped starting points. To tighten further:
684686
3. **Add region conditions** where possible (e.g., `"aws:RequestedRegion": "us-east-1"`) to prevent cross-region resource creation.
685687
4. **Restrict `iam:AttachRolePolicy`** with an `iam:PolicyARN` condition to limit which policies can be attached to `backgroundagent-dev-*` roles. This requires enumerating the AWS managed policies CDK attaches (e.g., `service-role/AWSLambdaBasicExecutionRole`) from a synthesized template, so it is deferred to a post-deployment tightening pass.
686688
5. **Scope `iam:CreateServiceLinkedRole`** with an `iam:AWSServiceName` condition to limit which AWS services can have service-linked roles created. After a first deploy, check CloudTrail for which service-linked roles were actually created and restrict accordingly.
687-
6. **Use permission boundaries** on the IaC role to set an outer limit even if the policy is too broad.
688-
7. **Review after each CDK version upgrade** -- new CDK versions may add/remove custom resources that need different permissions.
689+
6. **Scope KMS actions** with a `kms:ResourceAliases` condition (e.g., `"kms:ResourceAliases": "alias/cdk-hnb659fds-*"`) to limit `CreateGrant`, `Decrypt`, `Encrypt`, and `GenerateDataKey` to the deterministic CDK bootstrap key.
690+
7. **Use permission boundaries** on the IaC role to set an outer limit even if the policy is too broad.
691+
8. **Review after each CDK version upgrade** -- new CDK versions may add/remove custom resources that need different permissions.
689692

690693
## Reference
691694

docs/guides/QUICK_START.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The CDK stack deploys the full platform: API Gateway, Lambda functions (orchestr
8282
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
8383
aws logs put-resource-policy \
8484
--policy-name xray-spans-policy \
85-
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":\"*\"}]}"
85+
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":[\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans\",\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans:*\"]}]}"
8686
aws xray update-trace-segment-destination --destination CloudWatchLogs
8787

8888
# Bootstrap CDK (first time only)

docs/src/content/docs/architecture/Deployment-roles.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ The policies are split into three IAM managed policies (each under the 6,144-cha
2929
| `IaCRole-ABCA-Application` | DynamoDB, Lambda, API Gateway, Cognito, WAFv2, EventBridge, Secrets Manager |
3030
| `IaCRole-ABCA-Observability` | Bedrock AgentCore, Bedrock Guardrails, CloudWatch, X-Ray, S3, ECR, KMS, SSM, STS |
3131

32+
> **Placeholder substitution**: Replace `ACCOUNT_ID` with your 12-digit AWS account ID and `REGION` with your deployment region (e.g., `us-east-1`) throughout this document.
33+
3234
```bash
3335
# Create all three policies in your account, then re-bootstrap:
34-
cdk bootstrap aws://ACCOUNT/REGION \
35-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Infrastructure" \
36-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Application" \
37-
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT:policy/IaCRole-ABCA-Observability"
36+
cdk bootstrap aws://ACCOUNT_ID/REGION \
37+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Infrastructure" \
38+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Application" \
39+
--cloudformation-execution-policies "arn:aws:iam::ACCOUNT_ID:policy/IaCRole-ABCA-Observability"
3840
```
3941

4042
The `--cloudformation-execution-policies` flag can be repeated to attach multiple policies to the CloudFormation execution role.
@@ -688,8 +690,9 @@ These policies are conservative-but-scoped starting points. To tighten further:
688690
3. **Add region conditions** where possible (e.g., `"aws:RequestedRegion": "us-east-1"`) to prevent cross-region resource creation.
689691
4. **Restrict `iam:AttachRolePolicy`** with an `iam:PolicyARN` condition to limit which policies can be attached to `backgroundagent-dev-*` roles. This requires enumerating the AWS managed policies CDK attaches (e.g., `service-role/AWSLambdaBasicExecutionRole`) from a synthesized template, so it is deferred to a post-deployment tightening pass.
690692
5. **Scope `iam:CreateServiceLinkedRole`** with an `iam:AWSServiceName` condition to limit which AWS services can have service-linked roles created. After a first deploy, check CloudTrail for which service-linked roles were actually created and restrict accordingly.
691-
6. **Use permission boundaries** on the IaC role to set an outer limit even if the policy is too broad.
692-
7. **Review after each CDK version upgrade** -- new CDK versions may add/remove custom resources that need different permissions.
693+
6. **Scope KMS actions** with a `kms:ResourceAliases` condition (e.g., `"kms:ResourceAliases": "alias/cdk-hnb659fds-*"`) to limit `CreateGrant`, `Decrypt`, `Encrypt`, and `GenerateDataKey` to the deterministic CDK bootstrap key.
694+
7. **Use permission boundaries** on the IaC role to set an outer limit even if the policy is too broad.
695+
8. **Review after each CDK version upgrade** -- new CDK versions may add/remove custom resources that need different permissions.
693696

694697
## Reference
695698

docs/src/content/docs/getting-started/Quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The CDK stack deploys the full platform: API Gateway, Lambda functions (orchestr
8686
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
8787
aws logs put-resource-policy \
8888
--policy-name xray-spans-policy \
89-
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":\"*\"}]}"
89+
--policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"XRaySpansAccess\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"xray.amazonaws.com\"},\"Action\":[\"logs:PutLogEvents\",\"logs:CreateLogGroup\",\"logs:CreateLogStream\"],\"Resource\":[\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans\",\"arn:aws:logs:*:${ACCOUNT_ID}:log-group:aws/spans:*\"]}]}"
9090
aws xray update-trace-segment-destination --destination CloudWatchLogs
9191

9292
# Bootstrap CDK (first time only)

0 commit comments

Comments
 (0)