# snyk-delta

> Prevent feature for CLI tests

Latest version **1.15.2** (published 2026-11-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install snyk-delta
pnpm add snyk-delta
yarn add snyk-delta
bun add snyk-delta
```

Provides the command `snyk-delta`.

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.15.2 |
| Published | 2026-11-11 |
| First published | 2020-05-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=22.0.0 |
| Dependencies | 14 |
| Unpacked size | 202.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Snyk Tech Services |
| Maintainers | snyk-tech-services |

## Links

- npm: https://www.npmjs.com/package/snyk-delta
- Repository: https://github.com/snyk-tech-services/snyk-delta
- Issues: https://github.com/snyk-tech-services/snyk-delta/issues
- npm.io page: https://npm.io/package/snyk-delta

## Dependencies (14)

- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [tslib](https://npm.io/package/tslib.md) ^1.10.0
- [yargs](https://npm.io/package/yargs.md) ^16.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [is-uuid](https://npm.io/package/is-uuid.md) ^1.0.2
- [@types/debug](https://npm.io/package/@types/debug.md) ^4.1.5
- [app-root-path](https://npm.io/package/app-root-path.md) ^3.0.0
- [terminal-link](https://npm.io/package/terminal-link.md) ^2.1.1
- [@types/is-uuid](https://npm.io/package/@types/is-uuid.md) ^1.0.0
- [@snyk/dep-graph](https://npm.io/package/@snyk/dep-graph.md) ^1.18.1
- [@snyk/configstore](https://npm.io/package/@snyk/configstore.md) ^3.2.0-rc1
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.16
- [snyk-request-manager](https://npm.io/package/snyk-request-manager.md) ^1.9.5

## Recent versions

- 1.15.2 (latest) — 2026-11-11
- 1.15.1 — 2026-10-20
- 1.15.0 — 2026-10-20
- 1.14.0 — 2026-08-31
- 1.13.2 — 2026-03-25
- 1.12.7 — 2025-04-15
- 1.12.6 — 2025-04-11
- 1.12.5 — 2025-01-29
- 1.12.4 — 2025-01-13
- 1.12.3 — 2024-10-21
- 1.12.2 — 2024-10-10
- 1.12.1 — 2024-10-09
- 1.12.0 — 2023-11-08
- 1.11.0 — 2023-11-08
- 1.10.1 — 2023-10-05
- … 56 more at https://npm.io/package/snyk-delta/versions

## README

![Snyk logo](https://snyk.io/style/asset/logo/snyk-print.svg)

***

[![Known Vulnerabilities](https://snyk.io/test/github/snyk-tech-services/snyk-delta/badge.svg)](https://snyk.io/test/github/snyk/snyk-delta)
[![CircleCI](https://circleci.com/gh/snyk-tech-services/snyk-delta.svg?style=svg&circle-token=bfb34e49aa301cfa4ef4272541360a475ff95ad4)](https://circleci.com/gh/snyk-tech-services/snyk-delta)
[![Inactively Maintained](https://img.shields.io/badge/Maintenance%20Level-Inactively%20Maintained-yellowgreen.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)


**This repository is in maintenance mode, no new features are being developed. Bug & security fixes will continue to be delivered. Open source contributions are welcome for small features & fixes (no breaking changes)**

# Snyk snyk-delta
Fail the [Snyk CLI](https://github.com/snyk/cli) scans during CI/CD only if there are new issues introduced (similar to Snyk PR checks).
Gets the delta between 2 Snyk project snapshots before failing the scan. Particularly useful when running [Snyk CLI](https://github.com/snyk/cli) scans in your local environment, git hooks, CI/CD etc.

## Open Source / Container

Compares 2 Snyk project snapshots to provide details on:
- New vulnerabilities not found in the baseline snapshot
- New license issues not found in the baseline snapshot
- Dependencies delta between 2 snapshots:
    - direct dependencies added and removed
    - indirect dependencies added and removed
    - issue path(s) introducing new vulnerabilities

## Code

Compare Snyk Code SARIF output to see **new** code analysis findings not found in baseline. Use `snyk-delta --code` with either:

- **Piped input:** SARIF JSON on stdin is the current result; baseline from REST API. Requires `--baselineOrg` (optionally `--baselineProject` or `--projectName` or `--targetReference`). Use of `--projectName` with `--targetReference` is recommended for precise reference to the Code Analysis project. In cases of more than 1 project, the first matching one is used.
  - Example: `snyk code test --sarif | snyk-delta --code --baselineOrg <org-uuid> --baselineProject <project-uuid>`
  - Example: `snyk code test --sarif | snyk-delta --code --baselineOrg <org-uuid> --projectName "<owner/repo>" --targetReference "<branchName>"`
- **Two file paths:** First argument = path to old/baseline SARIF file, second = path to current SARIF file.
  - Example: `snyk-delta --code old.sarif.json current.sarif.json`

Findings carrying an `accepted` suppression (an approved ignore) are never reported as new, in both modes. The number skipped is printed.

Exit codes: `0` = no new findings, `1` = new findings, `2` = error

## Prerequisites
- Snyk Business or Enterprise Account (requires API access)
- Project must be monitored in Snyk to provide a baseline to compare against
- set the API token in the `SNYK_TOKEN` enviroment variable. Create a [service account](https://docs.snyk.io/features/user-and-group-management/managing-groups-and-organizations/service-accounts) in Snyk and use the provided token.
- Required Permissions:
1. View Organization
2. Test packages
3. View Projects
4. Test Projects
5. View Project History
6. View Ignores

## Supported Snyk products

| Product | Supported |
| ---- | --------- |
| Open Source    | ✅        |
| Container   | ✅        |
| IaC   | ❌         |
| Code   | ✅ (Code Consistent Ignores enabled-only) |

## Installation
`npm i -g snyk-delta` or grab a binary from [the release page](https://github.com/snyk-tech-services/snyk-delta/releases)

## Usage
- `--baselineOrg` *optional*

  Organization to use as baseline. Snyk organization ID can be located in the [organization settings](https://docs.snyk.io/products/snyk-code/cli-for-snyk-code/before-you-start-set-the-organization-for-the-cli-tests/finding-the-snyk-id-and-internal-name-of-an-organization)

  *Example*: `--orgID 0e9373a6-f858-11ec-b939-0242ac120002`

- `--baselineProject` *optional*

  Project to use as baseline. Public Snyk project ID can be located in [project settings](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-settings)

  *Example*: `--baselineProject 0e9373a6-f858-11ec-b939-0242ac120002`

- `--targetReference` *optional*

  Target reference to compare. Target references can be used to delineate between branches, tags, or other custom references in the Snyk platform.
  For more information on target references, see the [Snyk documentation](https://docs.snyk.io/snyk-cli/scan-and-maintain-projects-using-the-cli/group-projects-by-branch-or-version-for-monitoring).

  *Example*: `--targetReference my-branch-name`

- `--currentProject` *optional*

  Project to compare. Public Snyk project ID can be located in [project settings](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-settings)


  *Example*: `--currentProject 0e9373a6-f858-11ec-b939-0242ac120002`

- `--currentOrg` *optional*

  Organization to compare. Snyk organization ID can be located in the [organization settings](https://docs.snyk.io/products/snyk-code/cli-for-snyk-code/before-you-start-set-the-organization-for-the-cli-tests/finding-the-snyk-id-and-internal-name-of-an-organization)

  *Example*: `--orgID 0e9373a6-f858-11ec-b939-0242ac120002`

- `--fail-on` *optional*

  [As in Snyk CLI](https://docs.snyk.io/snyk-cli/test-for-vulnerabilities/advanced-failing-of-builds-in-snyk-cli) with the `--fail-on` flag return non 0 error code when new issues are upgradable, patchable, or both (all)..

   *Example*: `--fail-on all`

- `--setPassIfNoBaseline` *optional*

  Do not fail with exit code `1` if the current project is not monitored in Snyk and could not be compared. When `snyk-delta` compares test results, it tries to find the same project monitored on the Snyk platform. If no monitored project is found, is will return all the issues found by the CLI scan, essentially acting as pass through if this is enabled.

   *Example*: `--setPassIfNoBaseline true`

- `--type` *optional*

  Specify Snyk issue type to compare. Defaults `all`, available options: `vuln`, `license`, `all`.

   *Example*: `--type vuln`
### Mode: Inline
- `snyk test --json --print-deps | snyk-delta`
- Point to a specific Snyk project  snapshot by specifying org+project coordinates

  `snyk test --json --print-deps | snyk-delta --baselineOrg xxx --baselineProject xxx`
- Use the `--setPassIfNoBaseline` if used with [snyk-prevent-gh-commit-status](https://github.com/snyk-tech-services/snyk-prevent-gh-commit-status) and the project is not monitored. This will prevent [snyk-prevent-gh-commit-status](https://github.com/snyk-tech-services/snyk-prevent-gh-commit-status) to fail. `setPassIfNoBaseline` defaults to `false`.

    `snyk test --json --print-deps | snyk-delta --baselineOrg xxx --baselineProject xxx --setPassIfNoBaseline true`

### Mode: Standalone
- `snyk-delta --baselineOrg xxx --baselineProject xxx --currentOrg xxx --currentProject xxx --setPassIfNoBaseline false`

## Usage as module

```
import { getDelta } from 'snyk-delta'

const jsonResultsFromSnykTest = Read from file or pipe snyk test command

const result = await getDelta(jsonResultsFromSnykTest);
```
Actual issue(s) details will be listed on stdout.

## Help
`snyk-delta -h` to see help documentation.

## Exit codes
- `0` - no new license/vulnerability issues introduced
- `1` - new license/vulnerability issues introduced
- `2` - error
### Caution
Usage as a module requires list of issues coming from Snyk CLI.
Currently not compatible with data coming straight from Snyk APIs.

### `snyk test --all-projects` support
Snyk-delta doesn't currently support the `--all-projects` option, but you can try to use [snyk_delta_all_projects.sh](./snyk_delta_all_projects.sh) as an example of how to work around this.

## Technical notes
Check out the docs folder.

## Release Binary naming
Multi-arch standalone executable binaries attached to each [release](https://github.com/snyk-tech-services/snyk-delta/releases) follow the naming format `snyk-delta-<os>-<arch>`:

| OS | Arch | Binary |
| ---- | ---- | ------ |
| Linux | x64 | `snyk-delta-linux-x64` |
| Linux | arm64 | `snyk-delta-linux-arm64` |
| macOS | x64 | `snyk-delta-macos-x64` |
| macOS | arm64 | `snyk-delta-macos-arm64` |
| Windows | x64 | `snyk-delta-win-x64.exe` |

Each binary is accompanied by a SHA-256 checksum file (e.g. `snyk-delta-linux-x64.sha256`). If you were using a previously named binary, update your download scripts to the names above.

---
_Source: https://npm.io/package/snyk-delta · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
