Autofix creates a GitHub branch, applies the changes, and opens a draft pull request (PR). You remain in full control over reviewing and merging the PR.Documentation Index
Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt
Use this file to discover all available pages before exploring further.
INFOAutofix is different from Rule-defined fix and Semgrep Multimodal’s Suggested fix. These are separate features with different behaviors and use cases.
Prerequisites
NOTEAutofix is available only for GitHub Cloud repositories.
- Enable Semgrep Multimodal.
- Accept AWS Bedrock or Anthropic’s Claude models.
- During beta, Semgrep Code does not respect AI model selection.
- Have at least one GitHub Cloud repository with new or existing Semgrep Code findings.
- Ensure the Semgrep private GitHub App is installed.
- The app is installed when you add GitHub repositories to Semgrep Managed Scans.
- Verify that the app is connected by navigating to Semgrep AppSec Platform > Settings > Source code managers.
- Ensure that your GitHub App has
Contents: Read and writepermissions configured.- Note that the
Contents: Read and writerepository permission is separate from the permissions shown on the GitHub App overview page. You must explicitly set permissions > Contents under Developer Settings > GitHub Apps. This setting is not enabled automatically by the other read/write permissions listed for the app.
- Note that the
Expand for instructions on granting read and write access to a private GitHub Semgrep app
Expand for instructions on granting read and write access to a private GitHub Semgrep app
If you are an existing Semgrep user and you need to change
your Semgrep app’s permissions:
In GitHub, navigate to Settings > Developer Settings. You should see your Semgrep App listed in the GitHub Apps tab.
Next, navigate back to the main GitHub Settings page. One way to do so is by clicking Settings in GitHub’s website breadcrumbs.
In the Applications tab, locate the Semgrep app under the Installed GitHub Apps tab.
Use Autofix
Log in to Semgrep AppSec Platform
Identify the finding you want to Autofix and click the hyperlink on the card to navigate to the finding’s Details page.
You will see the following message:
Starting to generate Autofix PR. Semgrep is generating an Autofix PR for this finding. A new notification will appear here when the PR is ready.
In 2 to 10 minutes, Semgrep generates a proposed fix and opens a draft PR in GitHub.
- This action is recorded in the Activity section at the bottom of the finding’s Details page.
PR details
- The pull request is opened as a draft.
- Semgrep provides an AI-generated description of the changes in the pull request.
- The pull request is authored by the Semgrep GitHub App.
- If your GitHub account is connected to Semgrep, you are automatically mentioned in the pull request.
Findings with open PRs on Semgrep AppSec Platform
You can filter for findings with Autofix PRs directly from the Code page in Semgrep AppSec Platform. Click the To fix drop-down and select To fix to do so. This filter shows findings that have Autofix PRs. It may also include findings that were manually marked as To fix.Disable Autofix
If you use Semgrep Multimodal, Autofix is enabled by default. To adjust settings:Sign in to Semgrep AppSec Platform