Static analysis matches patterns against your application’s own source code (a SQL statement built from string concatenation, eval() on untrusted input, TLS verification disabled in code) rather than against a package list (vulnerability scanning) or a declared resource (infrastructure scanning). It runs as part of a repository scan, and it is off until you configure it. Every check this page describes is in the check catalogue, and has its own page, with what it reads, why it matters and how to fix it, at trustivan.com/checks.

Enabling it

Setting SAST_RULES alone is not enough: the analyser this feature runs is a separate program, and it is deliberately not installed in the published trustowl-backend image (see below). With no working analyser, the worker reports static analysis as disabled at startup and in /system/status rather than failing every repository scan. See Troubleshooting scans.
/app/rules/sast is TRUSTIVAN’s own vendored ruleset, already present in the published image (just YAML pattern files; see below for why those ship even though the analyser does not). Point SAST_RULES at your own path instead, or a directory, to run additional or different rules.

Turning it on for an organization

A deployment that can run static analysis still runs it only for an organization that selects it, because its finding volume follows the ruleset. An administrator turns it on in Settings → Data and evidence → Repository scanners (tick Static analysis (SAST) and save), or over the API:
A deployment that cannot run the analyser refuses sast with 400 rather than storing a setting that would never apply.

Why the analyser is not in the published image

The static-analysis engine (Semgrep) is licensed LGPL-2.1-or-later, and this product’s licence gate treats that as strong copyleft, so the published trustowl-backend image carries none, by policy, and that stays true here. Instead, backend/Dockerfile.sast is a build recipe: the published image, plus a pinned Semgrep and git, that you build yourself. Building it is an explicit choice about the licence terms you are accepting for your own deployment, rather than a decision made silently on your behalf:
Run the worker from trustowl-backend:sast with SAST_RULES set, and repository scans that request sast will run it. The API image can stay the published one, because only the worker needs the analyser.

Language coverage

The vendored ruleset is first-party: every rule was written for TRUSTIVAN, and none is copied from another ruleset. It holds 315 rules, 129 of them taint-mode, in nine rule files. Languages: Go, Python, JavaScript, TypeScript, Java, C#, PHP, Ruby, Kotlin. The JavaScript rules run on TypeScript files too. The TypeScript-only rules add the Next.js request surfaces (route handlers, server actions, pages), which the JavaScript rules’ Express-style sources do not cover, so the two do not report the same flow twice.

Taint rules

A taint rule reports only when a value read from the HTTP request reaches a dangerous call without passing through a sanitiser the rule knows. Every language has one for each of these classes: Most languages also have taint rules for open redirect (CWE-601), code and template injection (CWE-94, CWE-1336), LDAP (CWE-90), XPath (CWE-643), NoSQL (CWE-943) and regular-expression injection (CWE-1333); JavaScript and TypeScript add prototype pollution (CWE-1321), and Java, C# and Kotlin add expression-language and reflection injection. The request sources each language’s rules recognise:

Pattern rules

The other rules match a shape in the code without tracking where a value came from: weak hashes, ciphers, key sizes and password-hash work factors, predictable random numbers used for secrets, disabled TLS or host-key verification, unsafe XML parser settings, unverified or “none” JSON Web Tokens, permissive CORS with credentials, disabled CSRF protection, mass assignment (permit!, $request->all(), TryUpdateModelAsync without a property list), missing cookie flags, debug pages left on, and SQL built by string concatenation or interpolation even where no request value is visible in the same function. 18 rules detect a credential written in the source (a JWT signing key, a framework secret key, a database or basic-auth password). These are reported as secret findings, so the matched line is redacted rather than stored as a code snippet, and they appear only when the scan requests the secret scanner.

AI and LLM code

Thirteen rules look at code that calls a language model. Each maps to the OWASP Top 10 for LLM Applications 2025 ID in its metadata: What these rules do not cover:
  • They are static. No prompt is sent to any model. This is not an LLM penetration test: whether a deployed model can actually be talked out of its instructions is not tested.
  • The inventory sees imports. A provider called over plain HTTP, or through an SDK not listed above, is not reported.
  • The output-handling rule follows a value inside one function, like the other taint rules. Model output returned from a helper and used elsewhere is not reported.
  • Hard-coded AI provider keys (OpenAI, Anthropic, Hugging Face, Cohere, Google) are found by the secret scanner, not by these rules.
  • System-prompt leakage, data and model poisoning, vector-store weaknesses and misinformation (LLM02, LLM04, LLM07, LLM08, LLM09) have no rule.

How the rules are verified

