@socketsecurity/cli-with-sentry 1.0.64 → 1.0.66

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 (161) hide show
  1. package/dist/cli.js +704 -521
  2. package/dist/cli.js.map +1 -1
  3. package/dist/constants.js +18 -11
  4. package/dist/constants.js.map +1 -1
  5. package/dist/instrument-with-sentry.js +4 -9
  6. package/dist/instrument-with-sentry.js.map +1 -1
  7. package/dist/shadow-npm-inject.js +13 -16
  8. package/dist/shadow-npm-inject.js.map +1 -1
  9. package/dist/types/commands/analytics/fetch-org-analytics.d.mts +6 -2
  10. package/dist/types/commands/analytics/fetch-org-analytics.d.mts.map +1 -1
  11. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +6 -2
  12. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts.map +1 -1
  13. package/dist/types/commands/analytics/output-analytics.d.mts +4 -4
  14. package/dist/types/commands/analytics/output-analytics.d.mts.map +1 -1
  15. package/dist/types/commands/audit-log/fetch-audit-log.d.mts +10 -5
  16. package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +1 -1
  17. package/dist/types/commands/audit-log/handle-audit-log.d.mts +1 -1
  18. package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +1 -1
  19. package/dist/types/commands/audit-log/output-audit-log.d.mts +6 -6
  20. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
  21. package/dist/types/commands/ci/fetch-default-org-slug.d.mts +1 -1
  22. package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +1 -1
  23. package/dist/types/commands/ci/handle-ci.d.mts +1 -1
  24. package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
  25. package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
  26. package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
  27. package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
  28. package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
  29. package/dist/types/commands/config/discover-config-value.d.mts.map +1 -1
  30. package/dist/types/commands/config/output-config-list.d.mts.map +1 -1
  31. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  32. package/dist/types/commands/fix/handle-fix.d.mts +2 -1
  33. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  34. package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
  35. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +1 -1
  36. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +1 -1
  37. package/dist/types/commands/manifest/output-requirements.d.mts +1 -1
  38. package/dist/types/commands/manifest/output-requirements.d.mts.map +1 -1
  39. package/dist/types/commands/organization/fetch-dependencies.d.mts +8 -3
  40. package/dist/types/commands/organization/fetch-dependencies.d.mts.map +1 -1
  41. package/dist/types/commands/organization/fetch-license-policy.d.mts +6 -2
  42. package/dist/types/commands/organization/fetch-license-policy.d.mts.map +1 -1
  43. package/dist/types/commands/organization/fetch-organization-list.d.mts +6 -2
  44. package/dist/types/commands/organization/fetch-organization-list.d.mts.map +1 -1
  45. package/dist/types/commands/organization/fetch-quota.d.mts +6 -2
  46. package/dist/types/commands/organization/fetch-quota.d.mts.map +1 -1
  47. package/dist/types/commands/organization/fetch-security-policy.d.mts +6 -2
  48. package/dist/types/commands/organization/fetch-security-policy.d.mts.map +1 -1
  49. package/dist/types/commands/organization/output-dependencies.d.mts +2 -2
  50. package/dist/types/commands/organization/output-dependencies.d.mts.map +1 -1
  51. package/dist/types/commands/organization/output-license-policy.d.mts +2 -2
  52. package/dist/types/commands/organization/output-license-policy.d.mts.map +1 -1
  53. package/dist/types/commands/organization/output-organization-list.d.mts +2 -2
  54. package/dist/types/commands/organization/output-organization-list.d.mts.map +1 -1
  55. package/dist/types/commands/organization/output-quota.d.mts +2 -2
  56. package/dist/types/commands/organization/output-quota.d.mts.map +1 -1
  57. package/dist/types/commands/organization/output-security-policy.d.mts +2 -2
  58. package/dist/types/commands/organization/output-security-policy.d.mts.map +1 -1
  59. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +6 -2
  60. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +1 -1
  61. package/dist/types/commands/repository/fetch-create-repo.d.mts +11 -6
  62. package/dist/types/commands/repository/fetch-create-repo.d.mts.map +1 -1
  63. package/dist/types/commands/repository/fetch-delete-repo.d.mts +6 -2
  64. package/dist/types/commands/repository/fetch-delete-repo.d.mts.map +1 -1
  65. package/dist/types/commands/repository/fetch-list-all-repos.d.mts +8 -6
  66. package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +1 -1
  67. package/dist/types/commands/repository/fetch-list-repos.d.mts +9 -4
  68. package/dist/types/commands/repository/fetch-list-repos.d.mts.map +1 -1
  69. package/dist/types/commands/repository/fetch-update-repo.d.mts +11 -6
  70. package/dist/types/commands/repository/fetch-update-repo.d.mts.map +1 -1
  71. package/dist/types/commands/repository/fetch-view-repo.d.mts +6 -2
  72. package/dist/types/commands/repository/fetch-view-repo.d.mts.map +1 -1
  73. package/dist/types/commands/repository/handle-create-repo.d.mts +2 -2
  74. package/dist/types/commands/repository/handle-create-repo.d.mts.map +1 -1
  75. package/dist/types/commands/repository/handle-list-repos.d.mts +2 -2
  76. package/dist/types/commands/repository/handle-list-repos.d.mts.map +1 -1
  77. package/dist/types/commands/repository/handle-update-repo.d.mts +2 -2
  78. package/dist/types/commands/repository/handle-update-repo.d.mts.map +1 -1
  79. package/dist/types/commands/repository/output-create-repo.d.mts +2 -2
  80. package/dist/types/commands/repository/output-create-repo.d.mts.map +1 -1
  81. package/dist/types/commands/repository/output-delete-repo.d.mts +2 -2
  82. package/dist/types/commands/repository/output-delete-repo.d.mts.map +1 -1
  83. package/dist/types/commands/repository/output-list-repos.d.mts +2 -2
  84. package/dist/types/commands/repository/output-list-repos.d.mts.map +1 -1
  85. package/dist/types/commands/repository/output-update-repo.d.mts +2 -2
  86. package/dist/types/commands/repository/output-update-repo.d.mts.map +1 -1
  87. package/dist/types/commands/repository/output-view-repo.d.mts +2 -2
  88. package/dist/types/commands/repository/output-view-repo.d.mts.map +1 -1
  89. package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
  90. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +12 -3
  91. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +1 -1
  92. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +6 -2
  93. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts.map +1 -1
  94. package/dist/types/commands/scan/fetch-diff-scan.d.mts +2 -2
  95. package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +1 -1
  96. package/dist/types/commands/scan/fetch-list-scans.d.mts +9 -4
  97. package/dist/types/commands/scan/fetch-list-scans.d.mts.map +1 -1
  98. package/dist/types/commands/scan/fetch-report-data.d.mts +8 -3
  99. package/dist/types/commands/scan/fetch-report-data.d.mts.map +1 -1
  100. package/dist/types/commands/scan/fetch-scan-metadata.d.mts +6 -2
  101. package/dist/types/commands/scan/fetch-scan-metadata.d.mts.map +1 -1
  102. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +6 -2
  103. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +1 -1
  104. package/dist/types/commands/scan/generate-report.d.mts +2 -2
  105. package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
  106. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
  107. package/dist/types/commands/scan/handle-list-scans.d.mts +2 -2
  108. package/dist/types/commands/scan/handle-list-scans.d.mts.map +1 -1
  109. package/dist/types/commands/scan/handle-scan-report.d.mts.map +1 -1
  110. package/dist/types/commands/scan/output-create-new-scan.d.mts +2 -2
  111. package/dist/types/commands/scan/output-create-new-scan.d.mts.map +1 -1
  112. package/dist/types/commands/scan/output-delete-scan.d.mts +2 -2
  113. package/dist/types/commands/scan/output-delete-scan.d.mts.map +1 -1
  114. package/dist/types/commands/scan/output-diff-scan.d.mts +2 -2
  115. package/dist/types/commands/scan/output-diff-scan.d.mts.map +1 -1
  116. package/dist/types/commands/scan/output-list-scans.d.mts +2 -2
  117. package/dist/types/commands/scan/output-list-scans.d.mts.map +1 -1
  118. package/dist/types/commands/scan/output-scan-metadata.d.mts +2 -2
  119. package/dist/types/commands/scan/output-scan-metadata.d.mts.map +1 -1
  120. package/dist/types/commands/scan/output-scan-report.d.mts +2 -2
  121. package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
  122. package/dist/types/commands/scan/stream-scan.d.mts +6 -1
  123. package/dist/types/commands/scan/stream-scan.d.mts.map +1 -1
  124. package/dist/types/commands/scan/suggest-org-slug.d.mts.map +1 -1
  125. package/dist/types/commands/scan/suggest-repo-slug.d.mts +5 -1
  126. package/dist/types/commands/scan/suggest-repo-slug.d.mts.map +1 -1
  127. package/dist/types/constants.d.mts.map +1 -1
  128. package/dist/types/shadow/npm/arborist-helpers.d.mts +1 -1
  129. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  130. package/dist/types/utils/alert/severity.d.mts +2 -2
  131. package/dist/types/utils/alert/severity.d.mts.map +1 -1
  132. package/dist/types/utils/alerts-map.d.mts +1 -1
  133. package/dist/types/utils/alerts-map.d.mts.map +1 -1
  134. package/dist/types/utils/api.d.mts +8 -3
  135. package/dist/types/utils/api.d.mts.map +1 -1
  136. package/dist/types/utils/coana.d.mts.map +1 -1
  137. package/dist/types/utils/config.d.mts +4 -2
  138. package/dist/types/utils/config.d.mts.map +1 -1
  139. package/dist/types/utils/fs.d.mts +3 -1
  140. package/dist/types/utils/fs.d.mts.map +1 -1
  141. package/dist/types/utils/glob.d.mts +4 -2
  142. package/dist/types/utils/glob.d.mts.map +1 -1
  143. package/dist/types/utils/path-resolve.d.mts +2 -2
  144. package/dist/types/utils/path-resolve.d.mts.map +1 -1
  145. package/dist/types/utils/sdk.d.mts +6 -1
  146. package/dist/types/utils/sdk.d.mts.map +1 -1
  147. package/dist/utils.js +262 -145
  148. package/dist/utils.js.map +1 -1
  149. package/dist/vendor.js +143 -64
  150. package/external/@socketsecurity/registry/extensions.json +2 -2
  151. package/external/@socketsecurity/registry/external/@inquirer/select.js +14 -2
  152. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +4 -4
  153. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +20 -11
  154. package/external/@socketsecurity/registry/external/libnpmpack.js +4 -4
  155. package/external/@socketsecurity/registry/external/npm-package-arg.js +4 -4
  156. package/external/@socketsecurity/registry/external/pacote.js +4 -4
  157. package/external/@socketsecurity/registry/external/validate-npm-package-name.js +4 -4
  158. package/external/@socketsecurity/registry/lib/regexps.js +1 -1
  159. package/external/@socketsecurity/registry/lib/spinner.js +27 -23
  160. package/external/@socketsecurity/registry/manifest.json +7 -7
  161. package/package.json +14 -14
