Skip to main content

Free trial

Install the plugin, then sign in or sign up for Semgrep, and Guardian checks the next file your agent writes. No credit card is required. The trial is 30 days.Claude Code, Codex, and GitHub Copilot are the recommended setups. Follow the Quickstart.
Sign in to Semgrep AppSec Platform. A notice in the navigation bar shows how many days remain in your trial. The same notice also appears on the Settings > Billing page.
When the free trial ends and you haven’t purchased a license, Guardian stops scanning AI-generated code.
Install the coding agent first. The recommended setups use one of the following:
  • Claude Code (claude command)
  • Codex CLI (codex command)
  • GitHub Copilot CLI (copilot command)
You also need a Semgrep account. After you install the plugin, sign up if you don’t have one, or sign in if you do.Other coding agents are supported too. See Choose your setup.On Windows, the Claude Code and Codex plugins no longer require Windows Subsystem for Linux (WSL). They work in native Windows shells such as PowerShell and Cygwin, as well as in WSL. The GitHub Copilot plugin doesn’t support Windows yet.
Not if you use the Claude Code, Codex, or GitHub Copilot plugin. These plugins use Semgrep’s hosted scanner, and you sign in or sign up for Semgrep through the browser. Install the CLI only for other coding agents, or for the local Claude Code plugin. See Choose your setup.
In Claude Code, start a new session after installing the plugin. You’re prompted to sign in or sign up for Semgrep, and the plugin scans each file Claude Code writes. You can also run claude mcp get plugin:semgrep:guardian and confirm it reports as connected.In Codex, start a new session and sign in or sign up for Semgrep. Ask Codex who you are logged in as in Semgrep Guardian. You can also run codex plugin list --json and confirm the semgrep plugin is listed.In GitHub Copilot, start a new session and ask GitHub Copilot to sign in to Semgrep Guardian. Sign in or sign up for Semgrep in your browser, then ask GitHub Copilot who you are logged in as in Semgrep Guardian. You can also run copilot plugin list --json and confirm the guardian-copilot@semgrep-marketplace plugin is listed.When a scan finds something, Guardian returns the findings to the agent. See the Quickstart.
Review and trust Guardian’s hooks in Codex to enable scans after file writes.
Sign in or sign up once in the browser. New users create an account on that page. Semgrep refreshes access tokens after that.In Codex or GitHub Copilot, ask the agent to sign in to Semgrep Guardian. Claude Code prompts you to sign in when you start a new session. See Authentication.

How Guardian works

Guardian scans files an AI coding agent writes, before that code is committed. It scans with Semgrep Code, Supply Chain, and Secrets to catch vulnerable code patterns, vulnerable dependencies, and hardcoded secrets. See the overview and Rules and configuration.
A hook, or an MCP tool call, scans what the agent just wrote or edited. The scan runs on the developer’s machine at authoring time, not in CI.
No. Guardian returns findings to the agent. The agent decides whether to regenerate the code. If it does, the new code is scanned again.
No. CI and platform scans still run on push, pull request, or a schedule, and they enforce your Policies. Keep running Semgrep in CI. See Set up and deploy scans.
No. Guardian scans code an agent generates before it is committed. The Semgrep Malware Firewall blocks malicious packages when developers install dependencies. After Guardian is installed, developers can run /install-mfw in the agent to install the Malware Firewall.
The Malware Firewall is in private beta. It requires a macOS or Linux terminal or shell. Contact your Semgrep account manager or Semgrep Support to join the beta.

Local PHP version check

Guardian runs php -v to check your local PHP version. If that version is affected by actively exploited vulnerabilities with a public proof of concept, Guardian shows a message that names your version and the version to upgrade to. For example:
PHP 5.4 and later are affected. Upgrade to a fixed release for your PHP branch:PHP 5.4 through 7.3 have no fixed release. Upgrade to one of the branches in the table.For more information, see the PHP security advisory. For the other incidents Guardian checks for, see Semgrep Guardian incident advisories.
Claude Code, Codex, and GitHub Copilot.
Once per coding session, on the first Write, Edit, Bash, PowerShell, or apply_patch call. If your PHP version is affected, Guardian blocks that call so you see the message. Later calls in the same session run normally. The check runs again when you start a new session, including in the same repository.
Guardian skips the check. No error is shown.
Yes. Set the SEMGREP_GUARDIAN_PHP_CHECK environment variable to off in the environment where you start your coding agent, then start a new session:
Turn off the check only if you’ve mitigated the vulnerabilities another way, for example with custom patches on an end-of-life PHP install.

Setup

Claude Code, Codex, and GitHub Copilot are the recommended setups. Other agents are supported too. See Choose your setup.
The paths differ in how you sign in or sign up for Semgrep, whether you need a local CLI, and which rules run. See Choose your setup.
Follow the Quickstart. For the local plugin, see Claude Code setup.
Follow the Quickstart.
For GitHub Copilot CLI, follow the Quickstart. For Copilot in VS Code, see VS Code setup.
Follow the page for your agent under Choose your setup.

Findings and rules

It depends on the setup. The recommended plugins run the guardian-default ruleset plus any rules you add or turn off with Guardian Policies. Other integrations have no Guardian-specific policy available; they pull all rules enabled on Policies. See Rules and configuration.
Yes. Add rules for your whole organization on the Policies page, or add local developer rules in a .semgrep/guardian-rules/ directory. See Customize Guardian rules.
See Rules and configuration for which rules that ruleset includes and why some are left out.
Guardian detects hardcoded secrets using Semgrep Code rules that look for secrets. It doesn’t run the full Semgrep Secrets product, so it doesn’t validate secrets or run all Semgrep Secrets rules.Guardian doesn’t replace Semgrep Secrets. Continue running Semgrep Secrets in CI to detect secrets that Guardian might miss. See Set up and deploy scans.
A CI scan can use rules the recommended plugins don’t run. See Rules and configuration.

Sign-in

Claude Code, Codex, and GitHub Copilot use a one-time browser sign-in or sign-up. Other agents use the CLI. See Authentication.
Where credentials are stored depends on how you signed in. See Authentication.
An existing sign-in can take precedence over another. See Authentication.
Shared tokens aren’t recommended. See Authentication. When a browser sign-in or sign-up isn’t possible, see Enterprise deployment.

Roll out to a team

Yes. Each developer still signs in or signs up for Semgrep after the plugin is installed. See Enterprise deployment.
Semgrep Enterprise has an option for that case. See Enterprise deployment.
Ask in Semgrep’s #mcp Slack community. For deployment questions, see Support.