We have a script to scan a given PR for vulnerabilities, this will
help you test your local changes. Make sure to [grab a Personal Access Token (PAT)](https://github.com/settings/tokens) before proceeding!
help you test your local changes. Make sure to [grab a Personal Access Token (PAT)](https://github.com/settings/tokens) before proceeding (you'll need `repo` permissions for private repos):
<img width="480" alt="Screenshot 2022-05-12 at 10 22 21" src="https://user-images.githubusercontent.com/2161/168026161-16788a0a-b6c8-428e-bb6a-83ea2a403070.png">
This Action scans your pull requests for vulnerabilities introduced
when adding or updating your project's dependencies. A check in your
Pull Requests will let notify you of the results.
This action scans your pull requests for dependency changes and will raise an error if any new dependencies have existing vulnerabilities. The action is supported by an [API endpoint](https://docs.github.com/en/rest/reference/dependency-graph#dependency-review) that diffs the dependencies between any two revisions.
The action is available for all public repositories, as well as private repositories that have Github Advanced Security licensed.
Please keep in mind that you need a GitHub Advanced Security license if you're running this action on private repos.
## Configuration
You can pass additional options to the Dependency Review
Action using your workflow file. Here's an example workflow with
all the possible configurations:
```yaml
name:'Dependency Review'
on:[pull_request]
permissions:
contents:read
jobs:
dependency-review:
runs-on:ubuntu-latest
steps:
- name:'Checkout Repository'
uses:actions/checkout@v3
- name:Dependency Review
uses:actions/dependency-review-action@v2
with:
# Possible values: "critical", "high", "moderate", "low"
# fail-on-severity: critical
#
# You can only can only include one of these two options: `allow-licenses` and `deny-licences`
#
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
# allow-licenses: GPL-3.0, BSD-3-Clause, MIT
#
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
# deny-licenses: LGPL-2.0, BSD-2-Clause
```
### Vulnerability Severity
By default the action will fail on any pull request that contains a
vulnerable dependency, regardless of the severity level. You can override this behavior by
using the `fail-on-severity` option, which will cause a failure on any pull requests that introduce vulnerabilities of the specified severity level or higher. The possible values are: `critical`, `high`, `moderate`, or `low`. The
action defaults to `low`.
This example will only fail on pull requests with `critical` and `high` vulnerabilities:
```yaml
- name:Dependency Review
uses:actions/dependency-review-action@v2
with:
fail-on-severity:high
```
### Licenses
You can set the action to fail on pull requests based on the licenses of the dependencies
they introduce. With `allow-licenses` you can define the list of licenses
your repository will accept. Alternatively, you can use `deny-licenses` to only
forbid a subset of licenses.
You can use the [Licenses
API](https://docs.github.com/en/rest/licenses) to see the full list of
supported licenses. Use the `spdx_id` field for every license you want
to filter. A couple of examples:
```yaml
# only allow MIT-licensed dependents
- name:Dependency Review
uses:actions/dependency-review-action@v2
with:
allow-licenses:MIT
```
```yaml
# Block Apache 1.1 and 2.0 licensed dependents
- name:Dependency Review
uses:actions/dependency-review-action@v2
with:
deny-licenses:Apache-1.1, Apache-2.0
```
**Important**
* The action will only accept one of the two parameters; an error will
be raised if you provide both.
* By default both parameters are empty (no license checking is
performed).
* We don't have license information for all of your dependents. If we
can't detect the license for a dependency **we will inform you, but the
action won't fail**.
## Blocking pull requests
The Dependency Review GitHub Action check will only block a pull request from being merged if the repository owner has required the check to pass before merging. For more information, see the [documentation on protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-status-checks-before-merging).
## Getting help
If you have bug reports, questions or suggestions please [create a new
(()=>{vare={650:e=>{varr=Object.prototype.toString;varn=typeofBuffer.alloc==="function"&&typeofBuffer.allocUnsafe==="function"&&typeofBuffer.from==="function";functionisArrayBuffer(e){returnr.call(e).slice(8,-1)==="ArrayBuffer"}functionfromArrayBuffer(e,r,t){r>>>=0;varo=e.byteLength-r;if(o<0){thrownewRangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){thrownewRangeError("'length' is out of bounds")}}returnn?Buffer.from(e.slice(r,r+t)):newBuffer(newUint8Array(e.slice(r,r+t)))}functionfromString(e,r){if(typeofr!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){thrownewTypeError('"encoding" must be a valid string encoding')}returnn?Buffer.from(e,r):newBuffer(e,r)}functionbufferFrom(e,r,t){if(typeofe==="number"){thrownewTypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){returnfromArrayBuffer(e,r,t)}if(typeofe==="string"){returnfromString(e,r)}returnn?Buffer.from(e):newBuffer(e)}e.exports=bufferFrom},284:(e,r,n)=>{e=n.nmd(e);vart=n(596).SourceMapConsumer;varo=n(17);vari;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}vara=n(650);functiondynamicRequire(e,r){returne.require(r)}varu=false;vars=false;varl=false;varc="auto";varp={};varf={};varg=/^data:application\/json[^,]+base64,/;varh=[];vard=[];functionisInBrowser(){if(c==="browser")returntrue;if(c==="node")returnfalse;returntypeofwindow!=="undefined"&&typeofXMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}functionhasGlobalProcessEventEmitter(){returntypeofprocess==="object"&&process!==null&&typeofprocess.on==="function"}functionglobalProcessVersion(){if(typeofprocess==="object"&&process!==null){returnprocess.version}else{return""}}functionglobalProcessStderr(){if(typeofprocess==="object"&&process!==null){returnprocess.stderr}}functionglobalProcessExit(e){if(typeofprocess==="object"&&process!==null&&typeofprocess.exit==="function"){returnprocess.exit(e)}}functionhandlerExec(e){returnfunction(r){for(varn=0;n<e.length;n++){vart=e[n](r);if(t){returnt}}returnnull}}varm=handlerExec(h);h.push((function(e){e=e.trim();if(/^file:/.test(e)){e=e.replace(/file:\/\/\/(\w:)?/,(function(e,r){returnr?"":"/"}))}if(einp){returnp[e]}varr="";try{if(!i){varn=newXMLHttpRequest;n.open("GET",e,false);n.send(null);if(n.readyState===4&&n.status===200){r=n.responseText}}elseif(i.existsSync(e)){r=i.readFileSync(e,"utf8")}}catch(e){}returnp[e]=r}));functionsupportRelativeURL(e,r){if(!e)returnr;varn=o.dirname(e);vart=/^\w+:\/\/[^\/]*/.exec(n);vari=t?t[0]:"";vara=n.slice(i.length);if(i&&/^\/\w\:/.test(a)){i+="/";returni+o.resolve(n.slice(i.length),r).replace(/\\/g,"/")}returni+o.resolve(n.slice(i.length),r)}functionretrieveSourceMapURL(e){varr;if(isInBrowser()){try{varn=newXMLHttpRequest;n.open("GET",e,false);n.send(null);r=n.readyState===4?n.responseText:null;vart=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(t){returnt}}catch(e){}}r=m(e);varo=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/gm;vari,a;while(a=o.exec(r))i=a;if(!i)returnnull;returni[1]}varv=handlerExec(d);d.push((function(e){varr=retrieveSourceMapURL(e);if(!r)returnnull;varn;if(g.test(r)){vart=r.slice(r.indexOf(",")+1);n=a(t,"base64").toString();r=e}else{r=supportRelativeURL(e,r);n=m(r)}if(!n){returnnull}return{url:r,map:n}}));functionmapSourcePosition(e){varr=f[e.source];if(!r){varn=v(e.source);if(n){r=f[e.source]={url:n.url,map:newt(n.map)};if(r.map.sourcesContent){r.map.sources.forEach((function(e,n){vart=r.map.sourcesContent[n];if(t){varo=supportRelativeURL(r.url,e);p[o]=t}}))}}else{r=f[e.source]={url:null,map:null}}}if(r&&r.map&&typeofr.map.originalPositionFor==="function"){varo=r.map.originalPositionFor(e);if(o.source!==null){o.source=supportRelativeURL(r.url,o.source);returno}}returne}functionmapEvalOrigin(e){varr=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e);if(r){varn=mapSourcePosition({source:r[2],line:+r[3],column:r[4]-1});return"eval at "+r[1]+" ("+n.source+":"+n.line+":"+(n.column+1)+")"}r=/^eval at ([^(]+) \((.+)\)$/.exec(e);if(r){return"eval at "+r[1]+" ("+mapEvalOrigin(r[2])+")"}returne}functionCallSiteToString(){vare;varr="";if(this.isNative()){r="native"}else{e=this.getScriptNameOrSourceURL();if(!e&&this.isEval()){r=this.getEvalOrigin();r+=", "}if(e){r+=e}else{r+="<anonymous>"}varn=this.getLineNumber();if(n!=null){r+=":"+n;vart=this.getColumnNumber();if(t){r+=":"+t}}}varo="";vari=this.getFunctionName();vara=true;varu=this.isConstructor();vars=!(this.isToplevel()||u);if(s){varl=this.getTypeName();if(l==="[object Object]"){l="null"}varc=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"<anonymous>")}}elseif(u){o+="new "+(i||"<anonymous>")}elseif(i){o+=i}elLine truncated
(()=>{vare={650:e=>{varr=Object.prototype.toString;varn=typeofBuffer.alloc==="function"&&typeofBuffer.allocUnsafe==="function"&&typeofBuffer.from==="function";functionisArrayBuffer(e){returnr.call(e).slice(8,-1)==="ArrayBuffer"}functionfromArrayBuffer(e,r,t){r>>>=0;varo=e.byteLength-r;if(o<0){thrownewRangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){thrownewRangeError("'length' is out of bounds")}}returnn?Buffer.from(e.slice(r,r+t)):newBuffer(newUint8Array(e.slice(r,r+t)))}functionfromString(e,r){if(typeofr!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){thrownewTypeError('"encoding" must be a valid string encoding')}returnn?Buffer.from(e,r):newBuffer(e,r)}functionbufferFrom(e,r,t){if(typeofe==="number"){thrownewTypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){returnfromArrayBuffer(e,r,t)}if(typeofe==="string"){returnfromString(e,r)}returnn?Buffer.from(e):newBuffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{vart=n(339);varo=Object.prototype.hasOwnProperty;vari=typeofMap!=="undefined";functionArraySet(){this._array=[];this._set=i?newMap:Object.create(null)}ArraySet.fromArray=functionArraySet_fromArray(e,r){varn=newArraySet;for(vart=0,o=e.length;t<o;t++){n.add(e[t],r)}returnn};ArraySet.prototype.size=functionArraySet_size(){returni?this._set.size:Object.getOwnPropertyNames(this._set).length};ArraySet.prototype.add=functionArraySet_add(e,r){varn=i?e:t.toSetString(e);vara=i?this.has(e):o.call(this._set,n);varu=this._array.length;if(!a||r){this._array.push(e)}if(!a){if(i){this._set.set(e,u)}else{this._set[n]=u}}};ArraySet.prototype.has=functionArraySet_has(e){if(i){returnthis._set.has(e)}else{varr=t.toSetString(e);returno.call(this._set,r)}};ArraySet.prototype.indexOf=functionArraySet_indexOf(e){if(i){varr=this._set.get(e);if(r>=0){returnr}}else{varn=t.toSetString(e);if(o.call(this._set,n)){returnthis._set[n]}}thrownewError('"'+e+'" is not in the set.')};ArraySet.prototype.at=functionArraySet_at(e){if(e>=0&&e<this._array.length){returnthis._array[e]}thrownewError("No element indexed by "+e)};ArraySet.prototype.toArray=functionArraySet_toArray(){returnthis._array.slice()};r.I=ArraySet},449:(e,r,n)=>{vart=n(190);varo=5;vari=1<<o;vara=i-1;varu=i;functiontoVLQSigned(e){returne<0?(-e<<1)+1:(e<<1)+0}functionfromVLQSigned(e){varr=(e&1)===1;varn=e>>1;returnr?-n:n}r.encode=functionbase64VLQ_encode(e){varr="";varn;vari=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);returnr};r.decode=functionbase64VLQ_decode(e,r,n){vari=e.length;vars=0;varl=0;varc,p;do{if(r>=i){thrownewError("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){thrownewError("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<<l);l+=o}while(c);n.value=fromVLQSigned(s);n.rest=r}},190:(e,r)=>{varn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e<n.length){returnn[e]}thrownewTypeError("Must be between 0 and 63: "+e)};r.decode=function(e){varr=65;varn=90;vart=97;varo=122;vari=48;vara=57;varu=43;vars=47;varl=26;varc=52;if(r<=e&&e<=n){returne-r}if(t<=e&&e<=o){returne-t+l}if(i<=e&&e<=a){returne-i+c}if(e==u){return62}if(e==s){return63}return-1}},345:(e,r)=>{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;functionrecursiveSearch(e,n,t,o,i,a){varu=Math.floor((n-e)/2)+e;vars=i(t,o[u],true);if(s===0){returnu}elseif(s>0){if(n-u>1){returnrecursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){returnn<o.length?n:-1}else{returnu}}else{if(u-e>1){returnrecursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){returnu}else{returne<0?-1:e}}}r.search=functionsearch(e,n,t,o){if(n.length===0){return-1}vari=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}returni}},680:(e,r,n)=>{vart=n(339);functiongeneratedPositionAfter(e,r){varn=e.generatedLine;varo=r.generatedLine;vari=e.generatedColumn;vara=r.generatedColumn;returno>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}functionMappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=functionMappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=functionMappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=functionMappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}returnthis._array};r.H=MappingList},758:(e,r)=>{functionswap(e,r,n){vart=e[r];e[r]=e[n];e[n]=t}functionrandomIntInRange(e,r){returnMath.round(e+Math.random()*(r-e))}functiondoQuickSort(e,r,n,t){if(n<t){varo=randomIntInRange(n,t);vari=n-1;swap(e,o,t);vara=e[t];for(varu=n;u<t;u++){if(r(e[u],Line truncated
* Loops through a list of changes, filtering and returning the
* ones that don't conform to the licenses allow/deny lists.
*
* Keep in mind that we don't let users specify both an allow and a deny
* list in their config files, so this code works under the assumption that
* one of the two list parameters will be empty. If both lists are provided,
* we will ignore the deny list.
* @param {Change[]} changes The list of changes to filter.
* @param { { allow?: string[], deny?: string[]}} licenses An object with `allow`/`deny` keys, each containing a list of licenses.
* @returns {[Array<Change>, Array<Change]} A tuple where the first element is the list of denied changes and the second one is the list of changes with unknown licenses
`Dependency review is not supported on this repository. Please ensure that Dependency graph is enabled, see https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/settings/security_analysis`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.