Skip to content

Commit 32ad0c2

Browse files
committed
Add exact S3 bucket resource pattern to BedrockExecutionManagedPolicy suppression
1 parent acf74c3 commit 32ad0c2

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

packages/cdk/nagSuppressions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const nagSuppressions = (stack: Stack) => {
9696
reason: "Bedrock Knowledge Base requires these permissions to access S3 documents and OpenSearch collection.",
9797
appliesTo: [
9898
"Action::bedrock:Delete*",
99+
"Resource::<StorageDocsBucketepsamDocsF25F63F1.Arn>/*",
99100
"Resource::arn:aws:bedrock:eu-west-2:undefined:knowledge-base/*",
100101
"Resource::arn:aws:bedrock:eu-west-2:591291862413:knowledge-base/*",
101102
"Resource::arn:aws:aoss:eu-west-2:undefined:collection/*",

packages/cdk/resources/IamResources.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
ManagedPolicy
77
} from "aws-cdk-lib/aws-iam"
88
import {Bucket} from "aws-cdk-lib/aws-s3"
9-
import {NagSuppressions} from "cdk-nag"
109

1110
// Amazon Titan embedding model for vector generation
1211
const EMBEDDING_MODEL = "amazon.titan-embed-text-v2:0"
@@ -87,15 +86,6 @@ export class IamResources extends Construct {
8786
]
8887
})
8988

90-
// Suppress CDK-nag warning for S3 wildcard resource
91-
NagSuppressions.addResourceSuppressions(bedrockExecutionManagedPolicy, [
92-
{
93-
id: "AwsSolutions-IAM5",
94-
reason: "Bedrock Knowledge Base requires wildcard access to read all objects in the S3 bucket",
95-
appliesTo: [`Resource::${props.kbDocsBucket.bucketArn}/*`]
96-
}
97-
])
98-
9989
// Create Bedrock execution role with managed policy
10090
this.bedrockExecutionRole = new Role(this, "EpsAssistMeBedrockExecutionRole", {
10191
assumedBy: new ServicePrincipal("bedrock.amazonaws.com"),

0 commit comments

Comments
 (0)