• Stars
    star
    4,856
  • Rank 8,657 (Top 0.2 %)
  • Language
    TypeScript
  • License
    Other
  • Created about 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Snyk CLI scans and monitors your projects for security vulnerabilities.

Snyk CLI

Snyk scans and monitors your projects for security vulnerabilities.

Snyk CLI screenshot

What is Snyk?

Snyk is a developer-first cloud-native security tool. It covers multiple areas of application security:

  1. Snyk Open Source: Find and automatically fix open source vulnerabilities
  2. Snyk Code: Find and fix vulnerabilities in your application code in real time
  3. Snyk Container: Find and fix vulnerabilities in container images and Kubernetes applications
  4. Snyk Infrastructure as Code: Find and fix insecure configurations in Terraform and Kubernetes code

Learn more about what Snyk can do and sign up for a free account Β»

What is Snyk CLI?

Snyk CLI brings the functionality of Snyk into your development workflow. It can be run locally or in your CI/CD pipeline to scan your projects for security issues.

Supported languages and tools

Snyk supports many languages and tools, including Java, .NET, JavaScript, Python, Golang, PHP, C/C++, Ruby, Scala and more. See our Language Support documentation.

CLI also supports Docker scanning and Terraform, k8s and other Infrastructure as Code files scanning.


Install Snyk CLI

Snyk CLI can be installed through multiple channels.

Install with npm or Yarn

Snyk CLI is available as an npm package. If you have Node.js installed locally, you can install it by running:

npm install snyk@latest -g

or if you are using Yarn:

yarn global add snyk

More installation methods

Standalone executables (macOS, Linux, Windows)

Standalone executables

Use GitHub Releases to download a standalone executable of Snyk CLI for your platform.

We also provide these standalone executables on our official CDN. See the release.json file for the download links:

https://static.snyk.io/cli/latest/release.json

# Or for specific version or platform
https://static.snyk.io/cli/v1.666.0/release.json
https://static.snyk.io/cli/latest/snyk-macos

For example, to download and run the latest Snyk CLI on macOS, you could run:

curl https://static.snyk.io/cli/latest/snyk-macos -o snyk
chmod +x ./snyk
mv ./snyk /usr/local/bin/

You can also use these direct links to download the executables:

Drawback of this method is, that you will have to manually keep the Snyk CLI up to date.

Verifying standalone binaries

You can verify both shasum of downloaded binaries and their GPG signatures.

Download location on static.snyk.io contains a file called sha256sums.txt.asc. You can download it directly https://static.snyk.io/cli/latest/sha256sums.txt.asc or for a specific version like https://static.snyk.io/cli/v1.666.0/sha256sums.txt.asc.

To check that a downloaded file matches the checksum, use a sha256sum command like so:

grep snyk-macos sha256sums.txt.asc | sha256sum -c -

If you want to verify Snyk CLI standalone binaries against Snyk CLI GPG key, you will need to import it first:

# A22665FB96CAB0E0973604C83676C4B8289C296E is the key belonging to [email protected]
# Copy of this public key is also in this repository /help/_about-this-project/snyk-code-signing-public.pgp
gpg --keyserver hkps://keys.openpgp.org --recv-keys A22665FB96CAB0E0973604C83676C4B8289C296E

Then verify the file is signed with:

gpg --verify sha256sums.txt.asc

Command output should look like:

gpg: Signature made So  8 Jan 14:11:44 2023 CET
gpg:                using EDDSA key A22665FB96CAB0E0973604C83676C4B8289C296E
gpg: Good signature from "Snyk Limited <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: A226 65FB 96CA B0E0 9736  04C8 3676 C4B8 289C 296E
Install with Homebrew (macOS, Linux)

Homebrew

Install Snyk CLI from Snyk tap with Homebrew by running:

brew tap snyk/tap
brew install snyk
Scoop (Windows)

Scoop

Install Snyk CLI from our Snyk bucket with Scoop on Windows:

scoop bucket add snyk https://github.com/snyk/scoop-snyk
scoop install snyk
Snyk CLI in a Docker image

Snyk CLI in a Docker image

Snyk CLI can also be run from a Docker image. Snyk offers multiple Docker tags under snyk/snyk. These images wrap the Snyk CLI and depending on the Tag come with a relevant tooling for different projects. See the snyk/images on GitHub for more details and examples.

Install as a part of a Snyk CLI integration

Snyk also offers many integrations into developer tooling. These integrations will install and manage the Snyk CLI for you. For example:

Snyk CLI IDE integration


Getting started with Snyk CLI

Once you installed the Snyk CLI, you can verify it's working by running:

snyk --help

See the full Snyk CLI help.

Authenticating Snyk CLI

Snyk CLI depends on Snyk.io APIs. Connect your Snyk CLI with Snyk.io by running:

snyk auth

Setting up language support

Depending on your project's language, you might need to setup your language environment before using Snyk.

See our Language Support documentation.

Scanning your project

If you are already in a folder with a supported project, start by running:

snyk test

Or scan a Docker image by its tag with Snyk Container:

snyk container test ubuntu:18.04

Or a k8s file:

snyk iac test /path/to/kubernetes_file.yaml

Monitoring your project

Snyk can also monitor your project periodically and alert you for new vulnerabilities. The snyk monitor is similar to snyk test and can be used to create a project on the Snyk website that will be continuously monitored for new vulnerabilities.

Snyk CLI monitor projects

> snyk monitor
Monitoring /project (project-name)...

Explore this snapshot at https://app.snyk.io/org/my-org/project/29361c2c-9005-4692-8df4-88f1c040fa7c/history/e1c994b3-de5d-482b-9281-eab4236c851e

Notifications about newly disclosed issues related to these dependencies will be emailed to you.

Add Snyk to your CI/CD

Snyk is really powerful when you are continuously scanning and monitoring your projects for vulnerabilities.

Use one of our integrations to stay secure.

You can authorize Snyk CLI in your CI/CD programatically:

# Using a SNYK_TOKEN envvar (preferred)
SNYK_TOKEN=<SNYK_API_TOKEN> snyk test

# Or using a Snyk auth command
snyk auth <SNYK_API_TOKEN>
snyk test

More flags and options to try

Here are some flags that you might find useful:

  • --severity-threshold=low|medium|high|critical

    Only report vulnerabilities of provided level or higher.

  • --json

    Prints results in JSON format.

  • --all-projects

    Auto-detect all projects in working directory

See all the available commands and options by running --help:

snyk --help
# or get help for a specific command like
snyk iac --help
snyk code --help

Getting support

If you need support using Snyk CLI, please contact support.

We do not actively monitor GitHub Issues so any issues there may go unnoticed.

Contributing

If you are an external contributor, before working on any contributions, please first contact support to discuss the issue or feature request with us.

If you are contributing to Snyk CLI, see our contributing guidelines

For information on how Snyk CLI is implemented, see our design decisions.

This repository is a monorepo, also covering other projects and tools:

Security

For any security issues or concerns, please see SECURITY.md file in this repository.

Notices

Snyk API usage policy

The use of Snyk's API, whether through the use of the 'snyk' npm package or otherwise, is subject to the Terms & Conditions.


Made with πŸ’œ by Snyk

More Repositories

1

driftctl

Detect, track and alert on infrastructure drift
Go
2,431
star
2

zip-slip-vulnerability

Zip Slip Vulnerability (Arbitrary file write through archive extraction)
663
star
3

actions

A set of GitHub actions for checking your projects for vulnerabilities
HTML
489
star
4

vulnerabilitydb

Snyk's public vulnerability database
369
star
5

vulncost

Find security vulnerabilities in open source npm packages while you code
JavaScript
201
star
6

parlay

Enrich SBOMs with data from third party services
Go
108
star
7

leaky-vessels-static-detector

Static detection tool for runc and Docker "Leaky Vessels" vulnerabilities
Go
94
star
8

leaky-vessels-dynamic-detector

Leaky Vessels Dynamic Detector
C
92
star
9

broker

A broker system between a public service and a private service
TypeScript
84
star
10

kubernetes-monitor

Use Snyk to find and fix vulnerabilities in your Kubernetes workloads
TypeScript
81
star
11

socketsleuth

Burp Extension to add additional functionality for pentesting websocket based applications
Java
76
star
12

