AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Configure Snyk DeepCode AI to Automatically Generate Pull Request Fixes for Security Vulnerabilities

Boris Graf · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Snyk DeepCode AI—the underlying AI remediation engine powering Snyk Code and Snyk Agent Fix—can automatically generate code-level pull requests to patch security flaws across GitHub, GitLab, Bitbucket, and Azure Repos. Setting it up takes less than fifteen minutes in the Snyk Web UI, but 365Finds has a clear warning for DevSecOps teams: do not turn on unrestricted automatic pull requests across your entire codebase at once. Blindly generating PRs creates notification fatigue and congests CI pipelines.

365Finds recommends a phased deployment: enable Snyk DeepCode AI for pull request checks with inline interactive fixes first, and restrict automated backlog fix PRs to high-priority vulnerabilities with strict rate limits.


Prerequisites Before Enabling AI Fix PRs

Before configuring automated pull request generation, verify that your environment meets these structural requirements:

  1. SCM Integration with Write Permissions: Snyk needs read and write access to your repositories to branch code and submit PRs. If using GitHub, 365Finds strongly advises installing the official Snyk GitHub App rather than relying on personal access tokens (PATs), which tie automation to individual user accounts.
  2. Snyk Code License: DeepCode AI operates on static application security testing (SAST) rules and requires Snyk Code to be enabled for your organization.
  3. Supported Languages: Snyk DeepCode AI supports automated code fixes for major enterprise languages including JavaScript, TypeScript, Python, Java, C#, and Go.

Step 1: Enable Snyk Code and DeepCode AI at the Organization Level

DeepCode AI cannot generate remediation PRs if Snyk Code scanning is disabled at the organization hierarchy.

  1. Log in to the Snyk Web UI.
  2. In the top-left navigation, select your Organization.
  3. Go to Settings (gear icon in the header) > Snyk Code.
  4. Set the toggle for Snyk Code to Enabled.
  5. Save changes. This authorizes Snyk's hybrid AI engine—combining symbolic analysis with security-tuned large language models—to parse your AST (Abstract Syntax Tree) and synthesize patches.

Step 2: Configure SCM Integration Permissions

To allow Snyk DeepCode AI to create branches and open pull requests:

  1. Navigate to Settings > Integrations > Source control (e.g., GitHub, GitHub Enterprise, GitLab, Bitbucket, or Azure Repos).
  2. Click Edit settings for your connected provider.
  3. Verify repository access permissions. Ensure that Snyk is granted write access for Pull Requests/Merge Requests and Repository Contents.

Step 3: Configure Automatic Fix Pull Requests

Snyk handles automated remediation through two primary mechanisms: scheduled scans that automatically open Fix PRs against existing flaws, and PR Checks that evaluate incoming code changes.

Configuring Global Settings

  1. In the Organization Settings menu, select your SCM provider (e.g., GitHub).
  2. Scroll to the Automatic fix pull requests section.
  3. Configure the following toggles:
    • New vulnerabilities: Toggle On. When recurring scans detect a newly exposed vulnerability with an available patch, Snyk opens a PR automatically.
    • Known vulnerabilities (Backlog): Toggle On only if paired with priority scoring. Set the Minimum priority score to at least 700 (High/Critical) to prevent Snyk from opening dozens of low-severity PRs simultaneously.
  4. Set the Maximum open fix pull requests limit (365Finds recommends capping this between 2 and 5 concurrent PRs per repository).
  5. Set your Test & Automated Pull Request Frequency to Daily or Weekly.

Configuring Project-Level Overrides

If specific production services require tighter controls than the organization baseline:

  1. Go to Projects and select the target repository.
  2. Click the Settings tab within that project.
  3. Select the SCM integration tab.
  4. Uncheck Use organization settings to customize PR thresholds, target branches, or disable automated backlog PRs for legacy repositories.

Step 4: Enable In-PR Interactive DeepCode AI Fixes

Automated PRs for backlog debt are useful, but 365Finds considers the in-PR developer loop significantly more valuable. This feature allows developers to remediate newly introduced flaws directly inside their ongoing pull requests before merging to main.

  1. Under your SCM Integration Settings, locate Snyk PR Checks.
  2. Enable Open Source & Code Security PR Checks.
  3. Toggle on Inline code comments / Snyk Agent Fix suggestions.
  4. Once enabled, whenever a developer submits a PR containing a Snyk Code vulnerability, Snyk posts an inline comment on the vulnerable line with an AI-generated patch.
  5. Developers can inspect up to 5 suggested variations and trigger the fix directly from the pull request conversation by replying:
    @snyk /fix
    
    or specifying the desired option:
    @snyk /apply 1
    
    Snyk DeepCode AI will commit the patch directly to the PR branch and re-run its SAST validation scan to confirm the vulnerability is resolved without introducing regressions.

Operational Comparison: Automated Fix PRs vs. In-PR Interactive Fixes

365Finds evaluated both deployment modes across DevSecOps pipelines:

CapabilityAutomatic Fix PRs (Backlog/New Issues)In-PR Interactive Fixes (@snyk /fix)
Trigger EventScheduled recurring scans (e.g., every 24h)Developer opens or updates an SCM pull request
Developer FrictionModerate; creates separate PRs outside active sprint workflowsVery low; resolves flaws inside existing review windows
CI OverheadHigh if backlog limits are not configuredLow; leverages existing PR CI runs
Verification LoopPre-tested by DeepCode AI validation enginePre-tested by DeepCode AI; immediately re-checked by PR Check
365Finds RecommendationRestrict to Critical issues (Score ≥ 700); max 2 PRsEnable across all teams as default workflow

365Finds Evaluation: Safeguards and Trade-offs

DeepCode AI differentiates itself from generic LLM coding assistants by running an automated validation loop: before proposing code, the AI-generated fix is scanned by Snyk's static analysis engine. If the proposed code fails security checks or introduces secondary vulnerabilities, the engine discards it and retries.

However, 365Finds observes two critical constraints that engineering leads must address:

Snyk generates automatic pull requests using the branch naming convention snyk-fix-<short-hash> and signs commits through the configured Snyk App integration identity.

References