UNPKG

4.96 kBMarkdownView Raw
1# grunt-retire
2
3[![Dependency Status](https://gemnasium.com/bekk/grunt-retire.png)](https://gemnasium.com/bekk/grunt-retire)
4[![NPM version](https://badge.fury.io/js/grunt-retire.png)](http://badge.fury.io/js/grunt-retire)
5
6Grunt task for [retire.js](https://github.com/bekk/retire.js). Scanner detecting the use of JavaScript libraries with known vulnerabilities.
7
8
9
10## Getting Started
11This plugin requires Grunt `~0.4.0`
12
13If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
14
15```shell
16npm install grunt-retire --save-dev
17```
18
19Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
20
21```js
22grunt.loadNpmTasks('grunt-retire');
23```
24
25
26
27
28## Retire task
29_Run this task with the `grunt retire` command._
30
31This task primarily delegates to [Retire][], so please consider the [Retire documentation][] as required reading for advanced configuration.
32
33[Retire]: https://github.com/bekk/retire.js
34[Retire documentation]: https://github.com/bekk/retire.js
35
36Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
37
38### Available options
39Example configuration below shows default option values and the correct syntax to use if you want to override any of them. If no options are provided, the default values as shown below are used.
40
41```js
42 retire: {
43 js: ['app/src/*.js'], /** Which js-files to scan. **/
44 node: ['node'], /** Which node directories to scan (containing package.json). **/
45 options: {
46 proxy: 'http://something.something:8080',
47 verbose: true,
48 packageOnly: true,
49 jsRepository: 'https://raw.github.com/bekk/retire.js/master/repository/jsrepository.json',
50 nodeRepository: 'https://raw.github.com/bekk/retire.js/master/repository/npmrepository.json',
51 ignore: 'documents,java',
52 ignorefile: '.retireignore' /** list of files to ignore **/
53 }
54 }
55```
56
57`proxy: url`, proxy (supports basic auth).
58
59`verbose: true/false`, default is `true`. More verbose output (grunt -d may also be used for even more debug output).
60
61`packageOnly: true/false`, default is `true`. Only scan only dependencies in package.json, skip dependencies to dependencies.
62
63`jsRepository: String`, default is `https://raw.github.com/bekk/retire.js/master/repository/jsrepository.json`. JSON file which specifies where to retrieve Javascript vulnerability database.
64
65`nodeRepository: String`, default is `https://raw.github.com/bekk/retire.js/master/repository/npmrepository.json`. JSON file which specifies where to retrieve Node vulnerability database.
66
67`ignore: String`, default is empty. Paths to ignore when scanning for JavaScript files.
68
69
70## Scan javascript files only
71```js
72 retire: {
73 js: ['app/src/*'], /** Scan js-files in app/src/ directory and subdirectories. **/
74 options: {
75 }
76 }
77```
78
79Running ```grunt retire``` will scan files in app/src/ for vulnerable libraries. If file sources for both node and js are specified, scanning js only is possible using `retire:js`
80
81## Scan node dependencies example
82```js
83 retire: {
84 node: ['module/'], /** Scan node project in directory module/. Should be ['.'] for normal projects **/
85 options: {
86 }
87 }
88```
89Running ```grunt retire``` will scan all dependencies specified under `dependencies` in `package.json` for vulnerable libraries. If file sources for both node and js are specified, scanning node only is possible using `retire:node`
90
91
92## Example output with one vulnerability found in jquery-1.6.js:
93
94```
95➜ grunt-retire git:(master) ✗ grunt retire
96Running "retire:jsPath" (retire) task
97JS repository loaded from: https://raw.github.com/bekk/retire.js/master/repository/jsrepository.json
98>> test-files/jquery-1.6.js
99>> ↳ jquery 1.6 has known vulnerabilities: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4969
100Node repository loaded from: https://raw.github.com/bekk/retire.js/master/repository/npmrepository.json
101```
102
103
104
105## Example output when no vulnerabilities is found
106```
107➜ grunt-retire git:(master) ✗ grunt retire
108Running "retire:jsPath" (retire) task
109JS repository loaded from: https://raw.github.com/bekk/retire.js/master/repository/jsrepository.json
110Node repository loaded from: https://raw.github.com/bekk/retire.js/master/repository/npmrepository.json
111No vulnerabilities found.
112
113Done, without errors.
114```
115
116
117## Release History
118
119 * 2013-11-12   v0.1.15  Upgrading dependencies. Proxy support
120 * 2013-10-30   v0.1.12  Upgrade to retire v0.1.12. js and node defined as targets.
121 * 2013-10-30   v0.1.0   First version.
122
\No newline at end of file