npq 3.13.5 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,10 +7,7 @@ const BaseMarshall = require('./baseMarshall')
7
7
  const { marshallCategories } = require('./constants')
8
8
 
9
9
  const MARSHALL_NAME = 'snyk'
10
- const SNYK_API_URL = 'https://snyk.io/api/v1/vuln/npm'
11
-
12
10
  const SNYK_PACKAGE_PAGE = 'https://snyk.io/vuln/npm:'
13
- const SNYK_API_TOKEN = process.env.SNYK_TOKEN
14
11
  const SNYK_CONFIG_FILE = '.config/configstore/snyk.json'
15
12
 
16
13
  class Marshall extends BaseMarshall {
@@ -20,6 +17,11 @@ class Marshall extends BaseMarshall {
20
17
  this.categoryId = marshallCategories.SupplyChainSecurity.id
21
18
 
22
19
  this.snykApiToken = this.getSnykToken()
20
+ this.snykApiUrl = this.getSnykApiUrl()
21
+ }
22
+
23
+ getSnykApiUrl() {
24
+ return process.env.SNYK_API_URL || process.env.SNYK_API || 'https://snyk.io/api/v1/vuln/npm'
23
25
  }
24
26
 
25
27
  title() {
@@ -119,7 +121,7 @@ class Marshall extends BaseMarshall {
119
121
  return this.getOsvVulnerabilityInfo({ packageName, packageVersion })
120
122
  }
121
123
 
122
- const url = `${SNYK_API_URL}/${encodeURIComponent(packageName + '@' + packageVersion)}`
124
+ const url = `${this.snykApiUrl}/${encodeURIComponent(packageName + '@' + packageVersion)}`
123
125
 
124
126
  return fetch(url, {
125
127
  headers: {
@@ -150,8 +152,11 @@ class Marshall extends BaseMarshall {
150
152
  }
151
153
 
152
154
  getSnykToken() {
153
- if (SNYK_API_TOKEN) {
154
- return SNYK_API_TOKEN
155
+ // Check for SNYK_API_TOKEN first, then fall back to SNYK_TOKEN
156
+ const snykApiToken = process.env.SNYK_API_TOKEN || process.env.SNYK_TOKEN
157
+
158
+ if (snykApiToken) {
159
+ return snykApiToken
155
160
  }
156
161
 
157
162
  const snykConfigPath = path.join(os.homedir(), SNYK_CONFIG_FILE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npq",
3
- "version": "3.13.5",
3
+ "version": "3.14.0",
4
4
  "description": "marshall your npm/npm package installs with high quality and class 🎖",
5
5
  "bin": {
6
6
  "npq": "./bin/npq.js",