SAST has two parts: Secret Scanning: TruffleHog
Git Hook is run locally just before a git event like commit or push. Not good because cannot be automated on CI and admins can remove them.
Code Analysis: Bandit
Best Practices:
- Tested the tools locally before embedding in the pipeline
- Ensured the scans finish within 10 minutes
- Ensured they each run in their own jobs
- We saved the output in a file
- We didn’t fail the builds
Gospel:
- Maintain cordial relationships with Developers/QA and Operation teams
- Do not fail builds unless you are at maturity level 3 or 4
- Do not run any tool which takes more than 10 minutes in CI/CD pipelines
- Create separate jobs for each tool/scan
- Roll out tools/scans in phases (iteratively) even when critical/high severity issues are found
- Do not buy tools that does not provide APIs or CLIs
- Love the vendor who does per-use licensing model with all your heart, soul, mind and strength
- Verify if the tool vendors support incremental/baseline scans
- Create SAST/DAST custom rule sets. Tools are of no use without creating custom rules/tweaks down the line
- Do Everything as Code (EaC) to provide the audit-ability, measurability, and security
- Do False Positives as Code to control scope of the scans
- Link tool wiki in the pipeline as a comment for sharing your team’s expertise with others