Static analysis (SAST)
Know what a source scan checks, in which languages, with which engine, and how much evidence stands behind each finding. Then run one, read it, and set the gate that fits you.
Before you start
Section titled “Before you start”- The Keryn CLI (install), or Keryn Web to scan a folder, zip or repository in the browser.
- A repository. Everything below runs on your machine; the scan reads files and sends nothing anywhere.
- The proof ladder, for what the proof levels mean.
The two engines
Section titled “The two engines”A scan runs two engines over the same files, one after the other.
| Engine | What it does | Where it runs |
|---|---|---|
| Pattern engine | Matches rules against the syntax tree of each file: patterns, taint rules (a source reaching a sink inside one file), and the metavariable and pattern-either/pattern-not forms of Semgrep rule syntax. It is written in TypeScript and checked against Semgrep CE 1.157 on the rule fixtures. |
Everywhere Keryn runs, including the browser. |
| Deep | Builds a call graph and follows data from sources to sinks, across files and through return values. It is a Rust engine, run as WebAssembly. | After the pattern engine, in a CLI scan. If Deep cannot run in Keryn Web, the Results view says so and gives the reason. |
The pattern engine reports a pattern finding at proof level 1, or a same-file path at level 2. Deep reports cross-file paths at level 3. keryn scan runs Deep after the pattern engine and hands it the pattern engine’s facts. --no-deep skips Deep and keeps pattern rules only.
Semgrep CE parity is about rule syntax: rules written for Semgrep run on the pattern engine, and keryn rules lint tells you before a scan which parts of a rule the engine can run. It does not mean every Semgrep result is reproduced. Rules the pattern engine cannot run completely are counted as unsupported or partial in the coverage line, and the scan exits with 3 unless you pass --allow-incomplete.
Languages
Section titled “Languages”The pattern engine parses these languages and file types:
- Application code: TypeScript, JavaScript, Python, Java, C#, Go, Rust, PHP, Kotlin, Swift, Ruby, C, C++, Bash, Scala, Solidity, Dart, Lua, OCaml, Julia and R.
- Configuration and markup: JSON, YAML, HCL (Terraform), XML, HTML and Dockerfiles. A Helm chart template is not YAML until it is rendered, and no rule matches it as written: on main, a scan counts chart templates as not analysed and is incomplete. Render first (
helm template <release> <chart> > rendered.yaml) and scan the output; Keryn does not run Helm.
The bundled rule library targets Python, TypeScript, JavaScript, Java, C#, Go, Rust, PHP, Kotlin, Swift, Ruby, C, C++, Bash, JSON, YAML, HCL, Dockerfile and language-independent text patterns. A language the pattern engine parses but no bundled rule targets (Scala, Dart and the others in the list) is read by your own custom rules only.
Deep’s reach differs by language. For Python and TypeScript/JavaScript it follows imports, re-exports, return values and subclass overrides across files. For Java, C# and Go it follows return values and subtype calls under the same caps but resolves an import one level deep. C and C++ follow a quoted #include one level. Other languages are analysed within one file. The exact caps are in what Keryn does not do.
Current browser build
Section titled “Current browser build”The manually deployed browser build includes newer JavaScript/TypeScript Node checks and conservative Rails project applicability. Type assertions, non-null expressions and satisfies retain the underlying runtime expression for analysis. Dynamic call shapes and reference-tool semantics still have gaps; see the ESLint and Brakeman location comparisons. Their scan failures and incomplete cases remain failures even when observed locations happen to agree.
The capability map separates this browser deployment from installed releases and native-engine research. The rule catalog describes the currently published rule metadata.
The rule library
Section titled “The rule library”The rule catalog lists the current bundled rule metadata and source version. Installed releases can carry an older library; use their own version and coverage report. Most rules are about AI applications: prompt and tool injection, model output reaching a shell, query or template, agent permissions, MCP servers, secrets in prompts. Some are general-purpose:
- Request input reaching a dangerous call, for Java, Kotlin, C#, Go and Swift: path traversal, SQL injection, command injection, server-side request forgery, cross-site scripting, and CSRF protection turned off (an audit). Packs:
general-injection-java-v1,-kotlin-v1,-csharp-v1,-go-v1and-swift-v1. - Zip slip: an archive entry name used as a path, for Java, Kotlin, C# and Go.
Every rule says its severity, its confidence (P0 exploitable as written, P1 dangerous in context, P2 a heuristic or posture check) and its false-positive risk. keryn explain <rule-id> prints them offline, with the message, remediation and references; detection patterns are never shown.
keryn explain seceng.agentcfg.allow-bash-unrestricted1. Scan and see how much evidence each finding has
Section titled “1. Scan and see how much evidence each finding has”keryn scan . --verbose --fail-on none--verbose lists each finding with its proof rung and, from rung 3, the flow. --fail-on none keeps the exit code at 0 so you can read before you gate. Write the formats your tools read with --sarif, --json, --markdown, --junit and the others in output formats.
2. Read what Deep said about a pattern finding
Section titled “2. Read what Deep said about a pattern finding”After both engines ran, Keryn compares them on each pattern finding. Deep records its answer in the finding, and every output shows it next to the proof level:
- confirmed by Deep: Deep proved a flow from untrusted data to this sink. The finding takes Deep’s proof level and trace.
- needs review: Deep found no data flow to it: Deep ran, models this sink and language, and found no flow. This is only applied to rules whose false-positive risk is medium or high, because those depend on the flow. The finding stays in the report and does not count toward the default gate. An exact-API rule (low false-positive risk) stands on its own.
- Nothing is added when Deep did not run, does not model the sink, or the language is one it does not follow. That is not the same as “no flow”.
The report’s deep summary counts both (“2 confirmed by Deep, 3 need review”). Deep’s corroboration covers Python, TypeScript, JavaScript, Java, C# and Go files.
Compare a scan with Deep to one without it:
keryn scan . --verbose --fail-on none --no-deep3. Decide what gates
Section titled “3. Decide what gates”By default a finding counts toward --fail-on when its rule is P0 or P1 and its false-positive risk is not high, or when it is proven at proof level 3 or above. audit and inventory findings (a control is missing, a capability exists) are reported and never fail a run. Widen or narrow it:
keryn scan . --fail-on none --gate-confidence P2--gate-confidence P2 also counts the lower-confidence rules and the “needs review” findings. --fail-on error|warning|info|none sets the severity at which the scan fails (default error). A suppression you record is kept in the repository, see suppressions.
What the numbers say
Section titled “What the numbers say”On the November 2026 held-out split, the request-to-sink rule round found 15 of 83 scored pairs, up from 13. JavaScript accounted for both new detections, rising from 1 to 3 of 15. TypeScript stayed at 3 of 29 and Python at 9 of 42. The number of detections that also fired on the fixed code rose from 10 of 13 to 12 of 15. These are the baseline and round-two results in the rules repository receipts scoreboard-2026-11-18-engines-base-holdout-jstspy.json and scoreboard-2026-11-18-engines-r2-holdout-jstspy.json.
Pattern findings often survive the fix, and Deep is how Keryn reduces that. The figures below come from Keryn’s real-fix benchmark (582 pairs of vulnerable and fixed code from advisories, 565 scorable), scored on defect rules with findings of 10 lines or less. The question is how often a rule that found the vulnerable code also fires on the fixed code.
| Detecting findings (61 pairs found; “gating” under the default gate of 0.5.2) | Count | Still fire on the fixed code |
|---|---|---|
| confirmed by Deep, gating | 16 | 4 (25%) |
| confirmed by Deep, rule marked low confidence | 15 | 7 (47%) |
| Deep found no flow (“needs review”) | 49 | 20 (41%) |
| not checked by Deep, gating | 22 | 14 (64%) |
Source: the 2026-11-07 precision round, receipt scoreboard-2026-11-07-after1-deep-gating.json in the rules repository. Two honest limits come with it. The benchmark is a mix of AI-specific and general projects, and the general ones are the weak side: recall on general vulnerabilities is low, see what Keryn does not do. And several rules were corrected by reading that benchmark’s diffs, so for those rules it is no longer a held-out measurement.
What you just proved
Section titled “What you just proved”You know which engine produced each finding and how much evidence stands behind it: a pattern, a path in a file, a path across files, or a pattern that Deep confirmed or could not confirm. A scan that says “no findings” means the rules that ran found nothing in the languages they cover. The coverage line says which rules ran.
Limits
Section titled “Limits”- General (non-AI) static analysis recall is low, and a clean scan is not a statement that code is safe.
- The pattern engine and Deep are static. Neither runs your code. A path they report is a reading of the code, not an exploit.
- Deep’s no-flow answer is a statement about what Deep models. It does not clear the finding.
- Bundled rules are mostly about AI applications and the agent surface around them. Languages with few rules (Rust, Ruby, C, C++, Bash) get little coverage from the library.
- Rules of your own: write your own rules.
- What a finding means: the proof ladder.
- Dependencies, secrets and binaries: software composition analysis, secrets, binary analysis.
- Gate it in the pipeline: Add Keryn to CI.