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

feat(cloudformation): enrich cloudformation cloudsplaining inspected key line #6590

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

maxamel
Copy link
Contributor

@maxamel maxamel commented Jul 22, 2024

This PR adds capability for cloudformation cloudsplaining to mark inspected_key_line for exposing of error lines.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

@maxamel maxamel changed the title add experimental commit feat(cloudformation): add experimental commit Jul 23, 2024
@maxamel maxamel changed the title feat(cloudformation): add experimental commit feat(cloudformation): enrich cloudformation cloudsplaining inspected key line Jul 23, 2024
@maxamel maxamel marked this pull request as ready for review July 23, 2024 12:02
@@ -42,7 +42,7 @@ jobs:
id: changed-files-specific
uses: tj-actions/changed-files@eaf854ef0c266753e1abec356dcf17d92695b251 # v44
with:
files: tests/cloudformation/checks/resource/aws/**/*
files: tests/cloudformation/checks/resource/aws/example*/**/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it won't run cfn-lint of python files which exist in: tests/cloudformation/checks/resource/aws/

if fnmatch.fnmatch(violating_action, action): # found the violating action in our list of actions
action_line = self.extract_action_line(statement.statement, action)
if action_line > 0:
self.inspected_key_line = action_line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we have only one inspected_key_line in a resource?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be one inspected key line per violation. This field gets copied to the record, which then gets put in the report.

Copy link
Contributor

@lirshindalman lirshindalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

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

Successfully merging this pull request may close these issues.

3 participants