Skip to content

Commit af44ed9

Browse files
committed
Remove all appliesTo arrays to use blanket NAG suppressions
1 parent 6833182 commit af44ed9

File tree

1 file changed

+9
-43
lines changed

1 file changed

+9
-43
lines changed

packages/cdk/nagSuppressions.ts

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ import {NagPackSuppression, NagSuppressions} from "cdk-nag"
44

55
export const nagSuppressions = (stack: Stack) => {
66
const stackName = stack.node.tryGetContext("stackName") || "epsam"
7-
const account = Stack.of(stack).account
87
// Suppress granular wildcard on log stream for SlackBot Lambda
98
safeAddNagSuppression(
109
stack,
1110
"/EpsAssistMeStack/Functions/SlackBotLambda/LambdaPutLogsManagedPolicy/Resource",
1211
[
1312
{
1413
id: "AwsSolutions-IAM5",
15-
reason: "Wildcard permissions for log stream access are required and scoped appropriately.",
16-
appliesTo: [
17-
"Resource::<FunctionsSlackBotLambdaLambdaLogGroup3597D783.Arn>:log-stream:*"
18-
]
14+
reason: "Wildcard permissions for log stream access are required and scoped appropriately."
1915
}
2016
]
2117
)
@@ -27,10 +23,7 @@ export const nagSuppressions = (stack: Stack) => {
2723
[
2824
{
2925
id: "AwsSolutions-IAM5",
30-
reason: "Wildcard permissions are required for log stream access under known paths.",
31-
appliesTo: [
32-
"Resource::<FunctionsCreateIndexFunctionLambdaLogGroupB45008DF.Arn>:log-stream:*"
33-
]
26+
reason: "Wildcard permissions are required for log stream access under known paths."
3427
}
3528
]
3629
)
@@ -42,10 +35,7 @@ export const nagSuppressions = (stack: Stack) => {
4235
[
4336
{
4437
id: "AwsSolutions-IAM5",
45-
reason: "Wildcard permissions are required for log stream access under known paths.",
46-
appliesTo: [
47-
"Resource::<FunctionsSyncKnowledgeBaseFunctionLambdaLogGroupB19BE2BE.Arn>:log-stream:*"
48-
]
38+
reason: "Wildcard permissions are required for log stream access under known paths."
4939
}
5040
]
5141
)
@@ -109,15 +99,7 @@ export const nagSuppressions = (stack: Stack) => {
10999
[
110100
{
111101
id: "AwsSolutions-IAM5",
112-
reason: "Bedrock Knowledge Base requires these permissions to access S3 documents and OpenSearch collection.",
113-
appliesTo: [
114-
"Resource::<StorageDocsBucketepsamDocsF25F63F1.Arn>/*",
115-
"Resource::<StorageDocsBucketepsampr27Docs28B71689.Arn>/*",
116-
"Action::bedrock:Delete*",
117-
`Resource::arn:aws:bedrock:eu-west-2:${account}:knowledge-base/*`,
118-
`Resource::arn:aws:aoss:eu-west-2:${account}:collection/*`,
119-
"Resource::*"
120-
]
102+
reason: "Bedrock Knowledge Base requires these permissions to access S3 documents and OpenSearch collection."
121103
}
122104
]
123105
)
@@ -129,11 +111,7 @@ export const nagSuppressions = (stack: Stack) => {
129111
[
130112
{
131113
id: "AwsSolutions-IAM5",
132-
reason: "Lambda needs access to all OpenSearch collections and indexes to create and manage indexes.",
133-
appliesTo: [
134-
`Resource::arn:aws:aoss:eu-west-2:${account}:collection/*`,
135-
`Resource::arn:aws:aoss:eu-west-2:${account}:index/*`
136-
]
114+
reason: "Lambda needs access to all OpenSearch collections and indexes to create and manage indexes."
137115
}
138116
]
139117
)
@@ -145,13 +123,7 @@ export const nagSuppressions = (stack: Stack) => {
145123
[
146124
{
147125
id: "AwsSolutions-IAM5",
148-
reason: "SlackBot Lambda uses wildcard permissions as recommended by AWS docs for Bedrock prompt management.",
149-
appliesTo: [
150-
`Resource::arn:aws:lambda:eu-west-2:${account}:function:*`,
151-
"Resource::*",
152-
"Action::kms:GenerateDataKey*",
153-
"Action::kms:ReEncrypt*"
154-
]
126+
reason: "SlackBot Lambda uses wildcard permissions as recommended by AWS docs for Bedrock prompt management."
155127
}
156128
]
157129
)
@@ -175,7 +147,7 @@ export const nagSuppressions = (stack: Stack) => {
175147
[
176148
{
177149
id: "AwsSolutions-SMG4",
178-
reason: "Slack bot token rotation is handled manually as part of the Slack app configuration process."
150+
reason: "Slack secrets rotation is handled manually as part of the Slack app configuration process."
179151
}
180152
]
181153
)
@@ -203,10 +175,7 @@ export const nagSuppressions = (stack: Stack) => {
203175
[
204176
{
205177
id: "AwsSolutions-IAM4",
206-
reason: "Auto-generated CDK role uses AWS managed policy for basic Lambda execution.",
207-
appliesTo: [
208-
"Policy::arn:<AWS::Partition>:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
209-
]
178+
reason: "Auto-generated CDK role uses AWS managed policy for basic Lambda execution."
210179
}
211180
]
212181
)
@@ -217,10 +186,7 @@ export const nagSuppressions = (stack: Stack) => {
217186
[
218187
{
219188
id: "AwsSolutions-IAM5",
220-
reason: "Auto-generated CDK role requires wildcard permissions for S3 bucket notifications.",
221-
appliesTo: [
222-
"Resource::*"
223-
]
189+
reason: "Auto-generated CDK role requires wildcard permissions for S3 bucket notifications."
224190
}
225191
]
226192
)

0 commit comments

Comments
 (0)