Gathering detailed insights and metrics for spdx-whitelisted
Gathering detailed insights and metrics for spdx-whitelisted
Gathering detailed insights and metrics for spdx-whitelisted
Gathering detailed insights and metrics for spdx-whitelisted
test whether SPDX expressions satisfy license whitelists
npm install spdx-whitelisted
Typescript
Module System
Node Version
NPM Version
97.5
Supply Chain
99.4
Quality
74.3
Maintenance
100
Vulnerability
99.6
License
Updated on 28 Mar 2019
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
21.8%
Compared to previous day
Last week
-6.8%
Compared to previous week
Last month
1.7%
Compared to previous month
Last year
-62.4%
Compared to previous year
2
4
This package was forked from version 5.0.0 of spdx-satisfies.
1var assert = require('assert') 2var whitelisted = require('spdx-whitelisted')
This package exports a single function of two arguments:
an Object representing an SPDX expression
an Array of Objects, each in the form of a leaf in an SPDX expression data structure
1assert( 2 whitelisted( 3 {license: 'MIT'}, 4 [{license: 'MIT'}] 5 ) 6)
The schema for SPDX expression data structures is the same returned by spdx-expression-parse.
1var parse = require('spdx-expression-parse') 2 3assert(whitelisted( 4 parse('MIT'), 5 [parse('ISC'), parse('MIT')] 6)) 7 8assert(whitelisted( 9 {license: 'Zlib'}, 10 [ 11 {license: 'ISC'}, 12 {license: 'MIT'}, 13 {license: 'Zlib'} 14 ] 15)) 16 17assert(!whitelisted( 18 {license: 'GPL-3.0'}, 19 [ 20 {license: 'ISC'}, 21 {license: 'MIT'} 22 ] 23)) 24 25 26assert(whitelisted( 27 {license: 'GPL-2.0'}, 28 [{license: 'GPL-2.0', plus: true}] 29)) 30 31assert(whitelisted( 32 {license: 'GPL-3.0'}, 33 [{license: 'GPL-2.0', plus: true}] 34)) 35 36assert(whitelisted( 37 {license: 'GPL-1.0', plus: true}, 38 [{license: 'GPL-2.0', plus: true}] 39)) 40 41assert(!whitelisted( 42 {license: 'GPL-1.0'}, 43 [{license: 'GPL-2.0', plus: true}] 44)) 45 46assert(whitelisted( 47 {license: 'GPL-2.0-only'}, 48 [{license: 'GPL-2.0-only'}] 49)) 50 51assert(whitelisted( 52 {license: 'GPL-3.0-only'}, 53 [{license: 'GPL-2.0', plus: true}] 54)) 55 56assert(!whitelisted( 57 {license: 'GPL-2.0'}, 58 [ 59 { 60 license: 'GPL-2.0', 61 plus: true, 62 exception: 'Bison-exception-2.2' 63 } 64 ] 65)) 66 67assert(whitelisted( 68 { 69 license: 'GPL-3.0', 70 exception: 'Bison-exception-2.2' 71 }, 72 [ 73 { 74 license: 'GPL-2.0', 75 plus: true, 76 exception: 'Bison-exception-2.2' 77 } 78 ] 79)) 80 81assert(whitelisted( 82 // (MIT OR GPL-2.0) 83 { 84 left: {license: 'MIT'}, 85 conjunction: 'or', 86 right: {license: 'GPL-2.0'} 87 }, 88 [ 89 {license: 'ISC'}, 90 {license: 'MIT'} 91 ] 92)) 93 94assert(whitelisted( 95 // ((MIT OR Apache-2.0) AND (ISC OR GPL-2.0)) 96 { 97 left: { 98 left: {license: 'MIT'}, 99 conjunction: 'or', 100 right: {license: 'Apache-2.0'} 101 }, 102 conjunction: 'and', 103 right: { 104 left: {license: 'ISC'}, 105 conjunction: 'or', 106 right: {license: 'GPL-2.0'} 107 } 108 }, 109 [ 110 {license: 'Apache-2.0'}, 111 {license: 'ISC'} 112 ] 113)) 114 115assert(whitelisted( 116 // (MIT AND GPL-2.0) 117 { 118 left: {license: 'MIT'}, 119 conjunction: 'and', 120 right: {license: 'GPL-2.0'} 121 }, 122 [ 123 {license: 'MIT'}, 124 {license: 'GPL-2.0'} 125 ] 126)) 127 128assert(!whitelisted( 129 // (MIT AND GPL-2.0) 130 { 131 left: {license: 'MIT'}, 132 conjunction: 'and', 133 right: {license: 'GPL-2.0'} 134 }, 135 [ 136 {license: 'ISC'}, 137 {license: 'GPL-2.0'} 138 ] 139)) 140 141assert(!whitelisted( 142 // (MIT AND (GPL-2.0 OR ISC)) 143 { 144 left: {license: 'MIT'}, 145 conjunction: 'and', 146 right: { 147 left: {license: 'GPL-2.0'}, 148 conjunction: 'or', 149 right: {license: 'ISC'} 150 } 151 }, 152 [{license: 'MIT'}] 153)) 154 155assert(!whitelisted( 156 // (MIT OR Apache-2.0) AND (ISC OR GPL-2.0) 157 { 158 left: { 159 left: {license: 'MIT'}, 160 conjunction: 'or', 161 right: {license: 'Apache-2.0'} 162 }, 163 conjunction: 'and', 164 right: { 165 left: {license: 'ISC'}, 166 conjunction: 'or', 167 right: {license: 'GPL-2.0'} 168 } 169 }, 170 [{license: 'MIT'}] 171))
The exported function does a few naive type checks on arguments. Do not rely on it for rigorous validation.
1assert.throws(function () { 2 whitelisted('MIT', [parse('MIT')]) 3}, /first argument/) 4 5assert.throws(function () { 6 whitelisted({invalid: 'AST'}, [parse('MIT')]) 7}, /first argument/) 8 9assert.throws(function () { 10 whitelisted(parse('MIT'), parse('MIT')) 11}, /second argument/) 12 13assert.throws(function () { 14 whitelisted(parse('MIT'), parse('MIT')) 15}, /second argument/) 16 17assert.throws(function () { 18 whitelisted(parse('MIT'), [{invalid: 'leaf'}]) 19}, /second argument/)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More