> For the complete documentation index, see [llms.txt](https://docs.heeler.com/mrecEO40m5D6bt7Pq5pE/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.heeler.com/mrecEO40m5D6bt7Pq5pE/prevent/pr-guardrails/guardrail-types/sast-guardrails.md).

# SAST Guardrails

Gate a pull request on new source-code findings the branch introduces.

SAST guardrails gate a PR on **new source-code findings the branch introduces**. Heeler compares the branch's SAST results against the repository's **default-branch baseline**, so only findings the change actually adds can fire — your existing backlog never blocks a PR.

SAST uses the `Code` entity, so a SAST guardrail is **dedicated** — it can't be combined with dependency or hygiene rules.

## Conditions

Match the findings you care about with any combination of:

| Filter         | Values                                                                                                                                      |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Severity**   | Critical, High, Medium, Low, Info                                                                                                           |
| **Confidence** | High, Medium, Low                                                                                                                           |
| **Category**   | Injection, Cross-Site Attacks, Cryptography, Access Control, Data Exposure, Deserialization, AI/LLM Security, Supply Chain, Availability, … |
| **Rule ID**    | Target specific detections                                                                                                                  |

{% hint style="warning" %}
**Baseline required.** A SAST guardrail needs a completed SAST scan of the repository's **default branch** to establish the baseline before it can enforce. It's evaluated once per repository (not per code root).
{% endhint %}

{% hint style="info" %}
**On GitLab, a CI pipeline is required.** Heeler waits for a CI pipeline to run on the commit before it scans a merge request. A repository with **no pipeline** won't be evaluated — a minimal `.gitlab-ci.yml` is enough to enable scanning.
{% endhint %}

## What developers see on the PR

When a SAST guardrail matches, the findings render **inline on the pull request** — each with its severity, rule, and message, a **source → sink data-flow summary** and flow path, the **suggested fix**, and **CWE/OWASP** references. Findings that share the same source are **grouped** into one entry that lists all the sinks, so a single tainted input doesn't spam the PR with duplicates.

Actions and scope work the same as every guardrail — **Observe / Warn / Block** across the standard [scope model](/mrecEO40m5D6bt7Pq5pE/prevent/pr-guardrails.md#scope-where-each-guardrail-applies).

## Auto-fix on the pull request

Beyond the suggested fix, an eligible SAST guardrail violation can be **auto-fixed on the pull request**: Heeler applies a targeted source-code change — for example parameterizing a query, escaping output, allowlisting input, or normalizing a path — to the PR's own branch, runs build validation, and re-evaluates the guardrail, all on the pull request. The **guardrail summary shows how many matched SAST findings are auto-fixable**, and each qualifying finding carries an **Auto-Fixable** marker.

Unlike dependency auto-fix (a version upgrade), a SAST auto-fix is a code transform gated on a high-confidence, deterministic fix; findings without one are routed to manual review. See [Guardrail Auto-Fix](/mrecEO40m5D6bt7Pq5pE/prevent/pr-guardrails/guardrail-auto-fix.md) and [SAST Auto-Fix](/mrecEO40m5D6bt7Pq5pE/fix/sast-auto-fix.md).

## Related

* [Guardrail Types](/mrecEO40m5D6bt7Pq5pE/prevent/pr-guardrails/guardrail-types.md) — the other rule families and the shared scope model.
* [Code Security (SAST)](/mrecEO40m5D6bt7Pq5pE/findings/code-security-sast.md) — how these findings are detected and scored.
* [SAST Auto-Fix](/mrecEO40m5D6bt7Pq5pE/fix/sast-auto-fix.md) — the code change Heeler generates for a finding.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.heeler.com/mrecEO40m5D6bt7Pq5pE/prevent/pr-guardrails/guardrail-types/sast-guardrails.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
