Skip to main content
Pattern-based SAST rules cannot express every class of vulnerability. You can run a SAST scan with an AI detection agent to identify security vulnerabilities that traditional rule-based SAST cannot express. Endor Labs’ AI SAST detection agent reads your source code directly and uses a large language model (LLM) with full-repository context. It finds issues that pattern-based rules miss, such as multi-step logic flaws and context-dependent authorization issues. It also finds bugs that only become exploitable when functions combine across files. The detection agent generates new findings directly and labels each finding with an AI finding tag. Findings that pass the agent’s validation also have the True Positive finding tag. The detection agent doesn’t report findings whose only issue is a hardcoded secret, and it redacts secret values in finding text. See Secrets scanning to find hardcoded secrets. Each finding includes the vulnerable code location and a data flow trace from source to sink. It also includes an attack vector, an assessment of security controls, and a CWE classification with severity based on your application’s context. High and critical findings show an exploit reproduction in place of the attack vector, and also include remediation guidance. To improve detection results, you can add AI context rules that give the agent codebase-specific guidance to read during the scan. See Improve AI SAST results with context to use rules and feedback before and after a scan. To run an AI SAST detection agent scan:
  1. Enable the AI SAST - Detection rule in finding policies.
  2. Run the following command.
To view the findings generated by the AI detection agent scan, see View AI SAST detection agent findings.

Language support

The AI SAST detection agent supports the following languages:
  • C
  • C++
  • C#
  • Go
  • IaC YAML
  • Gosu
  • Java
  • JavaScript
  • Kotlin
  • Python
  • Ruby
  • Rust
  • Scala
  • Swift
  • TypeScript

Scan AI agent skills

Beyond application source code, the AI SAST detection agent analyzes AI agent skill files, such as SKILL.md, AGENTS.md, and CLAUDE.md, for security weaknesses. The instructions and supporting scripts that a skill directs an agent to run can introduce risk on their own. The agent therefore treats these files as scan targets rather than configuration. The detection agent flags skill issues such as:
  • Unsafe shell command construction in supporting scripts.
  • Plaintext secret or token handling in skill instructions.
  • Risky external installs, such as pulling @latest from an untrusted source.
Skill scanning produces SAST findings labeled with the AI finding tag, the same as findings from application code. It is distinct from skill scoring, which discovers installed skills and assigns a risk score rather than generating findings.

Files the detection agent skips

The detection agent skips code that you don’t maintain or that isn’t part of your application, so findings focus on your own source. It skips the following files by default:
  • Test files.
  • Mock code. This covers folders named mock, mocks, or __mocks__, folders whose names end in mock, mocks, Mock, or Mocks, such as apimocks or ApiMock, and the files mock.go, mock_*.go, *_mock.go, *.mock.ts, and *.mock.js.
  • Gradle build output under build/intermediates, build/generated, build/kspCaches, and build/tmp. Other files under build/ folders are still scanned, because some projects keep source code in a folder named build.
  • Vendored and third-party code, such as node_modules, vendor, third_party, 3rdparty, _deps, site-packages, and Pods folders.
  • Copies of third-party JavaScript libraries in your repository.
  • Generated code, such as protocol buffer, gRPC, and other generated source files, and the files listed in an OpenAPI Generator .openapi-generator/FILES manifest. To turn off generated code detection, set ENDOR_AI_SAST_DISABLE_GENERATED_CODE_DETECTION=true.
  • Source files over 2 MB, other files over 256 KB, and minified or data files over 64 KB that have long lines.
  • Lock files, minified JavaScript bundles, and documentation files such as *.md and *.txt. The agent still scans AI agent skill files, as described in Scan AI agent skills.

AI detection process

The AI detection agent uses a large language model (LLM) with full-repository context to systematically discover vulnerabilities.
1

Index the repository

Scan the entire codebase and build a semantically searchable representation. The agent generates file hashes, function hashes, and embeddings to capture the intent of every function. It stores them with metadata such as callers and file locations. Maximum coverage at this stage minimizes false negatives later in the pipeline.If the scan runs with the --disable-code-snippet-storage flag, the stored embeddings exclude source code excerpts. They keep function metadata such as the name, file path, summary, data flow, and security role. Functions indexed before you set the flag keep their excerpts until the function changes.
2

Analyze application context

Read deployment files such as Dockerfiles, Kubernetes manifests, and CI configurations to understand the application’s exposure and the framework mitigations in place. Skip files that cannot produce SAST findings, such as non-executable files. The agent uses these prioritization signals to focus security analysis on the functions that matter.
3

Run security analysis