release-notes-preview

GitHub Action for providing release notes preview for semantic releases
TypeScript
75
star
13

vscode-extension

Snyk extension for Visual Studio Code
TypeScript
75
star
14

snyk-to-html

export test reports from CLI to html
JavaScript
68
star
15

snyk-maven-plugin

Test and monitor your projects for vulnerabilities with Maven. This plugin is officially maintained by Snyk.
Java
63
star
16

nodejs-lockfile-parser

Generate a Snyk dependency tree from package-lock.json or yarn.lock file
TypeScript
52
star
17

snyk-intellij-plugin

Snyk Vulnerability Scanner for IDEs based on the IntelliJ platform
Kotlin
51
star
18

snyk-images

A build toolchain for Snyk Docker images.
TypeScript
51
star
19

awesome-snyk-community

Awesome Snyk community contributions, champions, integrations, blogs, tools and more πŸ’œ
42
star
20

serverless-snyk

Serverless plugin for securing your dependencies with Snyk
JavaScript
40
star
21

snyk-ls

Language Server using LSP meant to be used by IDEs as Snyk Backend for Frontends
Go
38
star
22

jobs

Job opportunities at Snyk - join us in driving Open Source Security!
JavaScript
38
star
23

policy-engine

Unified Policy Engine
Go
37
star
24

faker-security

Python Faker provider for security related data
Python
35
star
25

snyk-api-import

⚑️Snyk API powered import tool to help you automate & monitor a large scale import into Snyk organizations. Designed for onboarding with a built in queue & retries πŸ“ˆ
TypeScript
35
star
26

dep-graph

Represents a dependency graph
TypeScript
31
star
27

snyk-visual-studio-plugin

Snyk Visual Studio Extension
C#
27
star
28

snyk-azure-pipelines-task

TypeScript
26
star
29

resolve-deps

Resolves a node package tree with combined support for both npm@2 and npm@3
TypeScript
26
star
30

snyk-docker-plugin

This plugin provides dependency metadata for Docker images
TypeScript
24
star
31

snyk-gradle-plugin

Basic Snyk CLI plugin for Gradle support
TypeScript
24
star
32

user-docs

Gitbook documentation repo.
Go
23
star
33

sweater-comb

API linting rules
TypeScript
21
star
34

snyk-orb

Integrate Security into your CircleCI pipeline with Snyk
20
star
35

vervet

API resource versioning tool
Go
18
star
36

pkgbot

Superseded by @statsbot (private repo)
JavaScript
18
star
37

event-loop-spinner

Centralised event loop spinning
TypeScript
17
star
38

driftctl-action

GitHub Action for driftctl
Shell
17
star
39

artifactory-snyk-security-plugin

Allow Artifactory users to test their applications against the Snyk vulnerability database
Java
17
star
40

snyk-python-plugin

Basic Snyk CLI plugin for Python support
Python
16
star
41

homebrew-tap

An automatically updated Homebrew tap for Snyk
Ruby
16
star
42

nodejs-runtime-agent

Snyk Node Runtime Agent
JavaScript
16
star
43

snyk-apps-demo

Snyk demo app that showcases how Snyk Apps work, including the authorization flow.
TypeScript
15
star
44

gradle-plugin

Snyk Gradle Plugin - Scanning and monitoring your dependencies for security vulnerabilities from Gradle
Java
15
star
45

nexus-snyk-security-plugin

Allow Nexus users to test their applications against the Snyk vulnerability database
Java
15
star
46

snyk-eclipse-plugin

Eclipse plugin
Java
14
star
47

snyk-broker-helm

Smarty
12
star
48

snyk-poetry-lockfile-parser

TypeScript
11
star
49

java-call-graph-builder

Tool for building a call graph for the JVM ecosystem (Maven, Gradle...)
TypeScript
11
star
50

fluentd-logzio-kubernetes

A kubernetes daemonset that pushes your cluster logs to logz.io using fluentd
Shell
10
star
51

snyk-go-plugin

Basic Snyk CLI plugin for Golang support
TypeScript
10
star
52

ruby-semver

A semver parser that uses RubyGem's semantics with node-semver's api
TypeScript
10
star
53

cocoapods-lockfile-parser

