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] Unit test shoud support invoking a rule that has an argument #333

Open
fabiodouek opened this issue Feb 19, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@fabiodouek
Copy link

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

I'm creating cfn-guard rules for evaluating Resource Policies. I will use these rules from different entry points: CloudFormation and AWS Config. This means that the extraction path from these two use cases will be different.
However the Resource policy evaluation on the statements will be the exact same.
For this reason I've created rules with arguments to evaluate the policy.

However, I'm not able to do unit tests on rules that expect an argument.

Describe the solution you'd like

In the unit test file, I would like to be able to specify the argument, where this will be the value in the input. A nice feature would be if we could specify the extraction path such as $this/PolicyDocument

expectations:
rules:
check_principal_deny($this)

Describe alternatives you've considered

The alternative at the moment is to have tests duplicated from different extraction points, which makes hard to unit test and maintain it

@fabiodouek fabiodouek added the enhancement New feature or request label Feb 19, 2023
@joshfried-aws
Copy link
Contributor

Hi @fabiodouek thanks for creating this issue. This is a solid idea. We will continue to track this and update it when appropriate.

Thanks

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

No branches or pull requests

2 participants