Skip to content

Snyk integration

These pages describe v1.0.0; pip install llmsectest gives v1.0.0

The site is built from main, so it can describe a version newer than the one pip install llmsectest gives you. Run llmsectest --version to see what you have. The changelog says what arrived when.

Snyk reads your source code and your dependency manifests. LLMSecTest sends attacks to your running application and reads what comes back. Those are different questions about the same system, so a team that already pays for Snyk still has a blind spot where its LLM answers users, and a team that only runs LLMSecTest learns nothing about the SQL injection three files away from the prompt.

This page wires the two together in one pipeline. Both tools write SARIF 2.1.0, so one dashboard can hold both sets of findings.

What each tool can see

Question Snyk LLMSecTest
Does this source file contain a known-bad pattern? Snyk Code no
Does this dependency carry a published CVE? Snyk Open Source --repo <path> --osv
Does this dependency admit an unvetted future major release? no --repo <path>, offline
Does the deployed app obey an injected instruction? no LLM01 probes
Does it leak its system prompt or a held secret? no LLM08, LLM02 probes
Does it call a privileged action without authorisation? no LLM03 probes
Does a poisoned retrieved document steer it? no LLM09 probes
Does it emit active HTML, SQL or shell content? no LLM10 probes

The right-hand column needs a running endpoint. Point --target app:<url> at the deployment you want tested, in staging or behind a flag in production.

Snyk accepts no findings from outside Snyk

This is the first thing to settle, because it decides the shape of the pipeline.

Snyk's CLI writes SARIF. snyk code test --sarif-file-output=<path> saves it to a file. --report pushes Snyk's own results to the Snyk Web UI. Snyk's documentation describes no route for loading SARIF that another scanner produced, so findings from LLMSecTest stay outside the Snyk UI. The snyk-api-import tool imports Projects from supported sources. Importing a Project is a different act from importing findings. Checked against Snyk's own documentation on 2026-12-01.

So the two tools meet one level up, in whatever reads SARIF from both: GitHub code scanning, GitLab Ultimate's vulnerability report, Jenkins with the Warnings Next Generation plugin, or your own collector. Each tool keeps its own run, its own exit code and its own file.

One GitHub Actions workflow with both

name: security
on: [push, pull_request]

jobs:
  security:
    runs-on: ubuntu-latest
    permissions:
      security-events: write      # both SARIF uploads need this
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.11" }

      # ---- Snyk: the code and the dependency tree -------------------------
      - uses: snyk/actions/setup@master
      - name: Snyk Code
        continue-on-error: true
        env:
          SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
        run: snyk code test --sarif-file-output=results/snyk-code.sarif

      - name: Upload Snyk SARIF
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results/snyk-code.sarif
          category: snyk-code          # keeps the two result sets apart

      # ---- LLMSecTest: the running application ----------------------------
      - run: pip install llmsectest

      - run: ./scripts/start-test-app.sh &

      - name: Wait for the app to answer
        run: |
          for _ in $(seq 1 30); do
            curl -sf http://localhost:8000/health >/dev/null && exit 0
            sleep 2
          done
          echo "the app never came up, so the scan would have nothing to test"
          exit 1

      - name: LLMSecTest
        id: llmsec
        continue-on-error: true
        run: |
          llmsectest --target app:http://localhost:8000/chat \
            --app-prompt prompt.txt \
            --app-secret "${{ secrets.CANARY_SECRET }}" \
            --sarif-output results/llmsectest.sarif \
            --app-timeout 60

      - name: Upload LLMSecTest SARIF
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results/llmsectest.sarif
          category: llmsectest         # a separate category, so neither upload clears the other

      - name: Fail the build on findings
        if: steps.llmsec.outcome == 'failure'
        run: exit 1

Give each upload its own category. GitHub treats a category as one tool's view of the repository and replaces the previous results for that category alone. Two uploads sharing a category leave you with whichever ran last. The first tool's findings then vanish from the Security tab without a word.

continue-on-error on both scans, one gate at the end. Snyk exits 1 on its own findings. LLMSecTest exits non-zero on a finding or on probes it could not deliver. Letting each step record its outcome and deciding afterwards keeps both reports uploaded, whatever either tool found.

Where the two overlap: your dependencies

This is the one layer both tools read, so it is worth knowing what each says.

Snyk Open Source matches your resolved dependency tree against Snyk's vulnerability database and reports known CVEs with fixed versions. LLMSecTest's LLM04 scan reads the manifests themselves and reports structural weakness. Run against this project's own code/ tree it produced eight LLM04 findings, every one of the same shape:

[LLM04] [version range has no upper bound] httpx (pyproject.toml):
'httpx' specifies '>=0.27' with no upper bound, admitting an unvetted
future major release.
  -> Add an upper bound (e.g. 'httpx>=X,<Y') or pin exactly.

That finding has no CVE behind it. It describes a door left open for a release nobody has reviewed, which Snyk reports once the bad version exists and someone files an advisory. Add --osv to query OSV.dev for published advisories against pinned versions. That query brings LLMSecTest's dependency layer closer to Snyk's and needs no key:

llmsectest --repo . --osv --sarif-output results/llmsectest-deps.sarif

Teams with a Snyk licence usually keep Snyk as the CVE authority here and use --repo without --osv for the structural half.

Reading the two reports side by side

Both files are SARIF 2.1.0, so a consumer can merge them. The severity fields differ.

Snyk Code LLMSecTest
SARIF level error for High, warning for Medium, note for Low the probe's own level, warning for a structural LLM04 finding
Numeric severity Snyk's own rating security-severity, a CVSS v4.0 base score per OWASP category
Category tag Snyk rule id and CWE owasp-category, owasp-name, owasp-edition, plus cwe
Compliance mapping not in the SARIF compliance-frameworks and compliance-controls per rule

Snyk Code uses no Critical designation, so its highest SARIF level is error. LLMSecTest carries the CVSS v4.0 base score for the category in security-severity, which GitHub reads to place a finding in its own severity bands. LLM01 Prompt Injection scores 9.2, LLM03 Excessive Agency scores 10.0, LLM07 Misinformation scores 5.3. Run llmsectest --check for the full map.

The compliance properties are the practical difference when an auditor asks. Each LLMSecTest rule carries the frameworks it serves (EU AI Act, NIST AI RMF, ISO/IEC 42001, ISO/IEC 27001, NIST CSF 2.0, SOC 2) and the specific control ids inside them, so one finding answers both "what broke" and "which control that was".

Try it without a Snyk account

The LLMSecTest half of this pipeline runs offline in under a second:

pip install llmsectest
llmsectest --target demo-defended --sarif-output results/llmsectest.sarif

That scans a built-in hardened demo app, exercises seven of the ten OWASP categories and prints which three it skipped and what input each one needs. The resulting SARIF is the same shape your real scan produces, which makes it a cheap way to test the upload step before you point anything at your own application.

GitLab and Jenkins

The same two-scanner pattern works there. The mechanics of each system (one scan per job, artifact handling, reports:sarif needing GitLab Ultimate, recordIssues for Jenkins) are covered in CI/CD integration. Add the Snyk step beside the LLMSecTest step and keep the reports in separate files.