in src/lib/utils.ts [72:97]
public visit(node: IConstruct): void {
if (node instanceof Function) {
const res = ((node as Function).node.tryFindChild('ServiceRole')?.node
.tryFindChild('DefaultPolicy')?.node.defaultChild as CfnResource);
const existing = (res?.getMetadata('cfn_nag') as CfnNagMetadata)?.rules_to_suppress || [];
res?.addMetadata('cfn_nag', {
rules_to_suppress: [
{
id: 'W12',
reason: 'wildcard resource is used for x-ray in Lambda Function',
},
...existing,
],
});
} else if (node.node.id == 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a') {
(node.node.findChild('ServiceRole').node.findChild('DefaultPolicy').node
.findChild('Resource') as CfnResource).addMetadata('cfn_nag', {
rules_to_suppress: [
{
id: 'W12',
reason: 'wildcard in policy is built by CDK for Lambda Function for x-ray',
},
],
});
}
}