Review the behavior of prioritized code using LLM-based reasoning with full-repository context. The agent traces reachability to confirm whether code actually calls the vulnerable paths. It follows source-to-sink chains across functions and files, and detects sanitizers or other stopping logic that may prevent exploitation.
4

Generate findings

Emit confirmed vulnerabilities as new findings labeled with the AI finding tag and treated as true positives. Each finding includes an attack vector that names the entry point, what the attacker controls, and the impact.
5

Classify findings

Map each finding to a CWE and assign a severity based on the context of the application rather than the CWE category alone. An AI context rule can set or limit the severity. The agent doesn’t assign CWEs that MITRE prohibits for vulnerability mapping.
6

Add exploit and remediation details

For high and critical findings, replace the attack vector with a concrete exploit payload and reproduction steps. Also generate a code-change diff that fixes the vulnerable code. If this step fails, the agent keeps the finding without these details.

AI SAST on merge-to-main scans

A scan tagged merge-to-main runs AI SAST only after the target branch has a completed AI SAST index. Until then, the scan skips AI SAST and logs Skipping ai-sast scan - merge-to-main scan: the target branch has no completed AI SAST index yet. A scheduled scan of the target branch builds the first index, and later merge-to-main scans run AI SAST.

View AI SAST detection agent findings

The AI detection agent generates new SAST findings by identifying security vulnerabilities beyond traditional rule-based detection. The agent labels each finding with an AI finding tag, the CWE associated with the vulnerability, and a severity based on the application context. To view AI SAST detection agent findings:
  1. Select Findings > SAST from the left sidebar.
  2. Use the Attributes filter and select Yes under the AI SAST filter to view findings generated by the AI detection agent. To view only the findings that the agent validated, select True Positive under AI Analysis.
  3. Select a finding.
  4. Select Info to view the agent’s analysis and supporting evidence for the finding. A section appears only when the agent produced content for it.
    • First Introduced: When the finding was first introduced.
    • Project: The project that contains the finding.
    • Summary: An agent-generated title and an explanation of the vulnerability, including the affected function, the untrusted input it consumes, and the potential impact.
    • Code: The vulnerable code location, with the file path, line numbers, and the relevant code snippet.
    • Data Flow: A trace of the issue across the code locations involved. Each stage has a role label and shows the location, a short description, and the relevant code snippet. A finding can have more than one stage of the same role.
      • Source: Where untrusted input enters the application.
      • Propagation: How the code passes or transforms the input as it moves toward the sink.
      • Sink: Where the input reaches the vulnerable operation.
    • Security Controls: The controls relevant to the finding, with the number of controls shown next to the section name. Each control shows a status of Present, Missing, Weak, or N/A and a short rationale that can link to the relevant code. The specific controls depend on the vulnerability, such as input validation, sanitization, secrets management, or access control.
    • Attack Vector: How an attacker reaches the vulnerability, what the attacker controls, and the impact. High and critical findings show an exploit reproduction instead.
    • Verification Scorecard: Each criterion the agent verified, the evidence drawn from the code, and the resulting verdict such as confirmed, refuted, or not applicable.
    • Score Vector: The Severity line with the severity of the finding and the reason for it. The agent sets the severity from the impact that it confirmed during validation. An AI context rule that covers the finding decides the severity. Findings from earlier scans can show an older format with seven scoring factors and a numeric score. The refresh of findings updates the severity of a stored finding but not this section. The severity in the older text can then differ from the severity of the finding. The severity at the top of the finding is current.
    • Validation Outcome: Why the agent could not confirm or refute the finding. It appears only on findings that validation left inconclusive.
    • Metadata: Classification details such as the CWE ID, affected languages, and SAST tags applied to the finding.
    For findings with high or critical severity, the agent also provides an exploit reproduction and remediation guidance. If a scan runs with the --disable-code-snippet-storage flag, the agent does not generate exploit reproduction or remediation.
  5. Select Exploit to view the exploit reproduction.
    • Exploit Path: The chain of code locations an attacker traverses from the entry point through propagation to the vulnerable sink.
    • Impact: The security impact of the exploit, such as its effect on confidentiality, integrity, and availability.
    • Steps to Reproduce: Ordered steps that trigger the vulnerability.
    • Bash Script: A runnable script that reproduces the exploit. It appears only when an attacker can trigger the issue directly, such as with an HTTP request, a CLI command, or a crafted file.
    • Concrete Values: The specific raw and encoded values used to reproduce the exploit. It appears only when the Bash Script appears.
    An attacker cannot trigger some issues directly, such as logic flaws, resource exhaustion, or configuration-dependent issues. For these, Steps to Reproduce ends with a short explanation of why no script applies. Exploit reproduction
  6. Select Remediation to view a short explanation of the recommended fix and a unified diff that applies it. To triage findings and apply approved fixes with an agent, use the AI SAST Remediation agent in the Agents Hub. Remediation guidance

