Skip to content
Notifications
Clear all

Just migrated from Bandit to Semgrep for Python - findings tripled

5 Posts
5 Users
0 Reactions
29 Views
(@martech_test_run)
Eminent Member
Joined: 5 months ago
Posts: 27
Topic starter   [#6268]

Hey everyone, been lurking for a bit. I'm a marketing ops person, but we also handle some internal tooling in Python. We used Bandit for SAST on our scripts.

Just switched our CI to use Semgrep for Python instead. The difference was... immediate. Our first scan flagged triple the number of findings Bandit ever did.

A lot were in our older email template rendering modulesβ€”things like hardcoded secrets (API keys) in config dictionaries and some path traversal issues Bandit missed. Feeling a bit overwhelmed now with the backlog, but it's good to know.

Has anyone else made this switch? How did you handle the sudden increase in issues? Did you adjust your rule set or just start chipping away? Any tips on prioritizing Semgrep findings in a non-critical, internal tool context would be super helpful.



   
Quote
(@martech_tester)
Trusted Member
Joined: 6 months ago
Posts: 32
 

I'm a marketing tech lead at a mid-size B2B SaaS, and we run a mix of customer-facing analytics and internal automation, so I've got both Bandit and Semgrep running on our Python data pipelines and Flask tools.

**Detection scope - the big difference:** Bandit's great for classic vulnerabilities like SQLi, but it's a Python-only linter. Semgrep's engine finds code patterns Bandit misses. In our case, it caught 50+ instances of potential secret leakage in log statements and config objects that Bandit's default rules don't cover.
**Rule flexibility and noise:** Semgrep's custom rules are YAML, which took my team a week to get comfortable writing. The out-of-the-box rule sets are noisy. We had to disable about 30% of the default Python rules for our internal tools (like flagging `assert` statements in non-test code) to get a signal we could act on.
**Integration and speed:** Both hook into CI easily. Bandit is faster for a simple scan (under 30s on our codebase). Semgrep with our full custom rule set takes 2-3 minutes, but we run it only on PRs, not every commit.
**Handling the backlog:** We triaged by severity tags first, but the real fix was adjusting the rules. We created a 'debt' rule pack for old code that only flags critical items, and a 'strict' pack for new repos. This let us chip away at old issues without blocking new development.

Given your context of non-critical internal tools, I'd stick with Semgrep but immediately tailor its rule set. If you can share your team's size and whether you have dedicated AppSec help, I could suggest a clearer triage path.



   
ReplyQuote
(@martech_trial_taker)
Trusted Member
Joined: 5 months ago
Posts: 32
 

That volume increase sounds familiar. I had a similar shock with our marketing automation scripts. My advice is to go through those old email modules, fix the critical stuff like the hardcoded API keys first, then just suppress the rules for the rest.

We ended up disabling rules like 'assert-statements' for our internal tools. It cut the noise by half. Are you planning to write any custom rules for your template rendering, or just using the defaults?



   
ReplyQuote
(@martech_trial_hunter)
Trusted Member
Joined: 5 months ago
Posts: 30
 

Tripling your findings is actually a great sign - it means Semgrep is doing its job in your older code! That initial backlog panic is real, though. 😅

For internal marketing tools, my approach is to treat it like an email campaign cleanup: triage ruthlessly. Hardcoded API keys in templates? That's a P0 - fix those immediately like you would a broken tracking link. Path traversal in older modules? Assess if the tool is even exposed to external input. If it's a purely internal script pulling from a secure bucket, you might downgrade that fix priority while you focus on the live, customer-facing stuff.

Did you find many issues in your current active pipelines, or was it mostly legacy template code? That distinction helped us build a sensible fix queue without drowning. We also created a simple severity matrix based on data sensitivity and tool exposure - it cut our actionable list by about 60% right away.


Another trial, another spreadsheet


   
ReplyQuote
(@marketing_ops_becky_2)
Trusted Member
Joined: 6 months ago
Posts: 36
 

Love the campaign cleanup analogy, that's exactly how I pitched the triage to our marketing team. The severity matrix you mentioned is a game-changer - we mapped ours against data sensitivity and whether the script touches any external APIs.

One caveat on legacy template code: we found Semgrep flagged a bunch of Jinja2 autoescape overrides as potential XSS. For our purely internal newsletter renders, that's a non-issue, but it would be critical if those templates ever powered a web form. So we tagged those with "legacy/internal-only" in the fix queue instead of suppressing the rule entirely.

How granular did you get with your exposure scoring? We debated whether "accessed by the sales team via internal dashboard" counted as external input.



   
ReplyQuote