Secure at Inception with Snyk Studio

To prevent the introduction of security issues during code generation, Snyk outlines a set of directives that enable you to scale custom rules at the company level for securing code at inception. Snyk also provides an Execution Frequency setting in the IDE that supports issue prevention in AI-generated code.

To learn how to install and configure Snyk Studio in your preferred coding assistant, visit Quickstart guides for Snyk Studio.

Prerequisites

  • An active Snyk user account

  • Access to an Endpoint Management tool, such as JAMF

Validated environments

The functionality documented here has been validated on:

  • OS: macOS

  • MDM: JAMF

  • IDEs: Cursor, VSCode, and Windsurf

Reach out to your Snyk representative for support with enablement if you plan to use Snyk Studio with unvalidated environments, for example, Windows.

Custom rules at scale

Snyk provides the following directives which enable issue prevention and remediation at scale:

  • Run the Snyk Code scanning tool for new first-party code generated.

  • Run the Snyk SCA scanning tool for new dependencies or dependency updates.

  • Run the Snyk IaC scanning tool for new Infrastructure as Code updates.

  • Fix security issues from new or modified code or dependencies using the results context from Snyk.

  • Rescan the code after fixing issues to verify they are resolved and no new issues are introduced.

  • Repeat this process until no issues are found.

Snyk offers reference scripts for deploying the IDE extension on developer machines with default settings. You can customize these scripts as needed.

Snyk recommends leveraging the Snyk IDE extension in order to install and configure Snyk Studio. This is not mandatory. Contact the Snyk account team for other deployment and management options.

Execution frequency setting

Set the frequency of scanning and initiation of fixes for AI-generated code in the VS Code Snyk IDE extension.

Scan and fix initiation frequency settings in the IDE

Configuration at scale

For broad deployment, use an MDM or Endpoint Management tool like JAMF to target MCP configuration to developer devices.

To configure using JAMF, separate targeting for groups and configurations:

  • For machines with Windsurf installed, target the Snyk Windsurf MCP scripts.

  • For machines with Cursor installed, target the Snyk Cursor MCP scripts.

  • For machines where neither is installed, deploy the desired .pkg and configure matching scripts to run after installation.

Configure the MDM to reapply the desired custom rules across all endpoints.

Sample scripts

To configure the IDE and MCP:

  • Ensure that the MCP server shows in the application. In Windsurf, navigate to Windsurf > Settings > Advanced settings > Cascade > MCP Servers > Manage MCPs.

  • Ensure that the user is prompted to trust Snyk. The code scan does not work if trust is not provided.

  • If the Snyk directives are configured, ensure that the rules file snyk_rules.md includes the rules and that Activation Mode is set to Always On.

If you encounter any issues, visit Troubleshooting.

Install the extension and configure the Snyk MCP server

Enable Snyk directives by applying the rules in the Project

Here is an example of the Windsurf.pkg and both Snyk scripts ready to be deployed on devices using JAMF:

Example of the Windsurf.pkg with Snyk scripts

In order for the IDE and the MCP to be properly configured:

  • Check that the MCP server is present. In Windsurf, navigate to Windsurf > Settings > Advanced settings > Cascade > MCP Servers > Manage MCPs.

Manage MCP servers screen in Windsurf
  • Check that the user is prompted to trust Snyk. The code scan does not work if trust is not provided.

  • If Secure at Inception is configured, ensure that the rules file snyk_rules.md includes the rules and that Activation Mode is set to Always On.

Rules file and rules activation mode option in Windsurf

To learn more, visit Troubleshooting for the Snyk MCP.

Last updated

Was this helpful?