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

[Enhancement] Ability to specify directory with file regex, such as for cdk.out #189

Open
0xjjoyy opened this issue Jul 14, 2021 · 3 comments
Labels
enhancement New feature or request needs-triage This issue or PR still needs to be triaged.

Comments

@0xjjoyy
Copy link
Contributor

0xjjoyy commented Jul 14, 2021

Is your feature request related to a problem? Please describe.

When using cdk, the template files have the suffix "*.template.json". Looking to run cfn-guard for only the cloudformation templates in the cdk.out directory and not all files within the given directory.

Describe the solution you'd like

Either a cdk specific toggle or a flag to support file regex such as ".template.json" or "projectname.template.json"

Describe alternatives you've considered

Would alternatively need to find the templates and then iteratively invoke cfn-guard

Additional context

Add any other context or screenshots about the feature request here.

@0xjjoyy 0xjjoyy added the enhancement New feature or request label Jul 14, 2021
@dannysteenman
Copy link

I'm using cdk pipelines, that means I also have directories within directories containing json templates. So it would also be a good idea to make the finding of files recursive.

@shreyasdamle shreyasdamle added the needs-triage This issue or PR still needs to be triaged. label Nov 15, 2021
@drusellers
Copy link

I originally tried

cfn-guard validate -d ./src/**/*.yaml -r ./policies

But that lead to the error

error: Found argument './src/trust.yaml' which wasn't expected, or isn't valid in this context

USAGE:
    cfn-guard validate --data <data> <--rules <rules>|--payload>

For more information try --help

Why am I doing this?

I co-locate README.md files that help to describe certain components that are being build by the CloudFormation YAML files.

**Work around **

files=$(ls ./src/**/*.yaml)
for file in $files; do
    cfn-guard validate --data "$file" -r ./policies
done

@ericzbeard
Copy link

It would also be good to ignore files, such as .env for Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants