socket 1.1.8 → 1.1.11

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.
Files changed (219) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +3 -3
  3. package/dist/cli.js +163 -94
  4. package/dist/cli.js.map +1 -1
  5. package/dist/constants.js +11 -8
  6. package/dist/constants.js.map +1 -1
  7. package/dist/flags.js +16 -17
  8. package/dist/flags.js.map +1 -1
  9. package/dist/shadow-npm-inject.js +8 -10
  10. package/dist/shadow-npm-inject.js.map +1 -1
  11. package/dist/socket-completion.bash +0 -0
  12. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  13. package/dist/types/commands/analytics/cmd-analytics.d.mts +2 -3
  14. package/dist/types/commands/analytics/cmd-analytics.d.mts.map +1 -1
  15. package/dist/types/commands/audit-log/cmd-audit-log.d.mts +2 -3
  16. package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +1 -1
  17. package/dist/types/commands/ci/cmd-ci.d.mts +2 -3
  18. package/dist/types/commands/ci/cmd-ci.d.mts.map +1 -1
  19. package/dist/types/commands/config/cmd-config-auto.d.mts +2 -3
  20. package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
  21. package/dist/types/commands/config/cmd-config-get.d.mts +2 -3
  22. package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
  23. package/dist/types/commands/config/cmd-config-list.d.mts +2 -3
  24. package/dist/types/commands/config/cmd-config-list.d.mts.map +1 -1
  25. package/dist/types/commands/config/cmd-config-set.d.mts +2 -3
  26. package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
  27. package/dist/types/commands/config/cmd-config-unset.d.mts +2 -3
  28. package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
  29. package/dist/types/commands/fix/cmd-fix.d.mts +2 -3
  30. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  31. package/dist/types/commands/fix/env-helpers.d.mts +1 -1
  32. package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
  33. package/dist/types/commands/fix/git.d.mts +1 -1
  34. package/dist/types/commands/fix/git.d.mts.map +1 -1
  35. package/dist/types/commands/fix/handle-fix.d.mts +5 -0
  36. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  37. package/dist/types/commands/fix/pull-request.d.mts +1 -1
  38. package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
  39. package/dist/types/commands/install/cmd-install-completion.d.mts +2 -3
  40. package/dist/types/commands/install/cmd-install-completion.d.mts.map +1 -1
  41. package/dist/types/commands/json/cmd-json.d.mts +2 -3
  42. package/dist/types/commands/json/cmd-json.d.mts.map +1 -1
  43. package/dist/types/commands/login/cmd-login.d.mts +2 -3
  44. package/dist/types/commands/login/cmd-login.d.mts.map +1 -1
  45. package/dist/types/commands/logout/cmd-logout.d.mts +2 -3
  46. package/dist/types/commands/logout/cmd-logout.d.mts.map +1 -1
  47. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +2 -3
  48. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +1 -1
  49. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +2 -3
  50. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
  51. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +2 -3
  52. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +1 -1
  53. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +2 -3
  54. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
  55. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +2 -3
  56. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
  57. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +2 -3
  58. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
  59. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +2 -3
  60. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +1 -1
  61. package/dist/types/commands/manifest/cmd-manifest.d.mts +2 -3
  62. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
  63. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
  64. package/dist/types/commands/npm/cmd-npm.d.mts +2 -3
  65. package/dist/types/commands/npm/cmd-npm.d.mts.map +1 -1
  66. package/dist/types/commands/npx/cmd-npx.d.mts +2 -3
  67. package/dist/types/commands/npx/cmd-npx.d.mts.map +1 -1
  68. package/dist/types/commands/oops/cmd-oops.d.mts +2 -3
  69. package/dist/types/commands/oops/cmd-oops.d.mts.map +1 -1
  70. package/dist/types/commands/optimize/cmd-optimize.d.mts +2 -3
  71. package/dist/types/commands/optimize/cmd-optimize.d.mts.map +1 -1
  72. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +2 -3
  73. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +1 -1
  74. package/dist/types/commands/organization/cmd-organization-list.d.mts +2 -3
  75. package/dist/types/commands/organization/cmd-organization-list.d.mts.map +1 -1
  76. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +2 -3
  77. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +1 -1
  78. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +2 -3
  79. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +1 -1
  80. package/dist/types/commands/organization/cmd-organization-quota.d.mts +2 -3
  81. package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +1 -1
  82. package/dist/types/commands/package/cmd-package-score.d.mts +2 -3
  83. package/dist/types/commands/package/cmd-package-score.d.mts.map +1 -1
  84. package/dist/types/commands/package/cmd-package-shallow.d.mts +2 -3
  85. package/dist/types/commands/package/cmd-package-shallow.d.mts.map +1 -1
  86. package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +1 -1
  87. package/dist/types/commands/patch/cmd-patch.d.mts +2 -3
  88. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  89. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  90. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +2 -3
  91. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +1 -1
  92. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +2 -3
  93. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +1 -1
  94. package/dist/types/commands/repository/cmd-repository-create.d.mts +2 -3
  95. package/dist/types/commands/repository/cmd-repository-create.d.mts.map +1 -1
  96. package/dist/types/commands/repository/cmd-repository-del.d.mts +2 -3
  97. package/dist/types/commands/repository/cmd-repository-del.d.mts.map +1 -1
  98. package/dist/types/commands/repository/cmd-repository-list.d.mts +2 -3
  99. package/dist/types/commands/repository/cmd-repository-list.d.mts.map +1 -1
  100. package/dist/types/commands/repository/cmd-repository-update.d.mts +2 -3
  101. package/dist/types/commands/repository/cmd-repository-update.d.mts.map +1 -1
  102. package/dist/types/commands/repository/cmd-repository-view.d.mts +2 -3
  103. package/dist/types/commands/repository/cmd-repository-view.d.mts.map +1 -1
  104. package/dist/types/commands/repository/handle-list-repos.d.mts +2 -1
  105. package/dist/types/commands/repository/handle-list-repos.d.mts.map +1 -1
  106. package/dist/types/commands/repository/output-list-repos.d.mts +2 -1
  107. package/dist/types/commands/repository/output-list-repos.d.mts.map +1 -1
  108. package/dist/types/commands/repository/types.d.mts +2 -0
  109. package/dist/types/commands/repository/types.d.mts.map +1 -0
  110. package/dist/types/commands/scan/cmd-scan-create.d.mts +2 -3
  111. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
  112. package/dist/types/commands/scan/cmd-scan-del.d.mts +2 -3
  113. package/dist/types/commands/scan/cmd-scan-del.d.mts.map +1 -1
  114. package/dist/types/commands/scan/cmd-scan-diff.d.mts +2 -3
  115. package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +1 -1
  116. package/dist/types/commands/scan/cmd-scan-github.d.mts +2 -3
  117. package/dist/types/commands/scan/cmd-scan-github.d.mts.map +1 -1
  118. package/dist/types/commands/scan/cmd-scan-list.d.mts.map +1 -1
  119. package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +1 -1
  120. package/dist/types/commands/scan/cmd-scan-reach.d.mts +2 -3
  121. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +1 -1
  122. package/dist/types/commands/scan/cmd-scan-report.d.mts.map +1 -1
  123. package/dist/types/commands/scan/cmd-scan-setup.d.mts +2 -3
  124. package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +1 -1
  125. package/dist/types/commands/scan/cmd-scan-view.d.mts.map +1 -1
  126. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +2 -3
  127. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
  128. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +2 -3
  129. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +1 -1
  130. package/dist/types/commands/wrapper/cmd-wrapper.d.mts +2 -3
  131. package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +1 -1
  132. package/dist/types/commands.d.mts +21 -63
  133. package/dist/types/commands.d.mts.map +1 -1
  134. package/dist/types/constants.d.mts +3 -1
  135. package/dist/types/constants.d.mts.map +1 -1
  136. package/dist/types/flags.d.mts.map +1 -1
  137. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  138. package/dist/types/utils/alerts-map.d.mts.map +1 -1
  139. package/dist/types/utils/api.d.mts +22 -1
  140. package/dist/types/utils/api.d.mts.map +1 -1
  141. package/dist/types/utils/cmd.d.mts +25 -1
  142. package/dist/types/utils/cmd.d.mts.map +1 -1
  143. package/dist/types/utils/config.d.mts +1 -1
  144. package/dist/types/utils/config.d.mts.map +1 -1
  145. package/dist/types/utils/cve-to-ghsa.d.mts +6 -0
  146. package/dist/types/utils/cve-to-ghsa.d.mts.map +1 -0
  147. package/dist/types/utils/git.d.mts +4 -4
  148. package/dist/types/utils/git.d.mts.map +1 -1
  149. package/dist/types/utils/github.d.mts.map +1 -1
  150. package/dist/types/utils/lockfile.d.mts +1 -1
  151. package/dist/types/utils/lockfile.d.mts.map +1 -1
  152. package/dist/types/utils/meow-with-subcommands.d.mts +16 -1
  153. package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
  154. package/dist/types/utils/npm-config.d.mts +1 -1
  155. package/dist/types/utils/npm-config.d.mts.map +1 -1
  156. package/dist/types/utils/npm-package-arg.d.mts +1 -1
  157. package/dist/types/utils/npm-package-arg.d.mts.map +1 -1
  158. package/dist/types/utils/output-formatting.d.mts.map +1 -1
  159. package/dist/types/utils/pnpm.d.mts +2 -2
  160. package/dist/types/utils/pnpm.d.mts.map +1 -1
  161. package/dist/types/utils/purl-to-ghsa.d.mts +6 -0
  162. package/dist/types/utils/purl-to-ghsa.d.mts.map +1 -0
  163. package/dist/types/utils/purl.d.mts +6 -6
  164. package/dist/types/utils/purl.d.mts.map +1 -1
  165. package/dist/types/utils/requirements.d.mts +4 -0
  166. package/dist/types/utils/requirements.d.mts.map +1 -1
  167. package/dist/types/utils/sdk.d.mts.map +1 -1
  168. package/dist/types/utils/semver.d.mts +3 -4
  169. package/dist/types/utils/semver.d.mts.map +1 -1
  170. package/dist/types/utils/strings.d.mts +2 -0
  171. package/dist/types/utils/strings.d.mts.map +1 -0
  172. package/dist/utils.js +379 -85
  173. package/dist/utils.js.map +1 -1
  174. package/dist/vendor.js +42175 -50468
  175. package/external/@socketsecurity/registry/lib/url.js +13 -12
  176. package/external/blessed/lib/tput.js +13 -13
  177. package/external/blessed/lib/widgets/ansiimage.js +1 -1
  178. package/external/blessed/lib/widgets/bigtext.js +1 -1
  179. package/external/blessed/lib/widgets/box.js +1 -1
  180. package/external/blessed/lib/widgets/button.js +1 -1
  181. package/external/blessed/lib/widgets/checkbox.js +1 -1
  182. package/external/blessed/lib/widgets/element.js +1 -1
  183. package/external/blessed/lib/widgets/filemanager.js +1 -1
  184. package/external/blessed/lib/widgets/form.js +1 -1
  185. package/external/blessed/lib/widgets/image.js +1 -1
  186. package/external/blessed/lib/widgets/input.js +1 -1
  187. package/external/blessed/lib/widgets/layout.js +1 -1
  188. package/external/blessed/lib/widgets/line.js +1 -1
  189. package/external/blessed/lib/widgets/list.js +1 -1
  190. package/external/blessed/lib/widgets/listbar.js +1 -1
  191. package/external/blessed/lib/widgets/listtable.js +1 -1
  192. package/external/blessed/lib/widgets/loading.js +1 -1
  193. package/external/blessed/lib/widgets/log.js +1 -1
  194. package/external/blessed/lib/widgets/message.js +1 -1
  195. package/external/blessed/lib/widgets/node.js +3 -2
  196. package/external/blessed/lib/widgets/overlayimage.js +1 -1
  197. package/external/blessed/lib/widgets/progressbar.js +1 -1
  198. package/external/blessed/lib/widgets/prompt.js +1 -1
  199. package/external/blessed/lib/widgets/question.js +1 -1
  200. package/external/blessed/lib/widgets/radiobutton.js +1 -1
  201. package/external/blessed/lib/widgets/radioset.js +1 -1
  202. package/external/blessed/lib/widgets/screen.js +8 -6
  203. package/external/blessed/lib/widgets/scrollablebox.js +1 -1
  204. package/external/blessed/lib/widgets/scrollabletext.js +1 -1
  205. package/external/blessed/lib/widgets/table.js +1 -1
  206. package/external/blessed/lib/widgets/terminal.js +1 -1
  207. package/external/blessed/lib/widgets/text.js +1 -1
  208. package/external/blessed/lib/widgets/textarea.js +1 -1
  209. package/external/blessed/lib/widgets/textbox.js +1 -1
  210. package/external/blessed/lib/widgets/video.js +1 -1
  211. package/external/blessed/vendor/tng.js +11 -4
  212. package/external/blessed-contrib/lib/widget/charts/bar.js +4 -4
  213. package/external/blessed-contrib/lib/widget/charts/line.js +4 -4
  214. package/logo-dark.png +0 -0
  215. package/logo-light.png +0 -0
  216. package/package.json +65 -96
  217. package/requirements.json +2 -2
  218. package/shadow-bin/npm +0 -0
  219. package/shadow-bin/npx +0 -0
package/CHANGELOG.md CHANGED
@@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
- ## [1.1.8](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.8) - 2025-09-04
7
+ ## [1.1.9](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.9) - 2025-09-11
8
+
9
+ ### Added
10
+ - Enhanced `socket fix --id` to accept CVE IDs and PURLs in addition to GHSA IDs
11
+
12
+ ### Fixed
13
+ - Correct SOCKET_CLI_API_TIMEOUT environment variable lookup
14
+
15
+ ## [1.1.8](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.8) - 2025-09-11
8
16
 
9
17
  ### Changed
10
18
  - Made insufficient permissions errors more helpful
package/README.md CHANGED
@@ -111,8 +111,8 @@ npm exec socket
111
111
  <br/>
112
112
  <div align="center">
113
113
  <picture>
114
- <source media="(prefers-color-scheme: dark)" srcset="logo-white.png">
115
- <source media="(prefers-color-scheme: light)" srcset="logo-black.png">
116
- <img width="324" height="108" alt="Socket Logo" src="logo-black.png">
114
+ <source media="(prefers-color-scheme: dark)" srcset="logo-dark.png">
115
+ <source media="(prefers-color-scheme: light)" srcset="logo-light.png">
116
+ <img width="324" height="108" alt="Socket Logo" src="logo-light.png">
117
117
  </picture>
118
118
  </div>
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ var require$$9 = require('../external/@socketsecurity/registry/lib/debug');
7
7
  var logger = require('../external/@socketsecurity/registry/lib/logger');
8
8
  var utils = require('./utils.js');
9
9
  var fs = require('node:fs/promises');
10
- var Module = require('node:module');
10
+ var require$$5 = require('node:module');
11
11
  var constants = require('./constants.js');
12
12
  var flags = require('./flags.js');
13
13
  var path = require('node:path');
@@ -68,7 +68,7 @@ async function fetchRepoAnalyticsData(repo, time, options) {
68
68
 
69
69
  // Note: Widgets does not seem to actually work as code :'(
70
70
 
71
- const require$5 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
71
+ const require$5 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
72
72
  const METRICS = ['total_critical_alerts', 'total_high_alerts', 'total_medium_alerts', 'total_low_alerts', 'total_critical_added', 'total_medium_added', 'total_low_added', 'total_high_added', 'total_critical_prevented', 'total_high_prevented', 'total_medium_prevented', 'total_low_prevented'];
73
73
 
74
74
  // Note: This maps `new Date(date).getMonth()` to English three letters
@@ -500,7 +500,7 @@ async function fetchAuditLog(config, options) {
500
500
  });
501
501
  }
502
502
 
503
- const require$4 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
503
+ const require$4 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
504
504
  async function outputAuditLog(result, {
505
505
  logType,
506
506
  orgSlug,
@@ -3263,7 +3263,7 @@ async function openSocketFixPr(owner, repo, branch, ghsaIds, options) {
3263
3263
  }
3264
3264
  require$$9.debugFn('error', message);
3265
3265
  }
3266
- return null;
3266
+ return undefined;
3267
3267
  }
3268
3268
  async function getSocketFixPrs(owner, repo, options) {
3269
3269
  return (await getSocketFixPrsWithContext(owner, repo, options)).map(d => d.match);
@@ -3388,7 +3388,7 @@ function ciRepoInfo() {
3388
3388
  const ownerSlashRepo = GITHUB_REPOSITORY;
3389
3389
  const slashIndex = ownerSlashRepo.indexOf('/');
3390
3390
  if (slashIndex === -1) {
3391
- return null;
3391
+ return undefined;
3392
3392
  }
3393
3393
  return {
3394
3394
  owner: ownerSlashRepo.slice(0, slashIndex),
@@ -3411,7 +3411,7 @@ async function getFixEnv() {
3411
3411
  const envVars = [...(constants.default.ENV.CI ? [] : ['process.env.CI']), ...(gitEmail ? [] : ['process.env.SOCKET_CLI_GIT_USER_EMAIL']), ...(gitUser ? [] : ['process.env.SOCKET_CLI_GIT_USER_NAME']), ...(githubToken ? [] : ['process.env.GITHUB_TOKEN'])];
3412
3412
  require$$9.debugFn('notice', `miss: fixEnv.isCi is false, expected ${arrays.joinAnd(envVars)} to be set`);
3413
3413
  }
3414
- let repoInfo = null;
3414
+ let repoInfo;
3415
3415
  if (isCi) {
3416
3416
  repoInfo = ciRepoInfo();
3417
3417
  }
@@ -3710,6 +3710,59 @@ async function outputFixResult(result, outputKind) {
3710
3710
  logger.logger.success('Finished!');
3711
3711
  }
3712
3712
 
3713
+ const GHSA_FORMAT_REGEXP = /^GHSA-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/;
3714
+ const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
3715
+ /**
3716
+ * Converts mixed CVE/GHSA/PURL IDs to GHSA IDs only.
3717
+ * Filters out invalid IDs and logs conversion results.
3718
+ */
3719
+ async function convertIdsToGhsas(ids) {
3720
+ const validGhsas = [];
3721
+ const errors = [];
3722
+ for (const id of ids) {
3723
+ const trimmedId = id.trim();
3724
+ if (trimmedId.startsWith('GHSA-')) {
3725
+ // Already a GHSA ID, validate format
3726
+ if (GHSA_FORMAT_REGEXP.test(trimmedId)) {
3727
+ validGhsas.push(trimmedId);
3728
+ } else {
3729
+ errors.push(`Invalid GHSA format: ${trimmedId}`);
3730
+ }
3731
+ } else if (trimmedId.startsWith('CVE-')) {
3732
+ // Convert CVE to GHSA
3733
+ if (!CVE_FORMAT_REGEXP.test(trimmedId)) {
3734
+ errors.push(`Invalid CVE format: ${trimmedId}`);
3735
+ continue;
3736
+ }
3737
+
3738
+ // eslint-disable-next-line no-await-in-loop
3739
+ const conversionResult = await utils.convertCveToGhsa(trimmedId);
3740
+ if (conversionResult.ok) {
3741
+ validGhsas.push(conversionResult.data);
3742
+ logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data}`);
3743
+ } else {
3744
+ errors.push(`${trimmedId}: ${conversionResult.message}`);
3745
+ }
3746
+ } else if (trimmedId.startsWith('pkg:')) {
3747
+ // Convert PURL to GHSAs
3748
+ // eslint-disable-next-line no-await-in-loop
3749
+ const conversionResult = await utils.convertPurlToGhsas(trimmedId);
3750
+ if (conversionResult.ok && conversionResult.data.length) {
3751
+ validGhsas.push(...conversionResult.data);
3752
+ logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${conversionResult.data.join(', ')}`);
3753
+ } else {
3754
+ errors.push(`${trimmedId}: ${conversionResult.message || 'No GHSAs found'}`);
3755
+ }
3756
+ } else {
3757
+ // Neither CVE, GHSA, nor PURL, skip
3758
+ errors.push(`Unsupported ID format (expected CVE, GHSA, or PURL): ${trimmedId}`);
3759
+ }
3760
+ }
3761
+ if (errors.length) {
3762
+ logger.logger.warn(`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`);
3763
+ }
3764
+ return validGhsas;
3765
+ }
3713
3766
  async function handleFix({
3714
3767
  autopilot,
3715
3768
  cwd,
@@ -3726,7 +3779,8 @@ async function handleFix({
3726
3779
  await outputFixResult(await coanaFix({
3727
3780
  autopilot,
3728
3781
  cwd,
3729
- ghsas,
3782
+ // Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
3783
+ ghsas: await convertIdsToGhsas(ghsas),
3730
3784
  limit,
3731
3785
  orgSlug,
3732
3786
  rangeStyle,
@@ -3753,7 +3807,11 @@ const generalFlags$2 = {
3753
3807
  id: {
3754
3808
  type: 'string',
3755
3809
  default: [],
3756
- description: `Provide a list of ${vendor.terminalLinkExports('GHSA IDs', 'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids')} to compute fixes for, as either a comma separated value or as multiple flags`,
3810
+ description: `Provide a list of vulnerability identifiers to compute fixes for:
3811
+ - ${vendor.terminalLinkExports('GHSA IDs', 'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids')} (e.g., GHSA-xxxx-xxxx-xxxx)
3812
+ - ${vendor.terminalLinkExports('CVE IDs', 'https://cve.mitre.org/cve/identifiers/')} (e.g., CVE-${new Date().getFullYear()}-1234) - automatically converted to GHSA
3813
+ - ${vendor.terminalLinkExports('PURLs', 'https://github.com/package-url/purl-spec')} (e.g., pkg:npm/package@1.0.0) - automatically converted to GHSA
3814
+ Can be provided as comma separated values or as multiple flags`,
3757
3815
  isMultiple: true
3758
3816
  },
3759
3817
  limit: {
@@ -3767,14 +3825,8 @@ const generalFlags$2 = {
3767
3825
  description: `
3768
3826
  Define how dependency version ranges are updated in package.json (default 'preserve').
3769
3827
  Available styles:
3770
- * caret - Use ^ range for compatible updates (e.g. ^1.2.3)
3771
- * gt - Use > to allow any newer version (e.g. >1.2.3)
3772
- * gte - Use >= to allow any newer version (e.g. >=1.2.3)
3773
- * lt - Use < to allow only lower versions (e.g. <1.2.3)
3774
- * lte - Use <= to allow only lower versions (e.g. <=1.2.3)
3775
3828
  * pin - Use the exact version (e.g. 1.2.3)
3776
3829
  * preserve - Retain the existing version range style as-is
3777
- * tilde - Use ~ range for patch/minor updates (e.g. ~1.2.3)
3778
3830
  `.trim()
3779
3831
  }
3780
3832
  };
@@ -3875,23 +3927,6 @@ async function run$I(argv, importMeta, {
3875
3927
  } = cli.flags;
3876
3928
  const dryRun = !!cli.flags['dryRun'];
3877
3929
  const minSatisfying = cli.flags['minSatisfying'] || !maxSatisfying;
3878
- const rawPurls = utils.cmdFlagValueToArray(cli.flags['purl']);
3879
- const purls = [];
3880
- for (const purl of rawPurls) {
3881
- const version = utils.getPurlObject(purl, {
3882
- throws: false
3883
- })?.version;
3884
- if (version) {
3885
- purls.push(purl);
3886
- } else {
3887
- logger.logger.warn(`--purl ${purl} is missing a version and will be ignored.`);
3888
- }
3889
- }
3890
- if (rawPurls.length !== purls.length && !purls.length) {
3891
- process.exitCode = 1;
3892
- logger.logger.fail('No valid --purl values provided.');
3893
- return;
3894
- }
3895
3930
  const outputKind = utils.getOutputKind(json, markdown);
3896
3931
  const wasValidInput = utils.checkCommandInput(outputKind, {
3897
3932
  test: utils.RangeStyles.includes(rangeStyle),
@@ -3924,7 +3959,7 @@ async function run$I(argv, importMeta, {
3924
3959
  const {
3925
3960
  spinner
3926
3961
  } = constants.default;
3927
- const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa'])]);
3962
+ const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
3928
3963
  await handleFix({
3929
3964
  autopilot,
3930
3965
  cwd,
@@ -4020,7 +4055,7 @@ async function setupTabCompletion(targetName) {
4020
4055
  };
4021
4056
  }
4022
4057
  function getTabCompletionScriptRaw() {
4023
- const sourceDir = path.dirname(require$$0.fileURLToPath(require('node:url').pathToFileURL(__filename).href));
4058
+ const sourceDir = path.dirname(require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href))));
4024
4059
  const sourcePath = path.join(sourceDir, 'socket-completion.bash');
4025
4060
  if (!fs$1.existsSync(sourcePath)) {
4026
4061
  return {
@@ -4498,7 +4533,6 @@ function argvToArray(argvObj) {
4498
4533
  return result;
4499
4534
  }
4500
4535
  async function runCdxgen(argvObj) {
4501
- let cleanupPackageLock = false;
4502
4536
  const argvMutable = {
4503
4537
  __proto__: null,
4504
4538
  ...argvObj
@@ -4511,6 +4545,7 @@ async function runCdxgen(argvObj) {
4511
4545
  },
4512
4546
  stdio: 'inherit'
4513
4547
  };
4548
+ let cleanupPackageLock = false;
4514
4549
  if (argvMutable['type'] !== YARN && nodejsPlatformTypes.has(argvMutable['type']) && fs$1.existsSync(`./${YARN_LOCK}`)) {
4515
4550
  if (fs$1.existsSync(`./${PACKAGE_LOCK_JSON}`)) {
4516
4551
  argvMutable['type'] = constants.NPM;
@@ -4752,9 +4787,13 @@ const cmdManifestCdxgen = {
4752
4787
  hidden: config$e.hidden,
4753
4788
  run: run$D
4754
4789
  };
4755
- async function run$D(argv, importMeta, {
4756
- parentName
4757
- }) {
4790
+ async function run$D(argv, importMeta, context) {
4791
+ const {
4792
+ parentName
4793
+ } = {
4794
+ __proto__: null,
4795
+ ...context
4796
+ };
4758
4797
  const cli = utils.meowOrExit({
4759
4798
  // Don't let meow take over --help.
4760
4799
  argv: argv.filter(a => !utils.isHelpFlag(a)),
@@ -4762,11 +4801,17 @@ async function run$D(argv, importMeta, {
4762
4801
  importMeta,
4763
4802
  parentName
4764
4803
  });
4765
- const dryRun = !!cli.flags['dryRun'];
4804
+ const {
4805
+ dryRun
4806
+ } = cli.flags;
4766
4807
 
4767
- // TODO: Convert yargs to meow.
4808
+ // Filter Socket flags from argv but keep --no-banner and --help for cdxgen
4809
+ const argsToProcess = utils.filterFlags(argv, {
4810
+ ...flags.commonFlags,
4811
+ ...flags.outputFlags
4812
+ }, ['--no-banner', '--help', '-h']);
4768
4813
  const yargv = {
4769
- ...vendor.yargsParser(argv, yargsConfig)
4814
+ ...vendor.yargsParser(argsToProcess, yargsConfig)
4770
4815
  };
4771
4816
  const pathArgs = [];
4772
4817
  const unknowns = [];
@@ -6072,7 +6117,7 @@ async function run$w(argv, importMeta, {
6072
6117
  });
6073
6118
  }
6074
6119
 
6075
- const require$3 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
6120
+ const require$3 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6076
6121
  const CMD_NAME$p = constants.NPM;
6077
6122
  const description$u = 'Run npm with the Socket wrapper';
6078
6123
  const hidden$o = false;
@@ -6081,9 +6126,13 @@ const cmdNpm = {
6081
6126
  hidden: hidden$o,
6082
6127
  run: run$v
6083
6128
  };
6084
- async function run$v(argv, importMeta, {
6085
- parentName
6086
- }) {
6129
+ async function run$v(argv, importMeta, context) {
6130
+ const {
6131
+ parentName
6132
+ } = {
6133
+ __proto__: null,
6134
+ ...context
6135
+ };
6087
6136
  const config = {
6088
6137
  commandName: CMD_NAME$p,
6089
6138
  description: description$u,
@@ -6121,9 +6170,15 @@ async function run$v(argv, importMeta, {
6121
6170
  }
6122
6171
  const shadowBin = /*@__PURE__*/require$3(constants.default.shadowNpmBinPath);
6123
6172
  process.exitCode = 1;
6173
+
6174
+ // Filter Socket flags from argv but keep --json for npm
6175
+ const argsToForward = utils.filterFlags(argv, {
6176
+ ...flags.commonFlags,
6177
+ ...flags.outputFlags
6178
+ }, ['--json']);
6124
6179
  const {
6125
6180
  spawnPromise
6126
- } = await shadowBin(constants.NPM, argv, {
6181
+ } = await shadowBin(constants.NPM, argsToForward, {
6127
6182
  stdio: 'inherit'
6128
6183
  });
6129
6184
 
@@ -6139,7 +6194,7 @@ async function run$v(argv, importMeta, {
6139
6194
  await spawnPromise;
6140
6195
  }
6141
6196
 
6142
- const require$2 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
6197
+ const require$2 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6143
6198
  const CMD_NAME$o = constants.NPX;
6144
6199
  const description$t = 'Run npx with the Socket wrapper';
6145
6200
  const hidden$n = false;
@@ -8407,12 +8462,12 @@ function getAlertString(alerts, options) {
8407
8462
 
8408
8463
  // We need to create the no-color string regardless because the actual string
8409
8464
  // contains a bunch of invisible ANSI chars which would screw up length checks.
8410
- const colorless = `- Alerts (${bad.length}/${mid.length.toString()}/${low.length}):`;
8465
+ const colorless = `- Alerts (${bad.length}/${mid.length}/${low.length}):`;
8411
8466
  const padding = ` ${' '.repeat(Math.max(0, 20 - colorless.length))}`;
8412
8467
  if (colorize) {
8413
- return `- Alerts (${vendor.yoctocolorsCjsExports.red(bad.length.toString())}/${vendor.yoctocolorsCjsExports.yellow(mid.length.toString())}/${low.length}):` + padding + [bad.map(a => vendor.yoctocolorsCjsExports.red(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)).join(', '), mid.map(a => vendor.yoctocolorsCjsExports.yellow(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)).join(', '), low.map(a => `${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`).join(', ')].filter(Boolean).join(', ');
8468
+ return `- Alerts (${vendor.yoctocolorsCjsExports.red(bad.length)}/${vendor.yoctocolorsCjsExports.yellow(mid.length)}/${low.length}):${padding}${arrays.joinAnd([...bad.map(a => vendor.yoctocolorsCjsExports.red(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)), ...mid.map(a => vendor.yoctocolorsCjsExports.yellow(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)), ...low.map(a => `${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)])}`;
8414
8469
  }
8415
- return colorless + padding + [bad.map(a => `[${a.severity}] ${a.type}`).join(', '), mid.map(a => `[${a.severity}] ${a.type}`).join(', '), low.map(a => `[${a.severity}] ${a.type}`).join(', ')].filter(Boolean).join(', ');
8470
+ return `${colorless}${padding}${arrays.joinAnd([...bad.map(a => `[${a.severity}] ${a.type}`), ...mid.map(a => `[${a.severity}] ${a.type}`), ...low.map(a => `[${a.severity}] ${a.type}`)])}`;
8416
8471
  }
8417
8472
  function preProcess(artifacts, requestedPurls) {
8418
8473
  // Dedupe results (for example, pypi will emit one package for each system release (win/mac/cpu) even if it's
@@ -8845,14 +8900,26 @@ async function applyNpmPatches(socketDir, patches, options) {
8845
8900
  }
8846
8901
  return result;
8847
8902
  }
8903
+
8904
+ /**
8905
+ * Compute SHA256 hash of file contents.
8906
+ */
8848
8907
  async function computeSHA256(filepath) {
8849
8908
  try {
8850
8909
  const content = await fs$1.promises.readFile(filepath);
8851
8910
  const hash = require$$0$1.createHash('sha256');
8852
8911
  hash.update(content);
8853
- return hash.digest('hex');
8854
- } catch {}
8855
- return null;
8912
+ return {
8913
+ ok: true,
8914
+ data: hash.digest('hex')
8915
+ };
8916
+ } catch (e) {
8917
+ return {
8918
+ ok: false,
8919
+ message: 'Failed to compute file hash',
8920
+ cause: `Unable to read file ${filepath}: ${e instanceof Error ? e.message : 'Unknown error'}`
8921
+ };
8922
+ }
8856
8923
  }
8857
8924
  async function findNodeModulesPaths(cwd) {
8858
8925
  const rootNmPath = await utils.findUp(constants.NODE_MODULES, {
@@ -8888,29 +8955,29 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
8888
8955
  }
8889
8956
  return false;
8890
8957
  }
8891
- const currentHash = await computeSHA256(filepath);
8892
- if (!currentHash) {
8893
- logger.logger.log(`Failed to compute hash for: ${fileName}`);
8958
+ const currentHashResult = await computeSHA256(filepath);
8959
+ if (!currentHashResult.ok) {
8960
+ logger.logger.log(`Failed to compute hash for: ${fileName}: ${currentHashResult.cause || currentHashResult.message}`);
8894
8961
  if (wasSpinning) {
8895
8962
  spinner?.start();
8896
8963
  }
8897
8964
  return false;
8898
8965
  }
8899
- if (currentHash === fileInfo.afterHash) {
8966
+ if (currentHashResult.data === fileInfo.afterHash) {
8900
8967
  logger.logger.success(`File already patched: ${fileName}`);
8901
8968
  logger.logger.group();
8902
- logger.logger.log(`Current hash: ${currentHash}`);
8969
+ logger.logger.log(`Current hash: ${currentHashResult.data}`);
8903
8970
  logger.logger.groupEnd();
8904
8971
  if (wasSpinning) {
8905
8972
  spinner?.start();
8906
8973
  }
8907
8974
  return true;
8908
8975
  }
8909
- if (currentHash !== fileInfo.beforeHash) {
8976
+ if (currentHashResult.data !== fileInfo.beforeHash) {
8910
8977
  logger.logger.fail(`File hash mismatch: ${fileName}`);
8911
8978
  logger.logger.group();
8912
8979
  logger.logger.log(`Expected: ${fileInfo.beforeHash}`);
8913
- logger.logger.log(`Current: ${currentHash}`);
8980
+ logger.logger.log(`Current: ${currentHashResult.data}`);
8914
8981
  logger.logger.log(`Target: ${fileInfo.afterHash}`);
8915
8982
  logger.logger.groupEnd();
8916
8983
  if (wasSpinning) {
@@ -8920,7 +8987,7 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
8920
8987
  }
8921
8988
  logger.logger.success(`File matches expected hash: ${fileName}`);
8922
8989
  logger.logger.group();
8923
- logger.logger.log(`Current hash: ${currentHash}`);
8990
+ logger.logger.log(`Current hash: ${currentHashResult.data}`);
8924
8991
  logger.logger.log(`Ready to patch to: ${fileInfo.afterHash}`);
8925
8992
  logger.logger.group();
8926
8993
  if (dryRun) {
@@ -9118,13 +9185,11 @@ async function run$k(argv, importMeta, {
9118
9185
  cwd = path.resolve(process.cwd(), cwd);
9119
9186
  const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET);
9120
9187
  if (!fs$1.existsSync(dotSocketDirPath)) {
9121
- logger.logger.error(`Error: No ${constants.DOT_SOCKET} directory found in current directory`);
9122
- return;
9188
+ throw new utils.InputError(`No ${constants.DOT_SOCKET} directory found in current directory`);
9123
9189
  }
9124
9190
  const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
9125
9191
  if (!fs$1.existsSync(manifestPath)) {
9126
- logger.logger.error(`Error: No ${constants.MANIFEST_JSON} found in ${constants.DOT_SOCKET} directory`);
9127
- return;
9192
+ throw new utils.InputError(`No ${constants.MANIFEST_JSON} found in ${constants.DOT_SOCKET} directory`);
9128
9193
  }
9129
9194
  const {
9130
9195
  spinner
@@ -9792,25 +9857,26 @@ async function run$f(argv, importMeta, {
9792
9857
  },
9793
9858
  org: {
9794
9859
  type: 'string',
9860
+ default: '',
9795
9861
  description: 'Force override the organization slug, overrides the default org from config'
9796
9862
  },
9797
9863
  perPage: {
9798
9864
  type: 'number',
9799
- shortFlag: 'pp',
9800
9865
  default: 30,
9801
- description: 'Number of results per page'
9866
+ description: 'Number of results per page',
9867
+ shortFlag: 'pp'
9802
9868
  },
9803
9869
  page: {
9804
9870
  type: 'number',
9805
- shortFlag: 'p',
9806
9871
  default: 1,
9807
- description: 'Page number'
9872
+ description: 'Page number',
9873
+ shortFlag: 'p'
9808
9874
  },
9809
9875
  sort: {
9810
9876
  type: 'string',
9811
- shortFlag: 's',
9812
9877
  default: 'created_at',
9813
- description: 'Sorting option'
9878
+ description: 'Sorting option',
9879
+ shortFlag: 's'
9814
9880
  }
9815
9881
  },
9816
9882
  help: (command, config) => `
@@ -9837,16 +9903,19 @@ async function run$f(argv, importMeta, {
9837
9903
  const {
9838
9904
  all,
9839
9905
  direction = 'desc',
9906
+ dryRun,
9907
+ interactive,
9840
9908
  json,
9841
9909
  markdown,
9842
- org: orgFlag
9910
+ org: orgFlag,
9911
+ page,
9912
+ perPage,
9913
+ sort
9843
9914
  } = cli.flags;
9844
- const dryRun = !!cli.flags['dryRun'];
9845
- const interactive = !!cli.flags['interactive'];
9846
9915
  const hasApiToken = utils.hasDefaultApiToken();
9847
9916
  const {
9848
9917
  0: orgSlug
9849
- } = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
9918
+ } = await utils.determineOrgSlug(orgFlag, interactive, dryRun);
9850
9919
  const outputKind = utils.getOutputKind(json, markdown);
9851
9920
  const wasValidInput = utils.checkCommandInput(outputKind, {
9852
9921
  nook: true,
@@ -9877,13 +9946,13 @@ async function run$f(argv, importMeta, {
9877
9946
  return;
9878
9947
  }
9879
9948
  await handleListRepos({
9880
- all: Boolean(all),
9881
- direction: direction === 'asc' ? 'asc' : 'desc',
9949
+ all,
9950
+ direction,
9882
9951
  orgSlug,
9883
9952
  outputKind,
9884
- page: Number(cli.flags['page']) || 1,
9885
- perPage: Number(cli.flags['perPage']) || 30,
9886
- sort: String(cli.flags['sort'] || 'created_at')
9953
+ page,
9954
+ perPage,
9955
+ sort
9887
9956
  });
9888
9957
  }
9889
9958
 
@@ -11083,12 +11152,12 @@ async function run$a(argv, importMeta, {
11083
11152
  const SOCKET_SBOM_URL_PREFIX_LENGTH = SOCKET_SBOM_URL_PREFIX.length;
11084
11153
  const {
11085
11154
  depth,
11155
+ dryRun,
11086
11156
  file,
11087
11157
  json,
11088
11158
  markdown,
11089
11159
  org: orgFlag
11090
11160
  } = cli.flags;
11091
- const dryRun = !!cli.flags['dryRun'];
11092
11161
  const interactive = !!cli.flags['interactive'];
11093
11162
  let [id1 = '', id2 = ''] = cli.input;
11094
11163
  // Support dropping in full socket urls to an sbom.
@@ -11131,12 +11200,12 @@ async function run$a(argv, importMeta, {
11131
11200
  return;
11132
11201
  }
11133
11202
  await handleDiffScan({
11134
- id1: String(id1 || ''),
11135
- id2: String(id2 || ''),
11136
- depth: Number(depth),
11203
+ id1,
11204
+ id2,
11205
+ depth,
11137
11206
  orgSlug,
11138
11207
  outputKind,
11139
- file: String(file || '')
11208
+ file
11140
11209
  });
11141
11210
  }
11142
11211
 
@@ -11151,7 +11220,7 @@ async function createScanFromGithub({
11151
11220
  repos
11152
11221
  }) {
11153
11222
  let targetRepos = repos.trim().split(',').map(r => r.trim()).filter(Boolean);
11154
- if (all || targetRepos.length === 0) {
11223
+ if (all || !targetRepos.length) {
11155
11224
  // Fetch from Socket API
11156
11225
  const result = await fetchListAllRepos(orgSlug, {
11157
11226
  direction: 'asc',
@@ -11522,10 +11591,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11522
11591
  ok: true,
11523
11592
  data: localPath
11524
11593
  };
11525
- } catch (error) {
11594
+ } catch (e) {
11526
11595
  logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
11527
11596
  require$$9.debugDir('inspect', {
11528
- error
11597
+ error: e
11529
11598
  });
11530
11599
 
11531
11600
  // If an error occurs and fileStream was created, attempt to clean up.
@@ -11539,10 +11608,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
11539
11608
  });
11540
11609
  }
11541
11610
  // Construct a more informative error message
11542
- let detailedError = `Error during download of ${downloadUrl}: ${error.message}`;
11543
- if (error.cause) {
11611
+ let detailedError = `Error during download of ${downloadUrl}: ${e.message}`;
11612
+ if (e.cause) {
11544
11613
  // Include cause if available (e.g., from network errors)
11545
- detailedError += `\nCause: ${error.cause}`;
11614
+ detailedError += `\nCause: ${e.cause}`;
11546
11615
  }
11547
11616
  if (response && !response.ok) {
11548
11617
  // If error was due to bad HTTP status
@@ -13165,7 +13234,7 @@ async function fetchScan(orgSlug, scanId) {
13165
13234
  error: e,
13166
13235
  line
13167
13236
  });
13168
- return null;
13237
+ return undefined;
13169
13238
  }
13170
13239
  });
13171
13240
  if (ok) {
@@ -13440,7 +13509,7 @@ async function fetchThreatFeed({
13440
13509
  return await utils.queryApiSafeJson(`orgs/${orgSlug}/threat-feed?${queryParams}`, 'the Threat Feed data');
13441
13510
  }
13442
13511
 
13443
- const require$1 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
13512
+ const require$1 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
13444
13513
  async function outputThreatFeed(result, outputKind) {
13445
13514
  if (!result.ok) {
13446
13515
  process.exitCode = result.code ?? 1;
@@ -14317,7 +14386,7 @@ const rootAliases = {
14317
14386
  }
14318
14387
  };
14319
14388
 
14320
- const __filename$1 = require$$0.fileURLToPath(require('node:url').pathToFileURL(__filename).href);
14389
+ const __filename$1 = require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
14321
14390
  void (async () => {
14322
14391
  const registryUrl = vendor.registryUrl();
14323
14392
  await vendor.updater({
@@ -14395,5 +14464,5 @@ void (async () => {
14395
14464
  await utils.captureException(e);
14396
14465
  }
14397
14466
  })();
14398
- //# debugId=ac9751e6-2458-4e89-9ffb-14171de230d0
14467
+ //# debugId=d42a0267-36a6-4b2d-a161-8a78c8038a13
14399
14468
  //# sourceMappingURL=cli.js.map