SAST action
Last updated: Nov 11, 2026
The SAST action runs Fluid Attacks' static application security testing scanner in your GitHub Actions workflows. It detects vulnerabilities in your source code on each push and pull request.
If you want, you can attribute the runs to your Fluid Attacks group. For the setup, read Authentication.
Marketplace: fluidattacks/sast-action
Scan modes
You select the scan mode with the scanner_mode input:
scanner_mode | Mode | What is scanned |
|---|---|---|
diff (recommended) | Differential scan | Only files changed relative to the base |
full (default, if omitted) | Full scan | All files in the repository, for all triggers |
Fluid Attacks recommends scanner_mode: diff for push and pull request workflows.
It keeps CI fast and focuses the results on the code under review.
In differential mode, the base depends on the trigger:
| Trigger | Base for comparison |
|---|---|
| Pull request | PR base branch |
| Push to the default branch | Commit before the push (github.event.before) |
| Push to any other branch | Default branch (all changes since it) |
| Any other event (scheduled, manual, ...) | No base: the action runs a full scan |
If no base commit is available (for example, on the first push of a new branch),
the action also runs a full scan.
The action detects the default branch automatically with git remote show origin.
Thus, all branch names (such as main, master, trunk and develop) work without configuration.
Note: In differential mode, if no files changed, the action skips the
scan, sets the skip output to true, and does not produce an output file.
This is expected behavior, not an error.
Setup
1. Create the workflow
Add .github/workflows/sast.yml to your repository:
name: SAST
on:
push:
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: "0 8 * * 1" # optional: weekly full scan every Monday at 8am
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for differential scanning
- uses: fluidattacks/sast-action@<version> # Use latest released version
id: scan
with:
scanner_mode: diff # recommended
# Optional: upload findings to the GitHub Security tab
- name: Upload SARIF
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.scan.outputs.sarif_file }}Note: Replace <version> with the latest release tag. Find it on the Marketplace
page.
fetch-depth: 0gets the full git history. Without it, the action cannot find which files changed relative to the default branch, and differential scans do not work correctly. You can omit it only if you use the defaultscanner_mode: full.upload-sarifis optional. If you use it, run it withif: always(). Thus, the step uploads the results each time, also when the scan step exits with a non-zero code (for example, whenstrict: trueis set).
Warning: Uploading to the Security tab requires GitHub Advanced Security. See GitHub Advanced Security for details.
If you omit scanner_mode, the action scans the full repository on each run.
Without a configuration file, it writes the results to .fluidattacks-sast-results.sarif.
2. (Optional) Add a configuration file
To customize scan paths, output format, or strict mode,
create a YAML configuration file in a location that you select in your repository.
Then, give its path to the action with scan_config_path:
- uses: fluidattacks/sast-action@<version>
id: scan
with:
scan_config_path: .github/sast-config.yamlThe path is relative to the repository root. If the file does not exist at that path, the job fails immediately.
3. Push and run
Commit the workflow file and push. The scan runs automatically on the subsequent push or pull request.
Configuration
When you give scan_config_path, the action uses only that file.
If you do not give it, the action uses the built-in default values:
it scans the full repository (sast.include: [.]) and writes the results to .fluidattacks-sast-results.sarif.
language: EN
strict: false
output:
file_path: results.sarif
format: SARIF
sast:
include:
- .
exclude: # Optional: paths to exclude from scanning
- node_modules
- vendorlanguage— language for vulnerability descriptions in the output (ENfor English,ESfor Spanish).strict— whenfalse, the scanner reports findings but does not fail the pipeline. Set it totrueto break the build when the scanner detects a vulnerability. Thestrictaction input overrides this value.strictness_threshold— optional severity (low,medium,high, orcritical). The scan breaks the build only for vulnerabilities at or above it. Thestrictness_thresholdaction input overrides this value. In an authenticated scan, the minimum CVSS score of your group can make the scan fail only on vulnerabilities at or above that score. For more information, read Platform policy sync and Strict mode.output.file_path— path where the results file is written. When the format isSARIForALL, thesarif_fileaction output also shows this path.output.format—SARIFgives the standard format that GitHub's code scanning API uses. UseCSVfor a report that you can open in a spreadsheet, orALLto generateresults.sarifandresults.csv.sast.include— list of paths that the scanner analyzes. A single.means the full repository.sast.exclude— optional list of paths that the scanner does not analyze.checks— optional list of specific check IDs to run. If you omit it, the scanner runs all checks.
Action inputs
| Input | Required | Default | Description |
|---|---|---|---|
scan_config_path | No | — | Path to the YAML configuration file, relative to the repository root. When omitted, built-in defaults are used. The job fails if the file does not exist. |
scanner_mode | No | full | Scan mode. diff (recommended) scans only the files changed relative to the base branch or PR base. full scans the full repository. |
strict | No | — | true or false. Set it to true to break the build when the scan finds vulnerabilities. It overrides strict in your configuration file. If you omit it, the configuration file decides. For more information, read Strict mode. |
strictness_threshold | No | — | low, medium, high, or critical. Breaks the build only for vulnerabilities at or above this severity. It overrides strictness_threshold in your configuration file. If you omit it, the configuration file decides. For more information, read Strict mode. |
group | No | — | Your Fluid Attacks group. The action gives it to the scanner as --group. For a short-lived OIDC token, the workflow must have the id-token: write permission, and the group must have a trust for the repository. If you give neither this input nor api_token, or the action gets no credentials (for example, in a pull request from a fork), the scan runs without authentication. |
api_token | No | — | Long-lived Group token for workflows that cannot use OIDC. Give it from a secret, for example ${{ secrets.FA_API_TOKEN }}. If you give this input, the action uses it and not OIDC. The token identifies the group, so you do not need the group input. |
Running a differential scan
Use scanner_mode: diff to scan only the files that changed relative to the base.
Set fetch-depth: 0 in the checkout step, so that the git history is available.
For events other than push and pull_request (for example, schedule), the action runs a full scan:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fluidattacks/sast-action@<version>
id: scan
with:
scanner_mode: diffThe default is scanner_mode: full. It scans the full repository for all triggers,
and it does not need fetch-depth: 0.
Action outputs
| Output | Description |
|---|---|
skip | true when the scan was skipped because a diff run found no changed files, false otherwise |
sarif_file | Path to the SARIF results file (only set when output.format is SARIF or ALL) |
vulnerabilities_found | true if the scan found vulnerabilities at or above the threshold that applies, false otherwise |
You can use these outputs in the subsequent workflow steps:
- name: Comment on PR
if: steps.scan.outputs.vulnerabilities_found == 'true'
run: echo "Vulnerabilities detected — check the Security tab."Common scenarios
Monorepo: scan only specific folders
sast:
include:
- services/api/
- services/web/
exclude:
- services/legacy/Use this option if you use the full scanner mode and you want to analyze only some directories.
Strict mode: block merges with vulnerabilities
For common scenarios and troubleshooting, read GitHub Actions.
Troubleshooting
The action fails to detect the default branch
The action runs git remote show origin to detect the default branch.
For this command, the checkout step must have fetch-depth: 0, so that the remote metadata is available.
For common scenarios and troubleshooting, read GitHub Actions.
Read the Marketplace page for all the configuration options and more troubleshooting.
GitHub Actions
Use Fluid Attacks' dedicated GitHub Actions for SAST, SCA, Secret Scan, DAST, and CI Gate to integrate automated security testing into your CI/CD pipeline.
SCA action
Run the Fluid Attacks SCA GitHub Action to find known CVEs in your third-party dependencies on every push and pull request.