Skip to content
This repository was archived by the owner on May 8, 2018. It is now read-only.

Commit ff5566d

Browse files
committed
update docs and dockerfile
1 parent eb8ae26 commit ff5566d

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ WORKDIR /usr/src/app
55
COPY package.json ./
66

77
RUN apk --update add curl && \
8+
npm install -g npm && \
89
npm install && \
9-
npm run setup-offline
10+
/usr/src/app/bin/nsp gather
1011

1112
RUN adduser -u 9000 -D app
1213
COPY . ./
@@ -17,4 +18,4 @@ USER app
1718
VOLUME /code
1819
WORKDIR /code
1920

20-
CMD ["/usr/src/app/bin/nsp", "check", "--offline", "--warn-only", "--output", "codeclimate"]
21+
CMD ["/usr/src/app/bin/nsp", "check", "--offline", "--advisories", "/usr/src/app/advisories.json", "--warn-only", "--reporter", "codeclimate"]

README.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,25 @@ Please note that in case of naming conflicts built-in reporters (as listed above
3535

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

38-
In order to leverage this capability, create a `.nsprc` file in the root of your project with content like the following:
38+
There are two ways to leverage this capability, online or offline. To use online exceptions, register your project on [our online portal](https://nodesecurity.io). From there you can manage your exceptions from a central location.
39+
40+
In order to inform the CLI tool that it should use these settings, you'll have to create a settings file (and login if your project is private). You'll need both the organization name and the UUID for your project, these can be
41+
retrieved from the URL from our portal. For example, if your project is [hapi](https://github.com/hapijs/hapi) and your project URL is https://nodesecurity.io/orgs/hapi/projects/2a6e5642-b7a1-4b93-b8fb-21c1a5043f42 then your
42+
organization name is `hapi` and your project UUID is `2a6e5642-b7a1-4b93-b8fb-21c1a5043f42`.
43+
44+
Using that information, create a `.nsprc` file with the following content:
45+
46+
```js
47+
{
48+
"org": "hapi",
49+
"integration": "2a6e5642-b7a1-4b93-b8fb-21c1a5043f42"
50+
}
51+
```
52+
53+
When you next run `nsp check` your exceptions will be retrieved from online. If your project is a private one, you will additionally need to run `npm login` which will create another `.nsprc` file in your home directory with an
54+
authentication token that will allow the CLI tool to look up your settings.
55+
56+
For offline exceptions, create a `.nsprc` file in the root of your project with content like the following:
3957

4058
```js
4159
{
@@ -51,21 +69,7 @@ Be careful using this feature. If you add code later that is impacted by an excl
5169

5270
## Proxy Support
5371

54-
The Node Security CLI has proxy support by using [proxy-agent](https://www.npmjs.com/package/proxy-agent).
55-
56-
The currently implemented protocol mappings are listed in the table below:
57-
58-
59-
| Protocol | Example
60-
|:----------:|:--------:
61-
| `http` | `http://proxy-server-over-tcp.com:3128`
62-
| `https` | `https://proxy-server-over-tls.com:3129`
63-
| `socks(v5)`| `socks://username:password@some-socks-proxy.com:9050` (username & password are optional)
64-
| `socks5` | `socks5://username:password@some-socks-proxy.com:9050` (username & password are optional)
65-
| `socks4` | `socks4://some-socks-proxy.com:9050`
66-
| `pac` | `pac+http://www.example.com/proxy.pac`
67-
68-
72+
The Node Security CLI has proxy support by using [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).
6973

7074
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.
7175

@@ -75,6 +79,8 @@ To configure the proxy set the proxy key in your `.nsprc` file. This can be put
7579
}
7680
```
7781

82+
The CLI tool will also automatically detect your proxy if it is exported to the environment as `HTTP_PROXY` or `HTTPS_PROXY`.
83+
7884
## Offline mode
7985

8086
Run `nsp gather` to save `advisories.json` locally, then `nsp check --offline` or `nsp check --offline --advisories /path/to/advisories.json`

bin/nsp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Yargs
2424
.option('baseUrl')
2525
.option('proxy', {
2626
description: 'https proxy to be used for API calls',
27-
default: process.env.https_proxy || process.env.HTTPS_PROXY,
27+
default: process.env.https_proxy || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.HTTP_PROXY,
2828
group: 'Connection:'
2929
})
3030
.option('reporter', {

0 commit comments

Comments
 (0)