History
GitLab Advanced SAST is a Static Application Security Testing (SAST) analyzer designed to discover vulnerabilities by performing cross-function and cross-file taint analysis.
GitLab Advanced SAST is an opt-in feature. When it is enabled, the GitLab Advanced SAST analyzer scans all the files of the supported languages, using the GitLab Advanced SAST predefined ruleset. The Semgrep analyzer will not scan these files.
All vulnerabilities identified by the GitLab Advanced SAST analyzer will be reported, including vulnerabilities previously reported by the Semgrep-based analyzer. An automated transition process de-duplicates findings when GitLab Advanced SAST locates the same type of vulnerability in the same location as the Semgrep-based analyzer.
For an overview of GitLab Advanced SAST and how it works, see GitLab Advanced SAST: Accelerating Vulnerability Resolution.
For a product tour, see the GitLab Advanced SAST product tour.
Feature comparison Feature SAST Advanced SAST Depth of Analysis Limited ability to detect complex vulnerabilities; analysis is limited to a single file, and (with limited exceptions) a single function. Detects complex vulnerabilities using cross-file, cross-function taint analysis. Accuracy More likely to create false-positive results due to limited context. Creates fewer false-positive results by using cross-file, cross-function taint analysis to focus on truly exploitable vulnerabilities. Remediation Guidance Vulnerability findings are identified by line number. Detailed code flow view shows how the vulnerability flows through the program, allowing for faster remediation. Works with GitLab Duo Vulnerability Explanation and Vulnerability Resolution Yes. Yes. Language coverage More expansive. More limited. When vulnerabilities are reportedGitLab Advanced SAST uses cross-file, cross-function scanning with taint analysis to trace the flow of user input into the program. By following the paths user inputs take, the analyzer identifies potential points where untrusted data can influence the execution of your application in unsafe ways, ensuring that injection vulnerabilities, such as SQL injection and cross-site scripting (XSS), are detected even when they span multiple functions and files.
To minimize noise, GitLab Advanced SAST only reports taint-based vulnerabilities when there is a verifiable flow that brings untrusted user input source to a sensitive sink. Other products may report vulnerabilities with less validation.
GitLab Advanced SAST is tuned to emphasize input that crosses trust boundaries, like values that are sourced from HTTP requests. The set of untrusted input sources does not include command-line arguments, environment variables, or other inputs that are typically provided by the user operating the program.
For details of which types of vulnerabilities GitLab Advanced SAST detects, see GitLab Advanced SAST CWE coverage.
Transitioning from Semgrep to GitLab Advanced SASTWhen you migrate from Semgrep to GitLab Advanced SAST, an automated transition process deduplicates vulnerabilities. This process links previously detected Semgrep vulnerabilities with corresponding GitLab Advanced SAST findings, replacing them when a match is found.
How vulnerability transition worksAfter enabling Advanced SAST scanning in the default branch (see Enable GitLab Advanced SAST scanning), when a scan runs and detects vulnerabilities, it checks whether any of them should replace existing Semgrep vulnerabilities based on the following conditions.
Conditions for deduplicationMatching Identifier:
bandit.B506
and a Semgrep vulnerability’s primary identifier is also bandit.B506
, this condition is met.Matching Location:
When the conditions are met, the existing Semgrep vulnerability is converted into a GitLab Advanced SAST vulnerability. This updated vulnerability appears in the Vulnerability Report with the following changes:
In some cases, Semgrep vulnerabilities may still appear as duplicates if the deduplication conditions are not met. To resolve this in the Vulnerability Report:
GitLab Advanced SAST supports the following languages with cross-function and cross-file taint analysis:
When analyzing PHP code, GitLab Advanced SAST has the following limitations:
include
, include_once
, require
, require_once
) using variables for file paths are not supported in this release. Only static file inclusion paths are supported for cross-file analysis. See issue 527341.Enable the GitLab Advanced SAST analyzer to discover vulnerabilities in your application by performing cross-function and cross-file taint analysis. You can then adjust its behavior by using CI/CD variables.
Available CI/CD variablesGitLab Advanced SAST can be configured using the following CI/CD variables.
CI/CD variable Default DescriptionGITLAB_ADVANCED_SAST_ENABLED
false
Set to true
to enable GitLab Advanced SAST scanning, or false
to disable. Requirements
Like other GitLab SAST analyzers, the GitLab Advanced SAST analyzer requires a runner and a CI/CD pipeline; see SAST requirements for details.
On GitLab Self-Managed, you must also use a GitLab version that supports GitLab Advanced SAST:
GitLab Advanced SAST is included in the standard GitLab SAST CI/CD template, but isn’t yet enabled by default. To enable it, set the CI/CD variable GITLAB_ADVANCED_SAST_ENABLED
to true
. You can set this variable in different ways depending on how you manage your CI/CD configuration.
If you’ve already enabled GitLab SAST scanning in your project, add a CI/CD variable to enable GitLab Advanced SAST.
This minimal YAML file includes the stable SAST template and enables GitLab Advanced SAST:
include:
- template: Jobs/SAST.gitlab-ci.yml
variables:
GITLAB_ADVANCED_SAST_ENABLED: 'true'
Enforce it in a Scan Execution Policy
To enable GitLab Advanced SAST in a Scan Execution Policy, update your policy’s scan action to set the CI/CD variable GITLAB_ADVANCED_SAST_ENABLED
to true
. You can set this variable by:
variables
object in the scan action.To enable GitLab Advanced SAST by using the pipeline editor:
In your project, select Build > Pipeline editor.
If no .gitlab-ci.yml
file exists, select Configure pipeline, then delete the example content.
Update the CI/CD configuration to:
Jobs/SAST.gitlab-ci.yml
.Jobs/SAST.latest.gitlab-ci.yml
. Don’t mix latest and stable templates in a single project.GITLAB_ADVANCED_SAST_ENABLED
to true
.See the minimal YAML example.
Select the Validate tab, then select Validate pipeline.
The message Simulation completed successfully confirms the file is valid.
Select the Edit tab.
Complete the fields. Do not use the default branch for the Branch field.
Select the Start a new merge request with these changes checkbox, then select Commit changes.
Complete the fields according to your standard workflow, then select Create merge request.
Review and edit the merge request according to your standard workflow, then select Merge.
Pipelines now include a GitLab Advanced SAST job.
Disable GitLab Advanced SAST scanningAdvanced SAST scanning is not enabled by default, but it may be enabled at the group level or in another way that affects multiple projects.
To explicitly disable Advanced SAST scanning in a project, set the CI/CD variable GITLAB_ADVANCED_SAST_ENABLED
to false
. You can set this variable anywhere you can configure CI/CD variables, including the same ways you can enable Advanced SAST scanning.
History
For specific types of vulnerabilities, GitLab Advanced SAST provides code flow information. A vulnerability’s code flow is the path the data takes from the user input (source) to the vulnerable line of code (sink), through all assignments, manipulation, and sanitization. This information helps you understand and evaluate the vulnerability’s context, impact, and risk. Code flow information is available for vulnerabilities that are detected by tracing input from a source to a sink, including:
The code flow information is shown the Code flow tab and includes:
You can disable GitLab Advanced SAST rules or edit their metadata, just as you can other analyzers. For details, see Customize rulesets.
Request source code of LGPL-licensed components in GitLab Advanced SASTTo request information about the source code of LGPL-licensed components in GitLab Advanced SAST, contact GitLab Support.
To ensure a quick response, include the GitLab Advanced SAST analyzer version in your request.
Because this feature is only available at the Ultimate tier, you must be associated with an organization with that level of support entitlement.
FeedbackFeel free to add your feedback in the dedicated issue 466322.
TroubleshootingWhen working with GitLab Advanced SAST, you might encounter the following issues.
Slow scans or timeouts with Advanced SASTBecause Advanced SAST scans your program in detail, scans can sometimes take a long time to complete, especially for large repositories. If you’re experiencing performance issues, consider following the recommendations here.
Reduce scan time by excluding filesBecause each file is analyzed against all applicable rules, you can reduce the number of files scanned to decrease scan time. To do this, use the SAST_EXCLUDED_PATHS variable to exclude folders that do not need to be scanned. Effective exclusions vary, but might include:
node_modules/
Multi-core scanning is enabled by default in the Advanced SAST (analyzer version v1.1.10 and later). You can increase the runner size to make more resources available for scanning. For self-hosted runners, you may need to customize the --multi-core
flag in the security scanner configuration.
If you’ve followed these optimization steps and your Advanced SAST scan is still running longer than expected, reach out to GitLab Support for further assistance with the following information:
To identify the GitLab Advanced SAST analyzer version:
gitlab-advanced-sast
job.GitLab GitLab Advanced SAST analyzer
.You should find the version at the end of line with that string. For example:
[INFO] [GitLab Advanced SAST] [2025-01-24T15:51:03Z] ▶ GitLab GitLab Advanced SAST analyzer v1.1.1
In this example, the version is 1.1.1
.
To generate the trace.ctf
artifact, add the following to your .gitlab-ci.yml
.
Set RUNNER_SCRIPT_TIMEOUT
to at least 10 minutes shorter than timeout
to ensure the artifact has time to upload.
include:
- template: Jobs/SAST.gitlab-ci.yml
variables:
GITLAB_ADVANCED_SAST_ENABLED: 'true'
MEMTRACE: 'trace.ctf'
DISABLE_MULTI_CORE: true # Disable multi core when collecting memtrace
gitlab-advanced-sast:
artifacts:
paths:
- '**/trace.ctf' # Collects all trace.ctf files generated by this job
expire_in: 1 week # Sets retention for artifacts
when: always # Ensures artifact export even if the job fails
variables:
RUNNER_SCRIPT_TIMEOUT: 50m
timeout: 1h
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4