package/dist/utils.js CHANGED
@@ -5,28 +5,23 @@ var logger = require('../external/@socketsecurity/registry/lib/logger');
5
5
  var strings = require('../external/@socketsecurity/registry/lib/strings');
6
6
  var debug = require('../external/@socketsecurity/registry/lib/debug');
7
7
  var arrays = require('../external/@socketsecurity/registry/lib/arrays');
8
- var objects = require('../external/@socketsecurity/registry/lib/objects');
8
+ var require$$7 = require('../external/@socketsecurity/registry/lib/objects');
9
9
  var path$1 = require('../external/@socketsecurity/registry/lib/path');
10
10
  var sorts = require('../external/@socketsecurity/registry/lib/sorts');
11
11
  var constants = require('./constants.js');
12
12
  var path = require('node:path');
13
13
  var regexps = require('../external/@socketsecurity/registry/lib/regexps');
14
14
  var prompts = require('../external/@socketsecurity/registry/lib/prompts');
15
- var promises = require('node:timers/promises');
16
15
  var spawn = require('../external/@socketsecurity/registry/lib/spawn');
17
16
  var fs = require('node:fs');
18
- var registry = require('../external/@socketsecurity/registry');
17
+ var fs$1 = require('../external/@socketsecurity/registry/lib/fs');
18
+ var require$$8 = require('../external/@socketsecurity/registry/lib/promises');
19
19
  var packages = require('../external/@socketsecurity/registry/lib/packages');
20
+ var registry = require('../external/@socketsecurity/registry');
20
21
  var require$$5 = require('node:module');
21
22
  var npm = require('../external/@socketsecurity/registry/lib/npm');
22
- var fs$1 = require('../external/@socketsecurity/registry/lib/fs');
23
- var require$$7 = require('../external/@socketsecurity/registry/lib/promises');
23
+ var promises = require('node:timers/promises');
24
24
 
