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: add tfsec-checkgen test-check command to test custom check against tf test code #1436

Merged

Conversation

gabrielleecredera
Copy link
Contributor

  • new command tfsec-checktest test-check <custom_check_file> -p <pass.tf> -f <fail.tf>
  • number of --pass/-p/--fail/-f flags are optional and variable
  • had to modify the internal custom package to expose functions
  • subcommand test-check used to prep for future test-checks command that runs tests against more than one custom check files

partially solves #1415

@owenrumney
Copy link
Contributor

Could this be added as an additional command to tfsec-checkgen?

@gabrielleecredera
Copy link
Contributor Author

gabrielleecredera commented Jan 30, 2022

I added it as a new command as I think I've seen somewhere that the original purpose of checkgen is to generate custom checks? I'm not sure if that vision is still true tho, let me know if adding it into checkgen is preferred. :)
(unrelated: if the vision is still true, what's the solution expected to look like? some cli q&a to generate a custom check file?)

@owenrumney
Copy link
Contributor

I added it as a new command as I think I've seen somewhere that the original purpose of checkgen is to generate custom checks? I'm not sure if that vision is still true tho, let me know if adding it into checkgen is preferred. :) (unrelated: if the vision is still true, what's the solution expected to look like? some cli q&a to generate a custom check file?)

Yeah, lets stick with it being part of checkgen since its all the same sort of thing.

In answer to the other question, before we moved to defsec we had tfsec-skeleton which asked you a number of questions about services, required labels, required resources. I think it would do similar to that.... I think there is only so far we can go with automating the generation of custom checks so it will be a bit trial and error

…nst tf test code

- new sub-command `tfsec-checkgen test-check <custom_check_file> -p <pass.tf> -f <fail.tf>`
- number of --pass/-p/--fail/-f flags are optional and variable
- had to modify the internal custom package to expose functions
- subcommand `test-check` used to prep for future `test-checks` command that runs tests against more than one custom check files

partially solves #1415
@gabrielleecredera gabrielleecredera changed the title feat: add tfsec-checktest command to test custom check against tf test code feat: add tfsec-checkgen test-check command to test custom check against tf test code Jan 31, 2022
owenrumney
owenrumney previously approved these changes Feb 7, 2022
Copy link
Contributor

@owenrumney owenrumney left a comment

Choose a reason for hiding this comment

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

Thanks again @gabrielleecredera - your contributions are really appreciated ❤️

@owenrumney
Copy link
Contributor

hey @gabrielleecredera - looks like a goimports issue breaking the build

@gabrielleecredera
Copy link
Contributor Author

hey @gabrielleecredera - looks like a goimports issue breaking the build

apologies, forgot to add the fixed file to the merge commit haha

@owenrumney owenrumney merged commit e488e5e into aquasecurity:master Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants