npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

snyk-filter

v1.3.2

Published

Module to consume json output from Snyk CLI for advanced filtering and results display

Downloads

16,236

Readme

Snyk logo


Custom Filtering for Snyk CLI

snyk-filter takes the JSON outputted from the Snyk CLI, e.g. snyk test --json and applies custom filtering of the results, as well as options to fail your build.

Known Vulnerabilities CircleCI Inactively Maintained

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)

How do I use it?

Install

npm i -g snyk-filter

Note about node-jq

snyk-filter uses the node-jq library, which requires that a jq binary is installed. This typically happens transparently via npm install -g, but on some systems JQ does not get properly installed locally. If you receive an error after installation regarding node-jq, then jq should be installed manually to avoid this error.

# install jq ahead of time (ubuntu example)
sudo apt-get install -y jq

# tell node-jq to skip trying to install it on its own
export NODE_JQ_SKIP_INSTALL_BINARY=true

# tell node-jq where the existing jq binary is
export JQ_PATH=$(which jq)

# finally, install snyk-filter (does not work with node version > 12)
sudo npm install -g

Usage

  1. Implement your custom JQ filters in a .snyk-filter/snyk.yml file relative to your current working directory where you will be running snyk test from (see in sample-filters and tweak things from there - use JQPlay )

  2. Then pipe your snyk test --json output into snyk-filter or use the -i argument to input a json file. Use the -f argument to point to the yml file containing your custom filters if you are not using the default location (.snyk-filter/snyk.yml).

  3. Return code of snyk-filter will be 0 for pass (no issues) and 1 for fail (issues found)

Example with Snyk CLI (using .snyk-filter/snyk.yml by default)

snyk test --json | snyk-filter

Example with Snyk CLI and custom yml file location

snyk test --json | snyk-filter -f /path/to/example-cvss-9-or-above.yml

Example

snyk-filter -i snyk_results.json

Example with custom yml file location

snyk-filter -i snyk_results.json -f /path/to/example-high-upgradeable-vulns.yml

Options

--json to output json

License

License: Apache License, Version 2.0