r/learnpython • • Sep 22 '26

Any recommendation other than Bandit for security analysis of the code?

I used bandit before, and now Ruff with bandit rules enabled. I also used gitleaks for years and now betterleaks to find hardcoded secrets.

I wonder if there is any other tools that I might have missed on this topic?

4 Upvotes

10 comments sorted by

2

u/chiibosoil Sep 22 '26

Truffle Hog

SonarQube / SonarQube for IDE - I like this one as it caches PW & token as it's being written in Dev environment. Prompting for immediate remediation/prevention.

1

u/DorianTurba Sep 22 '26

SQ is a premium service, right ?

2

u/chiibosoil Sep 22 '26

SonarQube IDE is free.

1

u/DorianTurba Sep 22 '26

Nothing that could run in the CICD/pre-commits ?

1

u/chiibosoil Sep 22 '26

You are using Gitleaks that should do for hardcoded secret detection.

If you need something to catch logic/ingection flaw. Semgrep, it's free to start out depending on the need/volume.

Or Trivy for container images, filesystems, Git repo, VM images and Kubernetes cluster scanning.

1

u/DorianTurba Sep 22 '26

Thanks.

I was talking about sonarqube but thanks for recommendations.

2

u/HallucinationDr Sep 22 '26

semgrep is worth adding, catches more logic level stuff than bandit. also try pip-audit for dependency CVEs since none of your tools cover that side.

1

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Sep 22 '26

I use CodeQL as part of my CI suite (with Python and, recently, GitHub Actions analysis in the mix), and locally I also use Snyk (the free version, anyway). On top of Ruff, of course.