25
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
26
- const {
27
- PNPM: PNPM$2
28
- } = constants;
29
- const PNPM_WORKSPACE = `${PNPM$2}-workspace`;
30
25
  const ignoredDirs = [
31
26
  // Taken from ignore-by-default:
32
27
  // https://github.com/novemberborn/ignore-by-default/blob/v2.1.0/index.js
@@ -52,8 +47,8 @@ const ignoredDirs = [
52
47
  const ignoredDirPatterns = ignoredDirs.map(i => `**/${i}`);
53
48
  async function getWorkspaceGlobs(agent, cwd = process.cwd()) {
54
49
  let workspacePatterns;
55
- if (agent === PNPM$2) {
56
- for (const workspacePath of [path.join(cwd, `${PNPM_WORKSPACE}.yaml`), path.join(cwd, `${PNPM_WORKSPACE}.yml`)]) {
50
+ if (agent === 'pnpm') {
51
+ for (const workspacePath of [path.join(cwd, 'pnpm-workspace.yaml'), path.join(cwd, 'pnpm-workspace.yml')]) {
57
52
  // eslint-disable-next-line no-await-in-loop
58
53
  const yml = await safeReadFile(workspacePath);
59
54
  if (yml) {
@@ -133,7 +128,11 @@ function workspacePatternToGlobPattern(workspace) {
133
128
  // Things like "packages/a" or "packages/*"
134
129
  return `${workspace}/package.json`;
135
130
  }
136
- async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
131
+ function filterBySupportedScanFiles(filepaths, supportedFiles) {
132
+ const patterns = getSupportedFilePatterns(supportedFiles);
133
+ return filepaths.filter(p => vendor.micromatchExports.some(p, patterns));
134
+ }
135
+ function getSupportedFilePatterns(supportedFiles) {
137
136
  const patterns = [];
138
137
  for (const key of Object.keys(supportedFiles)) {
139
138
  const supported = supportedFiles[key];
@@ -141,7 +140,7 @@ async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
141
140
  patterns.push(...Object.values(supported).map(p => `**/${p.pattern}`));
142
141
  }
143
142
  }
144
- return entries.filter(p => vendor.micromatchExports.some(p, patterns));
143
+ return patterns;
145
144
  }
146
145
  async function globWithGitIgnore(patterns, options) {
147
146
  const {
@@ -152,15 +151,16 @@ async function globWithGitIgnore(patterns, options) {
152
151
  __proto__: null,
153
152
  ...options
154
153
  };
155
- const projectIgnorePaths = socketConfig?.projectIgnorePaths;
156
154
  const ignoreFiles = await vendor.distExports.glob(['**/.gitignore'], {
157
155
  absolute: true,
158
156
  cwd,
159
157
  expandDirectories: true
160
158
  });
159
+ const projectIgnorePaths = socketConfig?.projectIgnorePaths;
161
160
  const ignores = [...ignoredDirPatterns, ...(Array.isArray(projectIgnorePaths) ? ignoreFileLinesToGlobPatterns(projectIgnorePaths, path.join(cwd, '.gitignore'), cwd) : []), ...(await Promise.all(ignoreFiles.map(async filepath => ignoreFileToGlobPatterns((await safeReadFile(filepath)) ?? '', filepath, cwd)))).flat()];
162
161
  const hasNegatedPattern = ignores.some(p => p.charCodeAt(0) === 33 /*'!'*/);
163
162
  const globOptions = {
163
+ __proto__: null,
164
164
  absolute: true,
165
165
  cwd,
166
166
  dot: true,
@@ -172,14 +172,11 @@ async function globWithGitIgnore(patterns, options) {
172
172
  if (!hasNegatedPattern) {
173
173
  return result;
174
174
  }
175
- const {
176
- absolute
177
- } = globOptions;
178
175
 
179
176
  // Note: the input files must be INSIDE the cwd. If you get strange looking
180
177
  // relative path errors here, most likely your path is outside the given cwd.
181
- const filtered = vendor.ignoreExports().add(ignores).filter(absolute ? result.map(p => path.relative(cwd, p)) : result);
182
- return absolute ? filtered.map(p => path.resolve(cwd, p)) : filtered;
178
+ const filtered = vendor.ignoreExports().add(ignores).filter(globOptions.absolute ? result.map(p => path.relative(cwd, p)) : result);
179
+ return globOptions.absolute ? filtered.map(p => path.resolve(cwd, p)) : filtered;
183
180
  }
184
181
  async function globNodeModules(cwd = process.cwd()) {
185
182
  return await vendor.distExports.glob('**/node_modules', {
@@ -197,17 +194,18 @@ async function globWorkspace(agent, cwd = process.cwd()) {
197
194
  ignore: ['**/node_modules/**', '**/bower_components/**']
198
195
  }) : [];
199
196
  }
197
+ function isReportSupportedFile(filepath, supportedFiles) {
198
+ const patterns = getSupportedFilePatterns(supportedFiles);
199
+ return vendor.micromatchExports.some(filepath, patterns);
200
+ }
200
201
  function pathsToGlobPatterns(paths) {
201
202
  // TODO: Does not support `~/` paths.
202
203
  return paths.map(p => p === '.' || p === './' ? '**/*' : p);
203
204
  }
204
205
 
205
- const {
206
- abortSignal
207
- } = constants;
208
206
  async function removeNodeModules(cwd = process.cwd()) {
209
207
  const nodeModulesPaths = await globNodeModules(cwd);
210
- await require$$7.pEach(nodeModulesPaths, 3, p => fs$1.remove(p, {
208
+ await require$$8.pEach(nodeModulesPaths, 3, p => fs$1.remove(p, {
211
209
  force: true,
212
210
  recursive: true
213
211
  }), {
@@ -216,7 +214,8 @@ async function removeNodeModules(cwd = process.cwd()) {
216
214
  }
217
215
  async function findUp(name, {
218
216
  cwd = process.cwd(),
219
- signal = abortSignal
217
+ // Lazily access constants.abortSignal.
218
+ signal = constants.abortSignal
220
219
  }) {
221
220
  let dir = path.resolve(cwd);
222
221
  const {
@@ -243,14 +242,16 @@ async function findUp(name, {
243
242
  }
244
243
  async function readFileBinary(filepath, options) {
245
244
  return await fs.promises.readFile(filepath, {
246
- signal: abortSignal,
245
+ // Lazily access constants.abortSignal.
246
+ signal: constants.abortSignal,
247
247
  ...options,
248
248
  encoding: 'binary'
249
249
  });
250
250
  }
251
251
  async function readFileUtf8(filepath, options) {
252
252
  return await fs.promises.readFile(filepath, {
253
- signal: abortSignal,
253
+ // Lazily access constants.abortSignal.
254
+ signal: constants.abortSignal,
254
255
  ...options,
255
256
  encoding: 'utf8'
256
257
  });
@@ -259,7 +260,8 @@ async function safeReadFile(filepath, options) {
259
260
  try {
260
261
  return await fs.promises.readFile(filepath, {
261
262
  encoding: 'utf8',
262
- signal: abortSignal,
263
+ // Lazily access constants.abortSignal.
264
+ signal: constants.abortSignal,
263
265
  ...(typeof options === 'string' ? {
264
266
  encoding: options
265
267
  } : options)
@@ -288,8 +290,10 @@ function safeStatsSync(filepath, options) {
288
290
  return undefined;
289
291
  }
290
292
 
291
- const sensitiveConfigKeys = new Set(['apiToken']);
292
- const supportedConfigKeys = new Map([['apiBaseUrl', 'Base URL of the API endpoint'], ['apiProxy', 'A proxy through which to access the API'], ['apiToken', 'The API token required to access most API endpoints'], ['defaultOrg', 'The default org slug to use; usually the org your API token has access to. When set, all orgSlug arguments are implied to be this value.'], ['enforcedOrgs', 'Orgs in this list have their security policies enforced on this machine'], ['skipAskToPersistDefaultOrg', 'This flag prevents the CLI from asking you to persist the org slug when you selected one interactively'], ['org', 'Alias for defaultOrg']]);
293
+ const sensitiveConfigKeyLookup = new Set(['apiToken']);
294
+ const supportedConfig = new Map([['apiBaseUrl', 'Base URL of the API endpoint'], ['apiProxy', 'A proxy through which to access the API'], ['apiToken', 'The API token required to access most API endpoints'], ['defaultOrg', 'The default org slug to use; usually the org your API token has access to. When set, all orgSlug arguments are implied to be this value.'], ['enforcedOrgs', 'Orgs in this list have their security policies enforced on this machine'], ['skipAskToPersistDefaultOrg', 'This flag prevents the CLI from asking you to persist the org slug when you selected one interactively'], ['org', 'Alias for defaultOrg']]);
295
+ const supportedConfigEntries = [...supportedConfig.entries()].sort((a, b) => sorts.naturalCompare(a[0], b[0]));
296
+ const supportedConfigKeys = supportedConfigEntries.map(p => p[0]);
293
297
  function getConfigValues() {
294
298
  if (_cachedConfig === undefined) {
295
299
  // Order: env var > --config flag > file
@@ -327,7 +331,7 @@ function normalizeConfigKey(key) {
327
331
  // property apiKey, we'll copy that to apiToken and delete the old property.
328
332
  // We added `org` as a convenience alias for `defaultOrg`
329
333
  const normalizedKey = key === 'apiKey' ? 'apiToken' : key === 'org' ? 'defaultOrg' : key;
330
- if (!supportedConfigKeys.has(normalizedKey)) {
334
+ if (!isSupportedConfigKey(normalizedKey)) {
331
335
  return {
332
336
  ok: false,
333
337
  message: `Invalid config key: ${normalizedKey}`,
@@ -385,9 +389,21 @@ function getConfigValueOrUndef(key) {
385
389
  }
386
390
  return localConfig[keyResult.data];
387
391
  }
392
+ function getSupportedConfigEntries() {
393
+ return [...supportedConfigEntries];
394
+ }
395
+ function getSupportedConfigKeys() {
396
+ return [...supportedConfigKeys];
397
+ }
388
398
  function isReadOnlyConfig() {
389
399
  return _readOnlyConfig;
390
400
  }
401
+ function isSensitiveConfigKey(key) {
402
+ return sensitiveConfigKeyLookup.has(key);
403
+ }
404
+ function isSupportedConfigKey(key) {
405
+ return supportedConfig.has(key);
406
+ }
391
407
  let _cachedConfig;
392
408
  // When using --config or SOCKET_CLI_CONFIG, do not persist the config.
393
409
  let _readOnlyConfig = false;
@@ -397,7 +413,8 @@ function overrideCachedConfig(jsonConfig) {
397
413
  try {
398
414
  config = JSON.parse(String(jsonConfig));
399
415
  if (!config || typeof config !== 'object') {
400
- // `null` is valid json, so are primitive values. They're not valid config objects :)
416
+ // `null` is valid json, so are primitive values.
417
+ // They're not valid config objects :)
401
418
  return {
402
419
  ok: false,
403
420
  message: 'Could not parse Config as JSON',
@@ -405,7 +422,7 @@ function overrideCachedConfig(jsonConfig) {
405
422
  };
406
423
  }
407
424
  } catch {
408
- // Force set an empty config to prevent accidentally using system settings
425
+ // Force set an empty config to prevent accidentally using system settings.
409
426
  _cachedConfig = {};
410
427
  _readOnlyConfig = true;
411
428
  return {
@@ -419,7 +436,7 @@ function overrideCachedConfig(jsonConfig) {
419
436
  _cachedConfig = config;
420
437
  _readOnlyConfig = true;
421
438
 
422
- // Normalize apiKey to apiToken
439
+ // Normalize apiKey to apiToken.
423
440
  if (_cachedConfig['apiKey']) {
424
441
  if (_cachedConfig['apiToken']) {
425
442
  logger.logger.warn('Note: The config override had both apiToken and apiKey. Using the apiToken value. Remove the apiKey to get rid of this message.');
@@ -434,8 +451,7 @@ function overrideCachedConfig(jsonConfig) {
434
451
  }
435
452
  function overrideConfigApiToken(apiToken) {
436
453
  debug.debugFn('notice', 'override: API token (not stored)');
437
-
438
- // Set token to the local cached config and mark it read-only so it doesn't persist
454
+ // Set token to the local cached config and mark it read-only so it doesn't persist.
439
455
  _cachedConfig = {
440
456
  ...vendor.configExports,
441
457
  ...(apiToken === undefined ? {} : {
@@ -452,7 +468,8 @@ function updateConfigValue(configKey, value) {
452
468
  return keyResult;
453
469
  }
454
470
  const key = keyResult.data;
455
- let wasDeleted = value === undefined; // implicitly when serializing
471
+ // Implicitly deleting when serializing.
472
+ let wasDeleted = value === undefined;
456
473
  if (key === 'skipAskToPersistDefaultOrg') {
457
474
  if (value === 'true' || value === 'false') {
458
475
  localConfig['skipAskToPersistDefaultOrg'] = value === 'true';
@@ -586,7 +603,14 @@ function getPublicToken() {
586
603
  // Lazily access constants.SOCKET_PUBLIC_API_TOKEN.
587
604
  constants.SOCKET_PUBLIC_API_TOKEN;
588
605
  }
589
- async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApiBaseUrl$1(), proxy) {
606
+ async function setupSdk(options) {
607
+ const opts = {
608
+ __proto__: null,
609
+ ...options
610
+ };
611
+ let {
612
+ apiToken = getDefaultToken()
613
+ } = opts;
590
614
  if (typeof apiToken !== 'string' && vendor.isInteractiveExports()) {
591
615
  apiToken = await prompts.password({
592
616
  message: 'Enter your Socket.dev API key (not saved, use socket login to persist)'
@@ -600,15 +624,21 @@ async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApi
600
624
  cause: 'You need to provide an API Token. Run `socket login` first.'
601
625
  };
602
626
  }
603
- if (!isUrl(proxy)) {
604
- proxy = getDefaultProxyUrl();
627
+ let {
628
+ apiProxy
629
+ } = opts;
630
+ if (!isUrl(apiProxy)) {
631
+ apiProxy = getDefaultProxyUrl();
605
632
  }
606
- const ProxyAgent = proxy?.startsWith('http:') ? vendor.HttpProxyAgent : vendor.HttpsProxyAgent;
633
+ const {
634
+ apiBaseUrl = getDefaultApiBaseUrl$1()
635
+ } = opts;
636
+ const ProxyAgent = apiProxy?.startsWith('http:') ? vendor.HttpProxyAgent : vendor.HttpsProxyAgent;
607
637
  return {
608
638
  ok: true,
609
639
  data: new vendor.distExports$2.SocketSdk(apiToken, {
610
- agent: proxy ? new ProxyAgent({
611
- proxy
640
+ agent: apiProxy ? new ProxyAgent({
641
+ proxy: apiProxy
612
642
  }) : undefined,
613
643
  baseUrl: apiBaseUrl,
614
644
  userAgent: vendor.distExports$2.createUserAgentFromPkgJson({
@@ -623,59 +653,79 @@ async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApi
623
653
  };
624
654
  }
625
655
 
626
- async function handleApiCall(value, fetchingDesc) {
627
- // Lazily access constants.spinner.
656
+ const NO_ERROR_MESSAGE = 'No error message returned';
657
+ async function handleApiCall(value, options) {
628
658
  const {
659
+ desc,
629
660
  spinner
630
- } = constants;
631
- spinner.start(`Requesting ${fetchingDesc} from API...`);
632
- let result;
661
+ } = {
662
+ __proto__: null,
663
+ ...options
664
+ };
665
+ if (desc) {
666
+ spinner?.start(`Requesting ${desc} from API...`);
667
+ } else {
668
+ spinner?.start();
669
+ }
670
+ let sdkResult;
633
671
  try {
634
- result = await value;
635
-
636
- // TODO: info, not success (looks weird when response is non-200)
637
- spinner.successAndStop(`Received API response (after requesting ${fetchingDesc}).`);
672
+ sdkResult = await value;
673
+ if (desc) {
674
+ // TODO: info, not success (looks weird when response is non-200)
675
+ spinner?.successAndStop(`Received API response (after requesting ${desc}).`);
676
+ } else {
677
+ spinner?.stop();
678
+ }
638
679
  } catch (e) {
639
- spinner.failAndStop(`An error was thrown while requesting ${fetchingDesc}`);
640
- const message = `${e || 'No error message returned'}`;
641
- const reason = `${e || 'No error message returned'}`;
642
- debug.debugFn('error', `caught: ${fetchingDesc} error`);
680
+ if (desc) {
681
+ spinner?.failAndStop(`An error was thrown while requesting ${desc}`);
682
+ debug.debugFn('error', `caught: ${desc} error`);
683
+ } else {
684
+ spinner?.stop();
685
+ debug.debugFn('error', `caught: error`);
686
+ }
643
687
  debug.debugDir('inspect', {
644
688
  error: e
645
689
  });
646
690
  return {
647
691
  ok: false,
648
692
  message: 'Socket API returned an error',
649
- cause: `${message}${reason ? ` ( Reason: ${reason} )` : ''}`
693
+ cause: vendor.messageWithCauses(e)
650
694
  };
651
695
  } finally {
652
- spinner.stop();
696
+ spinner?.stop();
653
697
  }
654
698
 
655
- // Note: TS can't narrow down the type of result due to generics
656
- if (result.success === false) {
657
- const error = result;
658
- const message = `${error.error || 'No error message returned'}`;
699
+ // Note: TS can't narrow down the type of result due to generics.
700
+ if (sdkResult.success === false) {
701
+ const errorResult = sdkResult;
702
+ const message = `${errorResult.error || NO_ERROR_MESSAGE}`;
659
703
  const {
660
704
  cause: reason
661
- } = error;
662
- debug.debugFn('error', `fail: ${fetchingDesc} bad response`);
705
+ } = errorResult;
706
+ if (desc) {
707
+ debug.debugFn('error', `fail: ${desc} bad response`);
708
+ } else {
709
+ debug.debugFn('error', 'fail: bad response');
710
+ }
663
711
  debug.debugDir('inspect', {
664
- error
712
+ sdkResult
665
713
  });
666
714
  return {
667
715
  ok: false,
668
716
  message: 'Socket API returned an error',
669
717
  cause: `${message}${reason ? ` ( Reason: ${reason} )` : ''}`,
670
718
  data: {
671
- code: result.status
719
+ code: sdkResult.status
672
720
  }
673
721
  };
674
722
  } else {
675
- const ok = result;
723
+ const {
724
+ data
725
+ } = sdkResult;
676
726
  return {
677
727
  ok: true,
678
- data: ok.data
728
+ data
679
729
  };
680
730
  }
681
731
  }
@@ -684,8 +734,8 @@ async function handleApiCallNoSpinner(value, description) {
684
734
  try {
685
735
  result = await value;
686
736
  } catch (e) {
687
- const message = `${e || 'No error message returned'}`;
688
- const reason = `${e || 'No error message returned'}`;
737
+ const message = `${e || NO_ERROR_MESSAGE}`;
738
+ const reason = `${e || NO_ERROR_MESSAGE}`;
689
739
  debug.debugFn('error', `caught: ${description} error`);
690
740
  debug.debugDir('inspect', {
691
741
  error: e
@@ -700,7 +750,7 @@ async function handleApiCallNoSpinner(value, description) {
700
750
  // Note: TS can't narrow down the type of result due to generics
701
751
  if (result.success === false) {
702
752
  const error = result;
703
- const message = `${error.error || 'No error message returned'}`;
753
+ const message = `${error.error || NO_ERROR_MESSAGE}`;
704
754
  debug.debugFn('error', `fail: ${description} bad response`);
705
755
  debug.debugDir('inspect', {
706
756
  error
@@ -1109,7 +1159,7 @@ function getHelpListOutput(list, options) {
1109
1159
  if (entry && 'hidden' in entry && entry?.hidden) {
1110
1160
  continue;
1111
1161
  }
1112
- const description = (objects.isObject(entry) ? entry.description : entry) || '';
1162
+ const description = (require$$7.isObject(entry) ? entry.description : entry) || '';
1113
1163
  result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
1114
1164
  }
1115
1165
  return result.trim() || '(none)';
@@ -1266,10 +1316,10 @@ async function meowWithSubcommands(subcommands, options) {
1266
1316
  function formatCommandsForHelp(isRootCommand) {
1267
1317
  if (!isRootCommand) {
1268
1318
  return getHelpListOutput({
1269
- ...objects.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(({
1319
+ ...require$$7.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(({
1270
1320
  1: subcommand
1271
1321
  }) => !subcommand.hidden))),
1272
- ...objects.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(({
1322
+ ...require$$7.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(({
1273
1323
  1: alias
1274
1324
  }) => {
1275
1325
  const {
@@ -1514,41 +1564,54 @@ function msAtHome(isoTimeStamp) {
1514
1564
  }
1515
1565
  }
1516
1566
 
1517
- async function suggestOrgSlug() {
1518
- const sockSdkCResult = await setupSdk();
1567
+ async function fetchOrganization(options) {
1568
+ const {
1569
+ sdkOptions
1570
+ } = {
1571
+ __proto__: null,
1572
+ ...options
1573
+ };
1574
+ const sockSdkCResult = await setupSdk(sdkOptions);
1519
1575
  if (!sockSdkCResult.ok) {
1520
- return;
1576
+ return sockSdkCResult;
1521
1577
  }
1522
1578
  const sockSdk = sockSdkCResult.data;
1523
- const result = await handleApiCall(sockSdk.getOrganizations(), 'list of organizations');
1579
+ return await handleApiCall(sockSdk.getOrganizations(), {
1580
+ desc: 'organization list'
1581
+ });
1582
+ }
1583
+
1584
+ async function suggestOrgSlug() {
1585
+ const orgsCResult = await fetchOrganization();
1586
+ if (!orgsCResult.ok) {
1587
+ logger.logger.fail('Failed to lookup organization list from API, unable to suggest');
1588
+ return undefined;
1589
+ }
1524
1590
 
1525
1591
  // Ignore a failed request here. It was not the primary goal of
1526
1592
  // running this command and reporting it only leads to end-user confusion.
1527
- if (result.ok) {
1528
- const proceed = await prompts.select({
1529
- message: 'Missing org name; do you want to use any of these orgs for this scan?',
1530
- choices: [...Object.values(result.data.organizations).map(org => {
1531
- const name = org.name ?? org.slug;
1532
- return {
1533
- name: `Yes [${name}]`,
1534
- value: name,
1535
- description: `Use "${name}" as the organization`
1536
- };
1537
- }), {
1538
- name: 'No',
1539
- value: '',
1540
- description: 'Do not use any of these organizations (will end in a no-op)'
1541
- }]
1542
- });
1543
- if (proceed === undefined) {
1544
- return undefined;
1545
- }
1546
- if (proceed) {
1547
- return proceed;
1548
- }
1549
- } else {
1550
- logger.logger.fail('Failed to lookup organization list from API, unable to suggest');
1593
+ const {
1594
+ organizations
1595
+ } = orgsCResult.data;
1596
+ const proceed = await prompts.select({
1597
+ message: 'Missing org name; do you want to use any of these orgs for this scan?',
1598
+ choices: [...Object.values(organizations).map(o => {
1599
+ const name = o.name ?? o.slug;
1600
+ return {
1601
+ name: `Yes [${name}]`,
1602
+ value: name,
1603
+ description: `Use "${name}" as the organization`
1604
+ };
1605
+ }), {
1606
+ name: 'No',
1607
+ value: '',
1608
+ description: 'Do not use any of these organizations (will end in a no-op)'
1609
+ }]
1610
+ });
1611
+ if (proceed) {
1612
+ return proceed;
1551
1613
  }
1614
+ return undefined;
1552
1615
  }
1553
1616
 
1554
1617
  async function suggestToPersistOrgSlug(orgSlug) {
@@ -1626,6 +1689,47 @@ async function determineOrgSlug(orgFlag, interactive, dryRun) {
1626
1689
  return [orgSlug, defaultOrgSlug];
1627
1690
  }
1628
1691
 
1692
+ // Use the config defaultOrg when set, otherwise discover from remote.
1693
+ async function getDefaultOrgSlug() {
1694
+ const defaultOrgResult = getConfigValueOrUndef('defaultOrg');
1695
+ if (defaultOrgResult) {
1696
+ debug.debugFn('notice', 'use: default org', defaultOrgResult);
1697
+ return {
1698
+ ok: true,
1699
+ data: defaultOrgResult
1700
+ };
1701
+ }
1702
+ const orgsCResult = await fetchOrganization();
1703
+ if (!orgsCResult.ok) {
1704
+ return orgsCResult;
1705
+ }
1706
+ const {
1707
+ organizations
1708
+ } = orgsCResult.data;
1709
+ const keys = Object.keys(organizations);
1710
+ if (!keys.length) {
1711
+ return {
1712
+ ok: false,
1713
+ message: 'Failed to establish identity',
1714
+ data: `API did not return any organization associated with the current API token. Unable to continue.`
1715
+ };
1716
+ }
1717
+ const slug = organizations[keys[0]]?.name ?? undefined;
1718
+ if (!slug) {
1719
+ return {
1720
+ ok: false,
1721
+ message: 'Failed to establish identity',
1722
+ data: `Was unable to determine the default organization for the current API token. Unable to continue.`
1723
+ };
1724
+ }
1725
+ debug.debugFn('notice', 'resolve: org', slug);
1726
+ return {
1727
+ ok: true,
1728
+ message: 'Retrieved default org from server',
1729
+ data: slug
1730
+ };
1731
+ }
1732
+
1629
1733
  async function getBaseBranch(cwd = process.cwd()) {
1630
1734
  // Lazily access constants.ENV properties.
1631
1735
  const {
@@ -2031,16 +2135,15 @@ function* walkNestedMap(map, keys = []) {
2031
2135
  }
2032
2136
  }
2033
2137
 
2034
- const {
2035
- NODE_MODULES: NODE_MODULES$1,
2036
- NPM: NPM$4,
2037
- shadowBinPath
2038
- } = constants;
2039
2138
  function findBinPathDetailsSync(binName) {
2040
2139
  const binPaths = vendor.libExports$1.sync(binName, {
2041
2140
  all: true,
2042
2141
  nothrow: true
2043
2142
  }) ?? [];
2143
+ // Lazily access constants.shadowBinPath.
2144
+ const {
2145
+ shadowBinPath
2146
+ } = constants;
2044
2147
  let shadowIndex = -1;
2045
2148
  let theBinPath;
2046
2149
  for (let i = 0, {
@@ -2068,7 +2171,7 @@ function findNpmPathSync(npmBinPath) {
2068
2171
  } = constants;
2069
2172
  let thePath = npmBinPath;
2070
2173
  while (true) {
2071
- const libNmNpmPath = path.join(thePath, 'lib', NODE_MODULES$1, NPM$4);
2174
+ const libNmNpmPath = path.join(thePath, 'lib/node_modules/npm');
2072
2175
  // mise puts its npm bin in a path like:
2073
2176
  // /Users/SomeUsername/.local/share/mise/installs/node/vX.X.X/bin/npm.
2074
2177
  // HOWEVER, the location of the npm install is:
@@ -2078,9 +2181,9 @@ function findNpmPathSync(npmBinPath) {
2078
2181
  // will throw an ENOTDIR error for paths like ./a-file-that-exists/a-directory-that-does-not.
2079
2182
  // See https://github.com/nodejs/node/issues/56993.
2080
2183
  fs.existsSync(libNmNpmPath) && safeStatsSync(libNmNpmPath)?.isDirectory()) {
2081
- thePath = path.join(libNmNpmPath, NPM$4);
2184
+ thePath = path.join(libNmNpmPath, 'npm');
2082
2185
  }
2083
- const nmPath = path.join(thePath, NODE_MODULES$1);
2186
+ const nmPath = path.join(thePath, 'node_modules');
2084
2187
  if (
2085
2188
  // npm bin paths may look like:
2086
2189
  // /usr/local/share/npm/bin/npm
@@ -2094,9 +2197,9 @@ function findNpmPathSync(npmBinPath) {
2094
2197
  // C:\Program Files\nodejs\node_modules
2095
2198
  fs.existsSync(nmPath) && safeStatsSync(nmPath)?.isDirectory() && (
2096
2199
  // Optimistically look for the default location.
2097
- path.basename(thePath) === NPM$4 ||
2200
+ path.basename(thePath) === 'npm' ||
2098
2201
  // Chocolatey installs npm bins in the same directory as node bins.
2099
- WIN32 && fs.existsSync(path.join(thePath, `${NPM$4}.cmd`)))) {
2202
+ WIN32 && fs.existsSync(path.join(thePath, 'npm.cmd')))) {
2100
2203
  return thePath;
2101
2204
  }
2102
2205
  const parent = path.dirname(thePath);
@@ -2114,11 +2217,11 @@ async function getPackageFilesForScan(inputPaths, supportedFiles, options) {
2114
2217
  __proto__: null,
2115
2218
  ...options
2116
2219
  };
2117
- const entries = await globWithGitIgnore(pathsToGlobPatterns(inputPaths), {
2220
+ const filepaths = await globWithGitIgnore(pathsToGlobPatterns(inputPaths), {
2118
2221
  cwd,
2119
2222
  socketConfig
2120
2223
  });
2121
- return await filterGlobResultToSupportedFiles(entries, supportedFiles);
2224
+ return filterBySupportedScanFiles(filepaths, supportedFiles);
2122
2225
  }
2123
2226
 
2124
2227
  async function readOrDefaultSocketJson(cwd) {
@@ -2440,11 +2543,11 @@ function getMinVersion(range) {
2440
2543
  return null;
2441
2544
  }
2442
2545
 
2443
- const require$1 = require$$5.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('utils.js', document.baseURI).href)));
2546
+ const require$1 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
2444
2547
  let _translations;
2445
2548
  function getTranslations() {
2446
2549
  if (_translations === undefined) {
2447
- _translations = require$1(
2550
+ _translations = /*@__PURE__*/require$1(
2448
2551
  // Lazily access constants.rootPath.
2449
2552
  path.join(constants.rootPath, 'translations.json'));
2450
2553
  }
@@ -2555,7 +2658,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPurl, options) {
2555
2658
  const fixableCve = fixType === ALERT_FIX_TYPE.cve;
2556
2659
  const fixableUpgrade = fixType === ALERT_FIX_TYPE.upgrade;
2557
2660
  const fixable = fixableCve || fixableUpgrade;
2558
- const upgradable = fixableUpgrade && !objects.hasOwn(overrides, name);
2661
+ const upgradable = fixableUpgrade && !require$$7.hasOwn(overrides, name);
2559
2662
  if (include.blocked && blocked || include.critical && critical || include.cve && cve || include.unfixable && !fixable || include.upgradable && upgradable) {
2560
2663
  sockPkgAlerts.push({
2561
2664
  name,
@@ -2920,7 +3023,7 @@ function parsePnpmLockfile(lockfileContent) {
2920
3023
  result = vendor.jsYaml.load(strings.stripBom(lockfileContent));
2921
3024
  } catch {}
2922
3025
  }
2923
- return objects.isObjectObject(result) ? result : null;
3026
+ return require$$7.isObjectObject(result) ? result : null;
2924
3027
  }
2925
3028
  function parsePnpmLockfileVersion(version) {
2926
3029
  try {
@@ -2944,15 +3047,15 @@ async function getAlertsMapFromPnpmLockfile(lockfile, options) {
2944
3047
  ...options
2945
3048
  });
2946
3049
  }
2947
- async function getAlertsMapFromPurls(purls, options_) {
2948
- const options = {
3050
+ async function getAlertsMapFromPurls(purls, options) {
3051
+ const opts = {
2949
3052
  __proto__: null,
2950
3053
  consolidate: false,
2951
3054
  include: undefined,
2952
3055
  nothrow: false,
2953
- ...options_
3056
+ ...options
2954
3057
  };
2955
- options.include = {
3058
+ opts.include = {
2956
3059
  __proto__: null,
2957
3060
  // Leave 'actions' unassigned so it can be given a default value in
2958
3061
  // subsequent functions where `options` is passed.
@@ -2963,11 +3066,8 @@ async function getAlertsMapFromPurls(purls, options_) {
2963
3066
  existing: false,
2964
3067
  unfixable: true,
2965
3068
  upgradable: false,
2966
- ...options.include
3069
+ ...opts.include
2967
3070
  };
2968
- const {
2969
- spinner
2970
- } = options;
2971
3071
  const uniqPurls = arrays.arrayUnique(purls);
2972
3072
  debug.debugDir('silly', {
2973
3073
  purls: uniqPurls
@@ -2979,37 +3079,44 @@ async function getAlertsMapFromPurls(purls, options_) {
2979
3079
  if (!remaining) {
2980
3080
  return alertsByPurl;
2981
3081
  }
3082
+ const {
3083
+ spinner
3084
+ } = opts;
2982
3085
  const getText = () => `Looking up data for ${remaining} packages`;
2983
3086
  spinner?.start(getText());
2984
- const sockSdkCResult = await setupSdk(getPublicToken());
3087
+ const sockSdkCResult = await setupSdk({
3088
+ apiToken: getPublicToken()
3089
+ });
2985
3090
  if (!sockSdkCResult.ok) {
2986
3091
  spinner?.stop();
2987
3092
  throw new Error('Auth error: Try to run `socket login` first');
2988
3093
  }
2989
3094
  const sockSdk = sockSdkCResult.data;
2990
3095
  const alertsMapOptions = {
2991
- overrides: options.overrides,
2992
- consolidate: options.consolidate,
2993
- include: options.include,
3096
+ overrides: opts.overrides,
3097
+ consolidate: opts.consolidate,
3098
+ include: opts.include,
2994
3099
  spinner
2995
3100
  };
2996
3101
  for await (const batchResult of sockSdk.batchPackageStream({
2997
- alerts: 'true',
2998
- compact: 'true',
2999
- ...(options.include.actions ? {
3000
- actions: options.include.actions.join(',')
3001
- } : {}),
3002
- ...(options.include.unfixable ? {} : {
3003
- fixable: 'true'
3004
- })
3005
- }, {
3006
3102
  components: uniqPurls.map(purl => ({
3007
3103
  purl
3008
3104
  }))
3105
+ }, {
3106
+ queryParams: {
3107
+ alerts: 'true',
3108
+ compact: 'true',
3109
+ ...(opts.include.actions ? {
3110
+ actions: opts.include.actions.join(',')
3111
+ } : {}),
3112
+ ...(opts.include.unfixable ? {} : {
3113
+ fixable: 'true'
3114
+ })
3115
+ }
3009
3116
  })) {
3010
3117
  if (batchResult.success) {
3011
3118
  await addArtifactToAlertsMap(batchResult.data, alertsByPurl, alertsMapOptions);
3012
- } else if (!options.nothrow) {
3119
+ } else if (!opts.nothrow) {
3013
3120
  const statusCode = batchResult.status ?? 'unknown';
3014
3121
  const statusMessage = batchResult.error ?? 'No status message';
3015
3122
  throw new Error(`Socket API server error (${statusCode}): ${statusMessage}`);
@@ -3090,7 +3197,7 @@ function safeNpmInstall(options) {
3090
3197
  ...options
3091
3198
  };
3092
3199
  let stdio = spawnOptions.stdio;
3093
- const useIpc = objects.isObject(ipc);
3200
+ const useIpc = require$$7.isObject(ipc);
3094
3201
  // Include 'ipc' in the spawnOptions.stdio when an options.ipc object is provided.
3095
3202
  // See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
3096
3203
  // and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
@@ -3249,6 +3356,9 @@ async function spawnCoana(args, options, extra) {
3249
3356
  __proto__: null,
3250
3357
  ...options
3251
3358
  };
3359
+ const orgSlugCResult = await getDefaultOrgSlug();
3360
+ const SOCKET_CLI_API_TOKEN = getDefaultToken();
3361
+ const SOCKET_ORG_SLUG = orgSlugCResult.ok ? orgSlugCResult.data : undefined;
3252
3362
  try {
3253
3363
  const output = await spawn.spawn(constants.execPath, [
3254
3364
  // Lazily access constants.nodeNoWarningsFlags.
@@ -3260,7 +3370,9 @@ async function spawnCoana(args, options, extra) {
3260
3370
  ...process.env,
3261
3371
  // Lazily access constants.processEnv.
3262
3372
  ...constants.processEnv,
3263
- SOCKET_CLI_API_TOKEN: getDefaultToken(),
3373
+ RUN_WITHOUT_DOCKER: 'true',
3374
+ SOCKET_CLI_API_TOKEN,
3375
+ SOCKET_ORG_SLUG,
3264
3376
  ...spawnEnv
3265
3377
  }
3266
3378
  }, extra);
@@ -3694,6 +3806,7 @@ exports.detectAndValidatePackageEnvironment = detectAndValidatePackageEnvironmen
3694
3806
  exports.determineOrgSlug = determineOrgSlug;
3695
3807
  exports.extractOverridesFromPnpmLockSrc = extractOverridesFromPnpmLockSrc;
3696
3808
  exports.failMsgWithBadge = failMsgWithBadge;
3809
+ exports.fetchOrganization = fetchOrganization;
3697
3810
  exports.getAlertsMapFromPnpmLockfile = getAlertsMapFromPnpmLockfile;
3698
3811
  exports.getAlertsMapFromPurls = getAlertsMapFromPurls;
3699
3812
  exports.getBaseBranch = getBaseBranch;
@@ -3701,6 +3814,7 @@ exports.getBashrcDetails = getBashrcDetails;
3701
3814
  exports.getConfigValue = getConfigValue;
3702
3815
  exports.getConfigValueOrUndef = getConfigValueOrUndef;
3703
3816
  exports.getCveInfoFromAlertsMap = getCveInfoFromAlertsMap;
3817
+ exports.getDefaultOrgSlug = getDefaultOrgSlug;
3704
3818
  exports.getFlagListOutput = getFlagListOutput;
3705
3819
  exports.getMajor = getMajor;
3706
3820
  exports.getMinVersion = getMinVersion;
@@ -3715,6 +3829,8 @@ exports.getPurlObject = getPurlObject;
3715
3829
  exports.getRepoInfo = getRepoInfo;
3716
3830
  exports.getRepoName = getRepoName;
3717
3831
  exports.getSocketDevPackageOverviewUrlFromPurl = getSocketDevPackageOverviewUrlFromPurl;
3832
+ exports.getSupportedConfigEntries = getSupportedConfigEntries;
3833
+ exports.getSupportedConfigKeys = getSupportedConfigKeys;
3718
3834
  exports.getVisibleTokenPrefix = getVisibleTokenPrefix;
3719
3835
  exports.gitBranch = gitBranch;
3720
3836
  exports.gitCheckoutBranch = gitCheckoutBranch;
@@ -3735,6 +3851,9 @@ exports.isHelpFlag = isHelpFlag;
3735
3851
  exports.isNpmBinPathShadowed = isNpmBinPathShadowed;
3736
3852
  exports.isNpxBinPathShadowed = isNpxBinPathShadowed;
3737
3853
  exports.isReadOnlyConfig = isReadOnlyConfig;
3854
+ exports.isReportSupportedFile = isReportSupportedFile;
3855
+ exports.isSensitiveConfigKey = isSensitiveConfigKey;
3856
+ exports.isSupportedConfigKey = isSupportedConfigKey;
3738
3857
  exports.logAlertsMap = logAlertsMap;
3739
3858
  exports.mapToObject = mapToObject;
3740
3859
  exports.mdTable = mdTable;
@@ -3757,15 +3876,13 @@ exports.runAgentInstall = runAgentInstall;
3757
3876
  exports.safeReadFile = safeReadFile;
3758
3877
  exports.safeReadFileSync = safeReadFileSync;
3759
3878
  exports.safeStatsSync = safeStatsSync;
3760
- exports.sensitiveConfigKeys = sensitiveConfigKeys;
3761
3879
  exports.serializeResultJson = serializeResultJson;
3762
3880
  exports.setupSdk = setupSdk;
3763
3881
  exports.spawnCoana = spawnCoana;
3764
3882
  exports.suggestOrgSlug = suggestOrgSlug;
3765
- exports.supportedConfigKeys = supportedConfigKeys;
3766
3883
  exports.tildify = tildify;
3767
3884
  exports.updateConfigValue = updateConfigValue;
3768
3885
  exports.walkNestedMap = walkNestedMap;
3769
3886
  exports.writeSocketJson = writeSocketJson;
3770
- //# debugId=96b61366-c81e-4ff5-9bd9-16bed8c0ae5f
3887
+ //# debugId=eeb540f1-2cc9-44c6-8101-3926e319a1db
3771
3888
  //# sourceMappingURL=utils.js.map