UNPKG

5.5 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[![Retire Status](http://retire.insecurity.today/api/image?uri=https://raw.githubusercontent.com/bekk/grunt-retire/master/package.json)](http://retire.insecurity.today/api/image?uri=https://raw.githubusercontent.com/bekk/grunt-retire/master/package.json)
6
7Grunt task for [retire.js](https://github.com/RetireJS/retire.js). Scanner detecting the use of JavaScript libraries with known vulnerabilities.
8
9
10
11## Getting Started
12This plugin requires Grunt `>=0.4.0`. Version 0.3.12 is compatible with Grunt 1.0.
13
14If 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:
15
16```shell
17npm install grunt-retire --save-dev
18```
19
20Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
21
22```js
23grunt.loadNpmTasks('grunt-retire');
24```
25
26
27
28
29## Retire task
30_Run this task with the `grunt retire` command._
31
32This task primarily delegates to [Retire][], so please consider the [Retire documentation][] as required reading for advanced configuration.
33
34[Retire]: https://github.com/RetireJS/retire.js
35[Retire documentation]: https://github.com/RetireJS/retire.js
36
37Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
38
39### Available options
40Example 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.
41
42```js
43 retire: {
44 js: ['app/src/*.js'], /** Which js-files to scan. **/
45 node: ['node'], /** Which node directories to scan (containing package.json). **/
46 options: {
47 proxy: 'http://something.something:8080',
48 verbose: true,
49 packageOnly: true,
50 jsRepository: 'https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json',
51 nodeRepository: 'https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json',
52 outputFile: './retire-output.json',
53 ignore: 'documents,java',
54 ignorefile: '.retireignore' /** list of files to ignore **/
55 }
56 }
57```
58
59`proxy: url`, proxy (supports basic auth).
60
61`verbose: true/false`, default is `true`. More verbose output (grunt -d may also be used for even more debug output).
62
63`packageOnly: true/false`, default is `true`. Only scan only dependencies in package.json, skip dependencies to dependencies.
64
65`jsRepository: String`, default is `https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json`. JSON file which specifies where to retrieve Javascript vulnerability database.
66
67`nodeRepository: String`, default is `https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json`. JSON file which specifies where to retrieve Node vulnerability database.
68
69`outputFile: String`, default is `false`. Path to creation of output file report in JSON format.
70
71`ignore: String`, default is empty. Paths to ignore when scanning for JavaScript files.
72
73
74## Scan javascript files only
75```js
76 retire: {
77 js: ['app/src/*'], /** Scan js-files in app/src/ directory and subdirectories. **/
78 options: {
79 }
80 }
81```
82
83Running ```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`
84
85## Scan node dependencies example
86```js
87 retire: {
88 node: ['module/'], /** Scan node project in directory module/. Should be ['.'] for normal projects **/
89 options: {
90 }
91 }
92```
93Running ```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`
94
95
96## Example output with one vulnerability found in jquery-1.6.js:
97
98```
99➜ grunt-retire git:(master) ✗ grunt retire
100Running "retire:jsPath" (retire) task
101JS repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json
102>> test-files/jquery-1.6.js
103>> ↳ jquery 1.6 has known vulnerabilities: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4969
104Node repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json
105```
106
107
108
109## Example output when no vulnerabilities is found
110```
111➜ grunt-retire git:(master) ✗ grunt retire
112Running "retire:jsPath" (retire) task
113JS repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json
114Node repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json
115No vulnerabilities found.
116
117Done, without errors.
118```
119
120
121## Release History
122 * 2016-02-12 v0.3.11  Upgraded dependencies
123 * 2013-11-12   v0.1.15  Upgrading dependencies. Proxy support
124 * 2013-10-30   v0.1.12  Upgrade to retire v0.1.12. js and node defined as targets.
125 * 2013-10-30   v0.1.0   First version.
126
\No newline at end of file