ministryofjustice / cloud-platform

Documentation on the MoJ cloud platform
MIT License
86 stars 44 forks source link

Use TFSEC in a GitHub Action #2502

Closed jasonBirchall closed 3 years ago

jasonBirchall commented 3 years ago

tfsec uses static analysis of your terraform templates to spot potential security issues.

We could trigger this tool on a PR to main, if it fails the code is not merged.

https://github.com/tfsec/tfsec

davidread commented 3 years ago

My notes on the outcome:

tfsec comes as a binary. Reviewdog provides a GitHub Action. It comments on PRs and optionally be a failed PR check. @jasonBirchall Installed it on cloud-platform-infrastructure. tfsec.yml is for the configuration - e.g. check just what changed or the whole repo. We have 27 warnings and failures:

Maybe would be more useful on the environments repo, since service teams are writing TF now and we review that. Currently there's no way to override - would just get ignored / alert blindness Better to review the errors it has flagged, than installed for all PRs. Maybe we can learn from these best practices it opines.