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 |
|
7 | Grunt 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
|
12 | This plugin requires Grunt `>=1.0.0`. Version 0.3.12 is compatible with Grunt 0.4.
|
13 |
|
14 | If 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
|
17 | npm install grunt-retire --save-dev
|
18 | ```
|
19 |
|
20 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
|
21 |
|
22 | ```js
|
23 | grunt.loadNpmTasks('grunt-retire');
|
24 | ```
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | ## Retire task
|
30 | _Run this task with the `grunt retire` command._
|
31 |
|
32 | This 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 |
|
37 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
|
38 |
|
39 | ### Available options
|
40 | Example 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 | /** list of files to ignore **/
|
55 | ignorefile: '.retireignore' //or '.retireignore.json'
|
56 | }
|
57 | }
|
58 | ```
|
59 |
|
60 | `proxy: url`, proxy (supports basic auth).
|
61 |
|
62 | `verbose: true/false`, default is `true`. More verbose output (grunt -d may also be used for even more debug output).
|
63 |
|
64 | `packageOnly: true/false`, default is `true`. Only scan only dependencies in package.json, skip dependencies to dependencies.
|
65 |
|
66 | `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.
|
67 |
|
68 | `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.
|
69 |
|
70 | `outputFile: String`, default is `false`. Path to creation of output file report in JSON format.
|
71 |
|
72 | `ignore: String`, default is empty. Paths to ignore when scanning for JavaScript files.
|
73 |
|
74 |
|
75 | ## Scan javascript files only
|
76 | ```js
|
77 | retire: {
|
78 | js: ['app/src/*'], /** Scan js-files in app/src/ directory and subdirectories. **/
|
79 | options: {
|
80 | }
|
81 | }
|
82 | ```
|
83 |
|
84 | Running ```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`
|
85 |
|
86 | ## Scan node dependencies example
|
87 | ```js
|
88 | retire: {
|
89 | node: ['module/'], /** Scan node project in directory module/. Should be ['.'] for normal projects **/
|
90 | options: {
|
91 | }
|
92 | }
|
93 | ```
|
94 | Running ```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`
|
95 |
|
96 |
|
97 | ## Example output with one vulnerability found in jquery-1.6.js:
|
98 |
|
99 | ```
|
100 | ➜ grunt-retire git:(master) ✗ grunt retire
|
101 | Running "retire:jsPath" (retire) task
|
102 | JS repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json
|
103 | >> test-files/jquery-1.6.js
|
104 | >> ↳ jquery 1.6 has known vulnerabilities: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4969
|
105 | Node repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json
|
106 | ```
|
107 |
|
108 |
|
109 |
|
110 | ## Example output when no vulnerabilities are found
|
111 | ```
|
112 | ➜ grunt-retire git:(master) ✗ grunt retire
|
113 | Running "retire:jsPath" (retire) task
|
114 | JS repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/jsrepository.json
|
115 | Node repository loaded from: https://raw.github.com/RetireJS/retire.js/master/repository/npmrepository.json
|
116 | No vulnerabilities found.
|
117 |
|
118 | Done, without errors.
|
119 | ```
|
120 |
|
121 |
|
122 | ## Release History
|
123 | * 2016-09-02 v1.0.3 Compatible again with Node 0.10.x. v1.0.2 broke compatibility because of find().
|
124 | * 2016-08-29 v1.0.2 Uses retire 1.2.x, which supports ignoring specific vulnerabilities through `.retireignore.json`.
|
125 | * 2016-05-31 v1.0.0 Upgraded dependency for Grunt to 1.0.0 to get remove graceful-js warning. Requires Grunt 1.0.x or newer.
|
126 | * 2016-02-22 v0.3.12 Added support for Grunt 1.0.0.
|
127 | * 2016-02-12 v0.3.11 Upgraded dependencies
|
128 | * 2013-11-12 v0.1.15 Upgrading dependencies. Proxy support
|
129 | * 2013-10-30 v0.1.12 Upgrade to retire v0.1.12. js and node defined as targets.
|
130 | * 2013-10-30 v0.1.0 First version.
|
131 |
|
\ | No newline at end of file |