Git Product home page Git Product logo

nsp's Introduction

nsp Build Status

About Node Security

Node Security helps you keep your node applications secure. With Node Security you can:

  • Make use of the CLI tool to help identify known vulnerabilities in your own projects.
  • Get access to Node Security news and information from the ^lift team.

Installing the CLI (nsp)

  • To install the Node Security command line tool: npm install -g nsp
  • Then run nsp --help to find out more.

Output Format

You can adjust how the client outputs findings by specifying one of the following format options:

  • default
  • summary
  • json
  • codeclimate
  • none

Example: nsp check --output summary

Additionally, you can use third-party formatters. The packages of custom formatters must adhere to the naming scheme nsp-formatter-<name> and can then be referenced by that name:

$ npm install -g nsp nsp-formatter-checkstyle
$ nsp check --output checkstyle

Please note that in case of naming conflicts built-in formatters (as listed above) take precedence. For instance, nsp-formatter-json would never be used since nsp ships with a json formatter.

Exceptions

The Node Security CLI supports adding exceptions. These are advisories that you have evaluated and personally deemed unimportant for your project.

In order to leverage this capability, create a .nsprc file in the root of your project with content like the following:

{
  "exceptions": ["https://nodesecurity.io/advisories/12"]
}

The URLs used in the array should match the advisory link that the CLI reports. With this in place, you will no longer receive warnings about any advisories in the exceptions array.

Be careful using this feature. If you add code later that is impacted by an excluded advisory, Node Security has no way of knowing. Keep a careful eye on your exceptions.

.nsprc is read using rc, so it supports comments using json-strip-comments.

Proxy Support

The Node Security CLI has proxy support by using proxy-agent.

The currently implemented protocol mappings are listed in the table below:

Protocol Example
http http://proxy-server-over-tcp.com:3128
https https://proxy-server-over-tls.com:3129
socks(v5) socks://username:[email protected]:9050 (username & password are optional)
socks5 socks5://username:[email protected]:9050 (username & password are optional)
socks4 socks4://some-socks-proxy.com:9050
pac pac+http://www.example.com/proxy.pac

To configure the proxy set the proxy key in your .nsprc file. This can be put in the root of your project or in your home directory.

{
    "proxy": "http://127.0.0.1:8080"
}

Offline Mode

nsp has an offline mode which was previously undocumented. We recommend not relying on offline support as it may become unsupported in the future as new features are added.

First you need to obtain the offline advisories database. Do this by running the npm run setup-offline script provided by nsp. If you only needs the 100 most recent advisories, run npm run recent-offline script instead.

Second you need to tell nsp where to find that file. You can do that 3 ways.

  1. Put it in the actual nsp module folder and no other configuration is required
  2. Specify it in the .nsprc configuration file advisoriesPath: "/path/to/advisories.json"
  3. Specify it from the command line when you call nsp nsp check --offline --advisoriesPath=/path/to/advisories.json

When you call nsp check you will want to use the --offline flag

A couple of notes

  • Offline mode requires that your project include a npm-shrinkwrap.json file.
  • Because of npm3 flattening reported paths may be incorrect.

Code Climate Node Security Engine

codeclimate-nodesecurity is a Code Climate engine that wraps the Node Security CLI. You can run it on your command line using the Code Climate CLI, or Code Climate's hosted analysis platform.

Note that this engine only works if your code has a npm-shrinkwrap.json file committed.

Testing

First, build this repo with docker

git clone [email protected]:nodesecurity/nsp
cd nsp
docker build -t codeclimate/codeclimate-nodesecurity .

Install the codeclimate CLI

brew tap codeclimate/formulae
brew install codeclimate

Go into your project's directory and enable codeclimate

codeclimate init

Then edit .codeclimate.yml to add the engine like so

---
engines:
  nodesecurity:
    enabled: true
exclude_paths: []

And finally run it

codeclimate analyze --dev

Suggesting Changes to Advisories

Should you come across data in an advisory that you feel is wrong or is a false positive please let us know at [email protected]. We endeavor to make this process better in the future, however this is the best place to resolve these issues at the present.

Contact

Node Security (+) is brought to you by ^lift security.

License

Copyright (c) 2016 by ^Lift Security

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and
limitations under the License.

Note: the above text describes the license for the code located in this repository only. Usage of this tool or the API this tool accesses implies acceptance of our terms of service.

nsp's People

Contributors

bear avatar boneskull avatar cdaringe avatar coder13 avatar dblandin avatar evanlucas avatar jlamendo avatar jpignata avatar jsolis avatar jweinsteincbt avatar koresar avatar majgis avatar marshallswain avatar mrb avatar nlf avatar omrigilad avatar one000mph avatar oughter avatar pdehaan avatar pigulla avatar reedloden avatar wolfgang42 avatar wraithgar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.