OWASP Top 10 for LLM Applications tags

Endor Labs adds SAST tags, such as OWASP-Top-10 and SANS-Top-25, to each finding based on its CWEs. A finding also has the OWASP-LLM-Top-10 tag and the matching OWASP Top 10 for LLM Applications 2026 entry tags when one of its CWEs appears in the following table. Rule-based SAST rules that list these CWEs also get these tags. Only these AI-specific CWEs have the OWASP LLM tags. Other CWEs that OWASP lists for an entry, such as CWE-200, do not, because they also occur outside AI applications. To act on these findings, enter OWASP-LLM-Top-10 or an entry tag such as LLM01:2026 in the SAST Tag field of an action policy or an exception policy.

Give feedback on AI SAST findings

After you review a finding, tell the detection agent whether its analysis was correct. The agent reads the feedback on a project’s findings during later scans, together with your AI context rules. It uses the feedback to confirm similar vulnerabilities and dismiss similar false positives. When feedback and an AI context rule disagree, the rule takes precedence. A thumbs down whose comment disputes only the severity or the wording does not make the agent treat the finding as a false positive. To give feedback on an AI SAST finding:
  1. Select Findings > SAST from the left sidebar.
  2. Select an AI SAST finding to open the finding details panel.
  3. Select a feedback button at the top of the panel.
    • Give positive feedback (thumbs up): Confirms that the analysis is correct. Endor Labs saves the feedback immediately.
    • Give negative feedback (thumbs down): Reports that the analysis is wrong. Endor Labs opens the Report an Incorrect Result dialog.
    Feedback buttons in the AI SAST finding details panel
  4. If you selected thumbs down, enter a comment of up to 1,024 characters that explains what the analysis got wrong, and select Save.
You can also give feedback from the full finding page that opens when you select View Details. Each finding holds one feedback entry. Select the other button to replace the existing feedback, or select the highlighted button again to remove it. To give or remove feedback, you need a role that can create and delete feedback, such as Admin or Code Scanner. Roles without this permission, such as Read-only and Policy Editor, see the buttons disabled. See Authorization roles. The agent picks up new feedback on the next default branch scan that analyzes the code. A scheduled scan of an unchanged commit only refreshes findings and keeps the earlier feedback. To pick up feedback without a new commit, run a default branch scan from CI/CD or with endorctl. PR scans and diff scans use the feedback from the most recent default branch scan.

Refresh of findings

By default, a stored finding keeps its verdict until a scan re-evaluates the function that produced it. The refresh re-evaluates stored findings on the default branch during default branch scans. This keeps them aligned with your current code and guidance. The refresh is on by default and runs on every scan of the default branch, even when the code has not changed since the last scan. This includes scheduled scans, scans that you start yourself, and scans that run when a pull request merges. It does not run on PR scans, --diff-scope scans, or dry runs. To turn it off for a project, add ENDOR_SCAN_AI_SAST_REFRESH=false to the additional environment variables of the project’s scan profile. On each default branch scan, the agent re-evaluates a finding when any of the following conditions is true:
  • The code the finding depends on has changed. This covers the vulnerable function, its data flow regions, and the functions it calls.
  • Your AI context rules or reviewer feedback has changed since the agent last evaluated the finding.
  • The agent last evaluated the finding more than 30 days ago. Set ENDOR_SCAN_AI_SAST_REFRESH_INTERVAL to change this interval, for example 168h for seven days.
Within the scan’s time limit, the refresh processes findings whose code changed first. Among the rest, it processes the oldest findings first. Findings that are not due keep their verdict. The agent deletes a finding after two consecutive default branch scans confirm it as fixed or dismiss it based on your AI context rules or the automatic context. Any other verdict resets the count. Each scan deletes at most 25 findings. Later scans delete the findings above this limit. A broad rule that dismisses hundreds of findings can take many scans to clear them. To guard against a failed scan, a scan can block all deletions. The check counts the verdicts on findings that aren’t already waiting for deletion. It blocks deletions when more than 90% of these verdicts report the finding as fixed or dismissed. The check applies only when the scan gives at least 20 such verdicts. Dismissals that follow a change to your rules or feedback don’t count toward this check. A blocked scan deletes nothing and doesn’t count toward the two consecutive scans. A scan skips the refresh when the checkout doesn’t contain the default-branch commit. It also skips the refresh when the default branch moves to a newer commit before the refresh starts. If the default branch moves while the refresh runs, the refresh stops early. It keeps the updates that it already saved and deletes no findings. A full detection scan works differently. It deletes stored findings that it does not detect again in a single scan.