back to home

snyk / cli

Snyk CLI scans and monitors your projects for security vulnerabilities.

5,455 stars
673 forks
121 issues
TypeScriptCGo

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing snyk/cli in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/snyk/cli)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Getting started with the Snyk CLI Introduction to Snyk and the Snyk CLI Snyk is a developer-first, cloud-native security tool to scan and monitor your software development projects for security vulnerabilities. Snyk scans multiple content types for security issues: • Snyk Open Source: Find and automatically fix open-source vulnerabilities • Snyk Code: Find and fix vulnerabilities in your application code in real time • Snyk Container: Find and fix vulnerabilities in container images and Kubernetes applications • Snyk IaC: Find and fix insecure configurations in Terraform and Kubernetes code Learn more about what Snyk can do and sign up for a free account. The Snyk CLI brings the functionality of Snyk into your development workflow. You can run the CLI locally from the command line or in an IDE. You can also run the CLI in your CI/CD pipeline. The following shows an example of Snyk CLI test command output. Snyk CLI test command output example Snyk CLI scanning supports many languages and tools. For detailed information, see the following: • Supported languages, package managers, and frameworks for Open Source and Snyk Code • Supported operating system distributions for Container • Supported IaC Languages and cloud providers This page explains how to install, authenticate, and start scanning using the CLI. Snyk also has an onboarding wizard to guide you through these steps. For a demonstration, view Starting with Snyk: an overview of the CLI onboarding flow. Install the Snyk CLI and authenticate your machine To use the CLI, you must install it and authenticate your machine. See Install or update the Snyk CLI and Authenticate the CLI with your account. You can refer to the release notes for a summary of changes in each release. Before scanning your code, review the Code execution warning for Snyk CLI. **Note:** Before you can use the CLI for Open Source scanning, you must install your package manager. The needed third-party tools, such as Gradle or Maven, must be in the . You can also install the CLI in your IDE or CI/CD environment. For details, see the IDE and CI/CD documentation for instructions for each integration. Test your installation After authenticating, you can test your installation. For a quick test, run . Alternatively, you can perform a quick test on a public npm package, for example . Look at the command report in your terminal. The report shows the vulnerabilities Snyk found in the package. For each issue found, Snyk reports the severity of the issue, provides a link to a detailed description, reports the path through which the vulnerable module got into your system, and provides guidance on how to fix the problem. Scan your development Project **Note:** Before using the Snyk CLI to test your Open Source Project for vulnerabilities, with limited exceptions, you must **build your Project**. For details, see Open Source Projects that must be built before testing. In addition, depending on the language of your open-source Project, you may need to **set up your language environment** before using the Snyk CLI. For details, refer to Supported languages, package managers, and frameworks. After you have installed the CLI and authenticated your machine, to **scan an open-source Project**, use to change the current directory to a folder containing a supported package manifest file, such as , , or . Then run . All vulnerabilities identified are listed, including their path and fix guidance. To scan your **source code,** run . You can **scan a Docker image** by its tag running, for example: . To scan a **Kubernetes (K8s) file,** run the following:\ For details about using the Snyk CLI to scan each content type, see the following: • Snyk CLI for Snyk Open Source and the CLI help for the and commands • Snyk CLI for Snyk Code and the Snyk Code CLI help • Snyk CLI for Snyk Container, including Docker scanning, and the Snyk Container CLI help • Snyk CLI for Snyk IaC, including Terraform and Kubernetes (K8s) Projects, and the Snyk IAC CLI help Monitor your Open Source or Container Project Snyk can monitor your Open Source or Container integrated SCM Project periodically and alert you to new vulnerabilities. To set up your Project to be monitored, run or . This creates a snapshot of your current dependencies so Snyk can regularly scan your code. Snyk can then alert you about newly disclosed vulnerabilities as they are introduced or when a previously unavailable patch or upgrade path is created. The following code shows an example of the output of the command. You can log in to your Snyk account and navigate to the Projects page to find the latest snapshot and scan results: Snyk monitor snapshot and scan results For more information, see Monitor your Projects at regular intervals. Running out of tests Snyk allows unlimited tests for public repositories. If you are on the Free plan, you have a limited number of tests per month. Paid plans have unlimited tests on private and public repositories. If you are on the Free plan and notice that your test count is quickly being used, even with public repositories, you can remedy this by telling Snyk the public URL of the repository that is being scanned by the Snyk CLI. This ensures that Snyk does not count a public repository towards the test limits. If you run out of tests on an open-source Project, follow these steps: • Run . • Open the Snyk UI and navigate to the **settings** of the Project. • Enter the URL of your open-source repository in **Git remote URL**. Additional information about the Snyk CLI Run or see the CLI commands and options summary. See the course Introduction to the Snyk CLI for a quick video training session. Snyk also provides a cheat sheet (blog post). In particular, see the information about the following options that you may find useful: • : Report only vulnerabilities of the specified level or higher. • : Print results in JSON format. • : Auto-detect all Projects in the working directo…