All writing

Let the model sort, not decide: LLM triage for SAST and DAST findings

By Landon Mayo,

How I use language models to cut thousands of scanner findings down to the handful that matter, and the guardrails that keep a confident model from closing a real bug.

Every scanner I've run in the last decade has the same problem. It isn't missing bugs. It's burying them. Run Semgrep, AppScan, and a DAST pass across a mid-sized codebase and you can easily end up with a few thousand findings. Most are noise. A handful are the ones an attacker would use.

The job is finding that handful before the team gives up on the whole report. That's where I've started using LLMs, and where I've learned to keep them on a short leash.

The problem is volume, not detection

Static analysis flags patterns. It doesn't know whether the input is attacker-controlled, whether a sanitizer three files away already handles it, or whether the code path is even reachable. DAST tells you something responded strangely, not why. So a human has to read each finding, trace the data, and decide.

That human gets tired around finding number 200. Developers learn to ignore the report. The real SQL injection sits in row 1,412 next to forty duplicates of the same informational warning.

Where a model actually helps

A language model is good at reading code in context and summarizing what it sees. That maps to the tedious middle of triage:

Where it doesn't

A model will tell you, with total confidence, that a framework auto-escapes output when it doesn't. It will invent a sanitizer that isn't there. It doesn't know your threat model, your compensating controls, or what the business would lose.

So it never gets the final word. It ranks. It explains. A person who can exploit the bug decides.

The workflow I use

This is the order I run it in. Each step feeds the next.

  1. Normalize. Pull every tool's output into SARIF, or a common JSON shape, so findings can be compared at all.
  2. Deduplicate. Collapse obvious duplicates by rule, file, and line before anything goes near a model. It's cheaper and it cuts noise in the prompt.
  3. Ask structured questions. For each remaining finding, send the code context and trace, and require a structured answer instead of prose.
  4. Rank. Sort by the model's reachability and input-control answers, weighted by my own severity rules.
  5. Validate by hand. Work the top of the list with Burp Suite and manual exploitation. Confirmed issues get written up with evidence.
  6. Write the fix notes. Use the model to draft developer-facing remediation, then edit it.

The structured answer is what makes this workable. Here's the shape I ask for:

{
  "finding_id": "semgrep:python.django.security.injection.sql",
  "reachable_from_request": "yes | no | unclear",
  "input_attacker_controlled": "yes | no | unclear",
  "sanitization_observed": "none | partial | sufficient",
  "evidence": "the exact lines that support each answer",
  "proof_idea": "a request or payload that would demonstrate it",
  "confidence": "low | medium | high"
}

Forcing "unclear" as an option matters. Without it, the model picks yes or no and sounds sure about it. "Unclear" goes straight to a human.

Guardrails I don't skip

Catch it before it ships

Triage is cheaper when there's less to triage. Running Semgrep on every pull request keeps new issues from piling up. A minimal GitHub Actions job looks like this:

name: semgrep
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    container: semgrep/semgrep
    steps:
      - uses: actions/checkout@v4
      - run: semgrep scan --config auto --sarif --output semgrep.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: semgrep.sarif

Findings land in the pull request, while the author still remembers the code.

If you're starting out

Pick one repository. Run your scanners, then run the model triage, and keep score: how many findings the model called likely noise turned out to be real. That number tells you how much to trust it on your code. Keep a human on the critical path the whole time.

The model makes the pile smaller. It doesn't make the decision.

Landon Mayo is an application security engineer and penetration tester in Spring, Texas, and the author of the OWASP entry on Unrestricted File Upload. Email him or connect on LinkedIn.