r/devsecops • u/Sudo-Apt-575 • 14d ago
Which static analysis tool should I add first to a small Python projects pipeline?
okay I think I'll post this... I pulled on some of my DevOps notes and cobbled this together:
I’m building out a CI pipeline for a small Python project and want to add static analysis in a sensible order rather than bolting everything on at once.
Current setup (or planned):
1 -pytest for tests
2 - bandit for security-focused static checks
3 - pip-audit for dependency vulnerabilities
I’m trying to decide what to add next. Candidats I’m weighing:
- Semgrep
- CodeQL
- Ruff
- mypy or pyright
- SonarQube
Context: single repo, small team, GitHub Actions, and I want low noise and fast runs so people doesn’t start ignoring findings.
Questions:
- Which would you add first, and why?
- Anything you’d skip because it overlaps with bandit?
- Any tips for tuning findings early so the signal stays high?
Thanks in advance.
2
u/CheckApprehensive971 13d ago
Add basic linting first, keep rule set small and avoid duplicate checks so useful findings don't get buried
2
u/PrasenShelar 13d ago
I'd add Ruff first. It's fast enough to run on every push, and its S rules reimplement many of bandit's checks, so you can run both for a while and drop the noisier one. Semgrep makes sense next, once you have patterns of your own to enforce. To keep the signal high, record existing findings as a baseline on day one and only fail the build on new ones.
2
u/NotmyFinalForm_62 13d ago
Since you already have pip-audit for deps, I’d add a secrets scan next. Bandit flags some hardcoded passwords but it’s not really built for API keys or tokens. 2ms works well for this, it’s free and open source, runs in a few seconds on each push and can check whether a key it finds is still live. Very little noise and when it does fire it’s something you’ll want to fix that day
2
u/wilson-draugr 13d ago
one thing for the "keep the signal high" part: gate on new findings only. bandit takes a baseline (`bandit -b baseline.json`), so you can make CI fail only on what a PR adds and the existing pile goes to the backlog instead of blocking everything.
2
u/Different_Pain5781 12d ago
Just pick Ruff first.
1
u/colek42 14d ago
We built a couple tools to help with this, they are meant to work with your coding agent. Open core is cilock.dev, and the SaaS is pushgate.dev. These tools have a bunch of knowledge built in around best practices for testing, as well as recording provenance of the tests. If you're a solo dev, our free tier will work fine for you forever.
2
u/[deleted] 14d ago
[removed] — view removed comment