Generate a Snyk dependency graph from a Podfile.lock file
TypeScript
9
star
54

teamcity-snyk-security-plugin

Allow TeamCity users to test their applications against the Snyk vulnerability database
Java
9
star
55

snyk-mvn-plugin

Basic Snyk CLI plugin for Maven support
TypeScript
9
star
56

code-client

Typescript consumer of public API
TypeScript
9
star
57

snyk-go-parser

A library to parse dependency manifests for Go
TypeScript
9
star
58

dotnet-deps-parser

Generate a dependency tree from .NET & .NET Core manifest files
TypeScript
8
star
59

unified-range

Uniform version ranges based on the Maven VersionRange spec
Python
8
star
60

scoop-snyk

A Scoop Bucket for Snyk, making installation on Windows easier
Ruby
8
star
61

snyk-iac-rules

Go
8
star
62

github-codeowners

TypeScript
8
star
63

snyk-sbt-plugin

Basic Snyk CLI plugin for SBT support
TypeScript
8
star
64

java-reachability-playground

Intentionally vulnerable repository for demonstration of reachability features
Java
7
star
65

policy

Snyk policy parser and matching logic
TypeScript
7
star
66

snyk-code-review-exercise

Example Code Review Exercise
7
star
67

snyk-github-import

Import projects from GitHub repos modified since a given date
JavaScript
7
star
68

go-application-framework

Framework for building client side applications like the Snyk CLI with its Extensions
Go
7
star
69

koa2-bunyan-server

A structured logging example using koa2 and bunyan
JavaScript
6
star
70

go-httpauth

"Advanced" HTTP Authentication mechanisms to be used in the golang HTTP stack
Go
6
star
71

dev-null

FOR TESTING ONLY
6
star
72

snyk-hex-plugin

Elixir
6
star
73

rpm-parser

Produce a list of dependencies from an RPM database file
TypeScript
6
star
74

kubernetes-scanner

Collects data about Kubernetes resources for Snyk
Go
6
star
75

snyk-iac-aws-cdk

Snyk Infrastructure as Code Demo for AWS CDK
JavaScript
5
star
76

java-runtime-agent

Java runtime instrumentation
Java
5
star
77

config

Common config loader for snyk
TypeScript
5
star
78

snyk-cpp-plugin

Snyk CLI C/C++ plugin
TypeScript
5
star
79

code-sdk-java

Snyk Code Public API package in Java
Java
5
star
80

snyk-php-plugin

Basic Snyk CLI plugin for PHP support
TypeScript
5
star
81

cloud-config-parser

A utility library for finding issues in configuration files
TypeScript
5
star
82

snykwire

JavaScript
4
star
83

snyk-docker-analyzer

CLI for analyzing docker images (previous method, see snyk-docker-plugin)
Go
4
star
84

snyk-iac-cloudformation

Snyk Infrastructure as Code Cloudformation demo
4
star
85

snyk-nuget-plugin

Basic Snyk CLI plugin for .NET support
TypeScript
4
star
86

resolve-package

Resolves the location of a node package given a path
HTML
4
star
87

driftctl-docs

Docs site for driftctl
MDX
4
star
88

composer-lockfile-parser

Snyk composer.lock file parser
TypeScript
4
star
89

press-kit

Snyk's press kit
4
star
90

snyk-to-jira

Shell script to convert Snyk issues to JIRA tickets
Shell
4
star
91

try-require

Snyk package loading system with policy detection
JavaScript
3
star
92

follow-npm

Simple cli tool that prints package@version to stdout
JavaScript
3
star
93

snyk-bazel-plugin

Basic Snyk CLI plugin for Bazel support
TypeScript
3
star
94

cli-extension-sbom

Go
3
star
95

snyk-cocoapods-plugin

Basic Snyk CLI plugin for CocoaPods support
TypeScript
3
star
96

broker-snyk-client-example

An example of the old-style broker configuration. Please read the newer docs.
3
star
97

nuget-semver

A semver parser that uses nuget semantics with node-semver's api
JavaScript
2
star
98

test-pug

Ruby
2
star
99

spring-bean-printer

Java
2
star
100

clojure-manifest-parser

WIP
TypeScript
2
star