Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W58 cannot be suppressed #422

Closed
jwtdrjj opened this issue Mar 31, 2020 · 3 comments
Closed

W58 cannot be suppressed #422

jwtdrjj opened this issue Mar 31, 2020 · 3 comments

Comments

@jwtdrjj
Copy link

jwtdrjj commented Mar 31, 2020

I have three AWS::Serverless::Function resources in a template but the lambda role is in a separate stack. CFN-Nag prompts with W58. The lambda role was update to included the CloudWatch logs permissions. CFN-Nag still prompts with W58. I put meta in on the resource and stack and still I get the nag about W58.

CFNCustomProviderDev:
Type: AWS::Serverless::Function
Metadata:
cfn_nag:
rules_to_suppress:
- id: W58
reason: "Lambda Role is in org-iam"

31-Mar-2020 09:02:44 cp_lambda.yml
31-Mar-2020 09:02:44 ------------------------------------------------------------------------------------------------------------------------
31-Mar-2020 09:02:44 | WARN W58
31-Mar-2020 09:02:44 |
31-Mar-2020 09:02:44 | Resources: ["CFNCustomProviderDev", "CFNCustomProviderTst", "CFNCustomProviderPrd"]
31-Mar-2020 09:02:44 | Line Numbers: [-1, -1, -1]
31-Mar-2020 09:02:44 |
31-Mar-2020 09:02:44 | Lambda functions require permission to write CloudWatch Logs
@rbs4ba
Copy link

rbs4ba commented Apr 29, 2020

I'm running into this issue too. The core of the issue as to why the rules_to_suppress isn't working is because the suppression is set for the AWS::Serverless::Function CFNCustomProviderDev and the W58 warning is coming from the AWS::Lambda::Function CFNCustomProviderDev that is created by SAM.

So it seems like there are two problems here:

  1. cfn_nag doesn't seem to be respecting the permissions that are set in a role outside of the template
  2. It's generally pointless to use rules_to_suppress on AWS::Serverless::Function because it's usually the child resources spawned by SAM that have the actual warnings/errors

@PatMyron
Copy link

@arothian
Copy link
Contributor

arothian commented Nov 5, 2020

cfn_nag will pass through the metadata declared on the SAM resource to the transformed function and role for the purposes of allowing warning suppression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants