> For the complete documentation index, see [llms.txt](https://docs.arnica.io/arnica-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast/ai-sast.md).

# AI SAST

Use AI SAST to find security vulnerabilities with large language models on push, on pull request, and during routine scans.

## Summary

AI SAST uses large language models (LLMs) to find security vulnerabilities in source code. It runs alongside Arnica's rule-based [SAST](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast.md) engine and reports its results as regular SAST findings, so they appear on the code risks page and work with the same policies, notifications, and dismissal workflows.

Rule-based SAST matches code against known patterns. AI SAST reads the code the way a reviewer would. It follows data from where it enters the application to where it is used, and checks whether it is sanitized along the way. This lets it find issues that are hard to express as a rule, such as missing authorization checks or business logic flaws, and it scores how confident it is in each finding.

AI SAST also reviews the findings that rule-based SAST reports. It closes false positives, corrects severities to reflect the real risk in your code, and adds context. This cuts the noise from rule-based scanning, so developers spend their time on the findings that matter. See [AI Augmented findings](#ai-augmented-findings).

{% hint style="info" %}
AI SAST is available on the Business and Enterprise plans, using either Arnica-managed AI credits or your own LLM integration. Contact your Arnica account team for details.
{% endhint %}

## How it works

AI SAST runs as part of the SAST scan whenever one of its execution conditions is enabled in the Code Risk policy. If an AI SAST scan fails, the rule-based SAST scan still completes.

### When AI SAST runs

AI SAST has three execution conditions. They are all disabled by default.

| Execution condition | What is scanned                       | Which findings are reported                                 |
| ------------------- | ------------------------------------- | ----------------------------------------------------------- |
| **On Push**         | The pushed commits                    | Only findings on lines added or changed by the push         |
| **On Pull Request** | The source branch of the pull request | Only findings on lines added or changed in the pull request |
| **On Routine Scan** | The whole repository                  | All findings                                                |

On push and on pull request, AI SAST still reads the surrounding code for context, but it reports only issues on lines the developer changed. A change that only deletes lines produces no AI SAST findings.

Routine scans keep track of which files were already analyzed. On later scans, AI SAST analyzes only files that changed, or files whose related files changed. A repository with no new commits since the last scan is not analyzed again, and its existing findings are kept.

When a later scan no longer reports an AI SAST finding, or the file is no longer in the repository, Arnica resolves the finding automatically.

### Which files are scanned

AI SAST analyzes source code files in recognized programming languages. It skips:

* Documentation and text files, such as `.md`, `.txt`, `.pdf`, and Office documents
* Data and configuration files, such as `.json`, `.yaml`, `.xml`, `.toml`, and `.csv`
* Stylesheets, media files, archives, and binaries
* Minified files
* Dependency and build output folders, such as `node_modules`, `vendor`, `venv`, `dist`, `build`, and `target`
* Infrastructure as Code files, which are covered by [IaC scanning](https://docs.arnica.io/arnica-documentation/code-risks/infrastructure-as-code-security-iac.md)
* Files larger than 500 KiB
* Paths listed in the repository's `.semgrepignore` file

AI SAST doesn't report hardcoded secrets. Arnica reports those through [Secret Detection](https://docs.arnica.io/arnica-documentation/hardcoded-secrets/secret-detection.md).

## Enabling AI SAST

1. Navigate to **Admin** → **Policies**.
2. Open the **Code Risk** policy.
3. In the **AI SAST Execution Conditions** section, enable **On Push**, **On Pull Request**, **On Routine Scan**, or any combination of them.
4. Optionally, add conditions to limit a rule to specific repositories or products.
5. Save the policy.

Each execution condition runs the **Run AI SAST Rules** action, which uses the AI model configured in **Admin** → **AI Configurations**. The execution conditions can't be deleted. Disable them to stop AI SAST.

{% hint style="info" %}
If your tenant doesn't have AI SAST, the **AI SAST Execution Conditions** section is shown as unavailable, with an upgrade option.
{% endhint %}

## Configuring AI SAST

AI SAST settings are on the **Admin** → **AI Configurations** page. The tabs on this page depend on how your tenant uses AI:

* **Arnica-managed AI** — the **AI Credits** tab shows your credit balance, and the **Prompt Configuration** tab holds the global additional prompt.
* **Your own LLM integration** — the **AI Budget** tab sets spending limits, and the **Model Configuration** tab selects the integration and models.

### Additional prompts

An additional prompt is natural-language guidance that Arnica adds to the instructions AI SAST follows. Use it to describe your environment so AI SAST makes fewer mistakes. For example:

```
Handle sensitive data such as PII and PHI securely. Flag any violations.
The security-engineering package performs input sanitization and should be treated as trusted.
```

You can set additional prompts at two levels. Both are combined when a repository is scanned.

* **Global** — applies to every AI SAST scan. Set it in the **Additional Prompt** field on **Admin** → **AI Configurations**, in the **Prompt Configuration** or **Model Configuration** tab.
* **Product** — applies only to repositories in a product. Navigate to **Inventory** → **Products**, open the product, and set the **Additional Prompt** on the **AI SAST** tab.

Each additional prompt can be up to 10,000 characters.

{% hint style="success" %}
Click **Auto Generate** next to an **Additional Prompt** field to create rules from findings your developers have dismissed. See [Developer Feedback Loop](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast/developer-feedback-loop.md).
{% endhint %}

### Using your own LLM integration

If your tenant uses its own LLM provider, first connect it in **Admin** → **Integrations**. AI SAST supports the following providers:

* OpenAI
* Azure OpenAI
* Anthropic
* Amazon Bedrock
* Open Router

Then, on the **Model Configuration** tab, configure:

* **Primary Integration** — the LLM integration used by default for AI SAST scans across your organization.
* **Regular Scan Model** — the default model for code fixes, unless you set a **Code Fix Model**.
* **Deployment Names** — for Azure OpenAI only, the deployment names that map to your models.

Under **Advanced Settings** (optional):

* **Heuristic Scan Model** — the model AI SAST uses to scan code.
* **Code Fix Model** — the model used to suggest fixes. Defaults to the regular scan model.
* **Minimum Confidence** — a value from 0 to 1. Findings below this threshold are dropped. The default is 0.7, which keeps findings with an AI confidence of 3 or higher.

Click **Reset to Defaults** to restore the default models and settings.

On the **AI Budget** tab, set separate budgets for AI SAST and code suggestions. When a budget is used up, AI SAST skips scans until the budget resets or is raised.

## Reviewing AI SAST findings

AI SAST affects two kinds of findings on the code risks page:

* **AI Generated** findings are new vulnerabilities that AI SAST found. Their titles end in **(✨ AI Generated)**. To list them, filter the **Is AI Generated** column.
* **AI Augmented** findings are rule-based findings that AI SAST reviewed and changed. Their titles end in **(✨ AI Augmented)**. To list them, filter the **Is AI Adjusted** column.

### AI Generated findings

Each AI Generated finding includes:

* **Title** — ends in **(✨ AI Generated)**.
* **Rule ID** — in the format `arn.ai.<language>.<category>`, for example `arn.ai.python.injection`.
* **Severity** — Critical, High, Medium, Low, or Info.
* **Description** — what the issue is, how it can be exploited, and how to fix it, followed by the AI confidence score.
* **CWE** — written as `CWE 89: <name>`.
* **OWASP Top 10 category** — such as Injection or Broken Access Control.
* **Data flow** — where the data comes from, how it moves through the code, and where it is used unsafely.

### AI confidence

Every AI SAST finding has an **AI Confidence** score from 1 to 5. The **AI Confidence** column on the code risks page lets you filter by score. Findings without a score are grouped as **Unrated**.

| Score | Meaning                                                           |
| ----- | ----------------------------------------------------------------- |
| 5     | Confirmed exploitable, with a clear flow from source to sink      |
| 4     | High: a clear vulnerability pattern with no sanitization found    |
| 3     | Medium: a suspicious pattern, but the framework may mitigate it   |
| 2     | Low: significant uncertainty that needs verification across files |
| 1     | Minimal: a theoretical risk that is likely a false positive       |

If AI SAST reports the same issue more than once, Arnica keeps the finding with the higher confidence, and then the higher severity.

### AI Augmented findings

Rule-based SAST looks at one file at a time and matches code patterns. It can't tell whether input was already validated in another file, whether an endpoint requires authentication, or whether the flagged code is a test. The result is false positives and severities that don't reflect the real risk.

AI SAST closes that gap. Each time it scans a file, it reviews the open rule-based findings in that file. It reads the flagged code, follows the data back to where it enters the application, and searches the rest of the repository for mitigations such as parameterized queries, output encoding, input validation, authentication middleware, and role checks. Then it decides on one of these outcomes:

| Outcome       | When AI SAST chooses it                                                                                                                                       | What happens to the finding                                                                |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| **Keep**      | The vulnerability is real and the reported severity is accurate.                                                                                              | No change.                                                                                 |
| **Downgrade** | The vulnerability is real, but mitigations limit its impact. For example, the endpoint requires an admin role, or the database user is read-only.             | The severity is lowered.                                                                   |
| **Upgrade**   | User input reaches the vulnerable code with no validation or access control, and the reported severity is too low.                                            | The severity is raised.                                                                    |
| **Close**     | The finding is a false positive. For example, the code uses a safe API, no user-controlled input reaches it, a validator fully covers it, or it is test code. | The finding is dismissed automatically.                                                    |
| **Enrich**    | AI SAST found the same issue as the rule-based finding.                                                                                                       | The finding gets AI SAST's title, description, and data flow, and its severity can change. |

AI SAST bases every decision on evidence in the code, and it explains each one. It doesn't trust comments that claim code is safe. It closes a finding only when the mitigation fully removes the risk. If it's unsure, it keeps the finding.

#### False positives closed by AI

When AI SAST decides a finding is a false positive, Arnica sets its status to **Dismissed Automatically**. The finding's **History** records the dismissal with AI SAST's explanation, followed by **(Marked as false-positive by AI)**. Once a finding is closed this way, AI SAST doesn't review it again.

To review what AI SAST closed, filter the code risks page by **Is AI Adjusted** and the **Dismissed Automatically** status. If you disagree with a decision, reopen the finding.

#### Severity adjusted by AI

When AI SAST changes a finding's severity, the expanded finding shows an **AI-Adjusted Severity** box with the original and the new severity, and the reason for the change. The severity change is also recorded in the finding's **History**.

Policies, SLAs, notifications, and pull request checks use the adjusted severity. For example, a High finding that AI SAST downgrades to Low no longer fails a status check that blocks on High severity.

To keep severities stable between scans, Arnica changes the severity of an AI Augmented finding again only if a later scan differs from it by more than one level.

#### Context enriched by AI

When AI SAST finds the same issue as a rule-based finding, it doesn't report a duplicate. Instead, it improves the existing finding: it replaces the generic rule description with one written for your code, and adds the data flow from source to sink. If only the context changed, the finding's **History** notes that the severity and status were not adjusted.

{% hint style="info" %}
[Additional prompts](#additional-prompts) also guide how AI SAST reviews rule-based findings. For example, telling AI SAST that an internal package sanitizes input helps it close the false positives that the package causes.
{% endhint %}

### Dismissing findings

Dismiss AI SAST findings the same way as any other finding. Dismissals help AI SAST improve: the [Developer Feedback Loop](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast/developer-feedback-loop.md) can turn dismissed findings into additional-prompt rules that prevent similar false positives.

## Using AI SAST in policy rules

Code Risk policy rules have two conditions for AI SAST findings:

* **Is AI SAST** — matches findings detected by AI SAST.
* **AI SAST Confidence** — matches AI SAST findings whose confidence is within a range, from 1 to 5.

For example, to notify developers only about AI SAST findings that are likely to be real, combine **Is AI SAST** with **AI SAST Confidence** set to 4–5.

{% hint style="warning" %}
**AI SAST Confidence** is skipped for findings that weren't detected by AI SAST. To keep a rule limited to AI SAST findings, add **Is AI SAST** to the same **All of** group. See [Code Risk Policy Settings](https://docs.arnica.io/arnica-documentation/code-risks/code-risk-policy-settings.md).
{% endhint %}

## Data handling

To analyze a file, AI SAST sends the file's content and related code to the LLM:

* With **Arnica-managed AI**, code is sent through Arnica to the AI model provider that Arnica uses for AI SAST.
* With **your own LLM integration**, code is sent to the provider you configured, under your agreement with that provider.

For more on how Arnica handles your data, see [Data Handling](https://docs.arnica.io/arnica-documentation/security/data-handling.md).

## Related

* [Static Application Security Testing (SAST)](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast.md)
* [Custom SAST Rules](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast/custom-sast-rules.md)
* [Developer Feedback Loop](https://docs.arnica.io/arnica-documentation/code-risks/static-application-security-testing-sast/developer-feedback-loop.md)
* [Code Risk Policy Settings](https://docs.arnica.io/arnica-documentation/code-risks/code-risk-policy-settings.md)