Each rule has a vulnerable fixture it must report and a safe fixture it must not (backend/rules/sast-fixtures/). Beside them is a precision corpus of three to five files per language of idiomatic, safe framework code (parameterised queries, an ORM, an escaping template engine, the framework’s default CSRF and cookie settings) on which no rule may report anything. TestSASTRulesetFixtures in backend/internal/e2e/sast_ruleset_e2e_test.go runs the real analyser over all of it and fails on a missed fixture, a fired safe fixture, or any finding in the corpus. Writing the corpus found four false positives in the rules, which were fixed before release (for example, gin’s c.Query("name") had been treated as a SQL call). Two tests that need no analyser fail when a rule lacks its fixtures, its CWE, its OWASP category or its fix guidance, and when the counts and the language list on this page differ from the rule files (TestSASTRuleCountIsDocumented). That is the extent of the evidence. The corpus is code written to be idiomatic, not a sample of real repositories, and the rules have not been measured for precision or recall against real repositories, so expect both false positives and misses, and see the limits below.

Getting findings onto a pull request

Two ways, both carrying the rule id, the file and line range, and the rule’s remediation:
  • Pull request checks. With a GitHub or GitLab connection, TRUSTIVAN scans both commits of a pull request and reports the findings the change introduces: as line annotations on a GitHub check run, or listed in a GitLab merge request note. Static-analysis findings use the same check as every other scanner, when the organization has static analysis selected. See Pull request checks.
  • SARIF. Export a scan’s findings as SARIF 2.1.0 and upload the file to your code host. See Findings on pull requests with SARIF.

What you get without the analyser image

No static analysis. None of the 315 rules runs on a deployment using the published image, because the only engine that runs them is the analyser the image leaves out (see above). There is no reduced built-in rule set: a smaller, weaker engine that reported “no findings” would be indistinguishable from a clean codebase. Dependency, secret, misconfiguration, licence and SBOM scanning are unaffected. You can see which case you are in:
  • Settings → Data and evidence → Repository scanners shows Static analysis (SAST) disabled, with the reason, when the deployment cannot run it.
  • GET /api/v1/settings/scanners returns available, the scanners this deployment can run; sast is absent without the analyser.
  • /system/status reports static analysis as down when SAST_RULES is set but the analyser is missing.
Every static-analysis finding comes from that one analyser and records the ruleset it was checked against (ruleset_version, below). Findings of the other kinds come from the dependency and configuration scanner, so a finding’s kind tells you which engine produced it.

The ruleset version

Every static-analysis finding carries a ruleset_version: a content digest of the rule files that produced it, visible on the finding’s evidence in the dashboard and the API. It answers “was this checked against the current rules” without naming the analyser. It changes only when a rule’s content changes, never on an ordinary rescan, and it is evidence rather than identity: editing a rule does not re-open or duplicate findings it already produced.

Suppressing a finding

Two ways, at different scopes:
  • Inline, at the match. Add a // nosemgrep: <rule-id> (or the language’s own comment syntax) on the matched line, or a bare // nosemgrep to suppress every rule there. The analyser drops the match before it ever reaches TRUSTIVAN, and the comment itself, reviewed in the same commit that introduced it, is the audit trail.
  • After the fact, in TRUSTIVAN. Suppress the finding from its detail page or the findings list, with a required reason and an optional expiry. This works the same way for every finding kind; see Findings and their lifecycle.

What this does not cover

Said explicitly, because a scanner that is silent about its own gaps reads as having none:
  • Taint tracking stops at the function boundary. The open-source analyser follows a value inside one function. A request value passed to another function and used dangerously there is not reported by the taint rules. There is no cross-file dataflow.
  • Only web request accessors are taint sources. Command-line arguments, environment variables, files and message queues are not. A framework that is not in the sources table above produces no taint findings.
  • Nine languages. There are no first-party rules for Swift, Scala, Rust, Dart, C or C++, and none for infrastructure files beyond what the infrastructure scanner covers.
  • No per-tenant custom rules. SAST_RULES is one deployment-wide configuration; there is no UI or API to add a rule per organization.
  • SARIF is export only. TRUSTIVAN does not import a SARIF file produced by another tool.
  • No autofix, and no inline review comments posted by TRUSTIVAN. Findings reach a pull request through your code host’s own SARIF ingestion; the policy gate can post one summary comment.
  • Registry rule packs stay off by default (SAST_REGISTRY_ENABLED=false). Semgrep’s own hosted packs carry licence terms of their own to evaluate before enabling them, and a registry fetch makes a scan’s ruleset depend on what a third party served that day: the opposite of a reproducible verdict.

Next

  • Scanning: worker placement, concurrency, and the registry policy that governs every scan target.
  • Troubleshooting scans: what /system/status says when the analyser is configured but not installed.