SAST tools parse code into a structure they can query (an abstract syntax tree, a control-flow graph or a data-flow graph) and look for patterns associated with vulnerabilities. Simple rules match a single construct: a call to eval(), a hash function known to be weak, TLS verification switched off. More advanced engines perform taint tracking: they follow untrusted input from a source, such as an HTTP parameter, through the program to a dangerous sink, such as a database query, and report a finding only if no sanitiser intervenes. Rules are usually language-specific and are mapped to weakness classes such as CWE identifiers.
How it is used in practice
Because it needs only the code, SAST can run early: in an editor, in a pre-commit hook, or in CI on every change, which is why it is central to shift left. Results are commonly exchanged in SARIF so that code hosts can show them inline. Teams typically start with a small, high-confidence ruleset, gate builds only on those rules, and add rules as they learn which ones their codebase triggers falsely. SAST complements SCA, which covers third-party packages, and DAST, which tests the running application.
Common pitfalls
- False positives. A pattern without data-flow context flags code that is safe; too many of these and developers stop reading the results.
- False negatives. Single-pattern rules miss flaws that span files or functions, and no ruleset covers every weakness class in every language.
- Unpinned rules. If the ruleset changes between runs, a finding can appear or disappear without any code change.
- Suppression without review. Inline ignore comments are useful, but only if they are reviewed like any other change.
How TrustIvan relates to it
SAST ships in TrustIvan as an opt-in part of a repository scan. It runs Semgrep against the configured rules (SAST_RULES); the analyzer is not in the published backend image because of its LGPL license, so you build the provided Dockerfile.sast recipe yourself, and the worker reports static analysis as disabled until a working analyzer is present. The vendored ruleset is first-party: 302 rules across Go, Python, JavaScript, TypeScript, Java, C#, PHP, Ruby and Kotlin, 123 of them taint rules that follow an HTTP request value to a dangerous call such as a SQL query, a shell command or an outbound URL. Its limits are stated in the docs: taint tracking stops at the function boundary, only web request accessors count as sources, there are no rules for languages such as Swift, Rust or C/C++, and there are no per-tenant rules. Every finding records a digest of the ruleset that produced it. Findings can be exported as SARIF 2.1.0 for a code host to annotate a pull request; TrustIvan does not import SARIF or post inline comments itself. See Static analysis (SAST).
Related terms
- DAST (dynamic application security testing) Dynamic application security testing (DAST) examines a running application from the outside, sending crafted requests to its web pages or APIs and analyzing the responses for evidence of vulnerabilities.
- Software composition analysis (SCA) Software composition analysis (SCA) identifies the third-party and open-source components inside an application or artifact, then reports the known vulnerabilities and license obligations attached to each one.
- SARIF (Static Analysis Results Interchange Format) SARIF, the Static Analysis Results Interchange Format, is an OASIS-standard JSON format for the output of static analysis tools: which rules ran, what they found, and where in the code each result is.
- Shift left Shift left is the practice of moving security checks earlier in the software delivery process, into design, coding, pull requests and CI, so that problems are found when they are cheapest and quickest to fix.
- IaC scanning (infrastructure-as-code scanning) Infrastructure-as-code (IaC) scanning analyzes the files that define infrastructure, such as Terraform, CloudFormation, Kubernetes manifests, Helm charts and Dockerfiles, for insecure configuration before it is deployed.
Guides on SAST
- Finding and Rotating Secrets Leaked into Git History A secret deleted in a later commit is still leaked. Scan the whole git history, rotate in the right order, check for use, and know when a rewrite helps.
- TrustIvan vs. Running Trivy Yourself TrustIvan’s detection is Trivy, the same open-source engine anyone can run free. What TrustIvan adds on top, and when running Trivy alone is the right call.
- Policy as Code for Release Gates: Fail Builds on What Matters A release gate that fails on every critical gets switched off. Write a policy that blocks exploited, fixable risk, warns on the rest and explains itself.
On the platform: Container scanning. All glossary terms