@socketsecurity/cli-with-sentry 1.17.1 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +5 -5
  3. package/dist/.config/tsconfig.dts.tsbuildinfo +1 -1
  4. package/dist/cli.js +426 -257
  5. package/dist/cli.js.map +1 -1
  6. package/dist/constants.js +4 -4
  7. package/dist/constants.js.map +1 -1
  8. package/dist/types/commands/fix/generated-socket-facts.d.mts +3 -2
  9. package/dist/types/commands/manifest/build-root-config.d.mts +18 -1
  10. package/dist/types/commands/manifest/generate-recursive-manifests.d.mts +3 -1
  11. package/dist/types/commands/manifest/run-manifest-facts.d.mts +4 -0
  12. package/dist/types/commands/manifest/scripts/build-tool.d.mts +0 -4
  13. package/dist/types/commands/manifest/setup-manifest-config.d.mts +9 -1
  14. package/dist/types/constants.d.mts +1 -1
  15. package/dist/types/utils/coana.d.mts +0 -2
  16. package/dist/types/utils/socket-json.d.mts +38 -0
  17. package/dist/utils.js +201 -29
  18. package/dist/utils.js.map +1 -1
  19. package/package.json +1 -3
  20. package/dist/manifest-scripts/dotnet-tool/Microsoft.Build.Locator.dll +0 -0
  21. package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.deps.json +0 -42
  22. package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.dll +0 -0
  23. package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.dll.config +0 -623
  24. package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.runtimeconfig.json +0 -15
  25. package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
  26. package/dist/manifest-scripts/socket-facts.init.gradle +0 -832
  27. package/dist/manifest-scripts/socket-facts.plugin.scala +0 -1018
  28. package/dist/manifest-scripts/socket-workspaces.init.gradle +0 -123
  29. package/dist/manifest-scripts/socket-workspaces.plugin.scala +0 -147
  30. package/dist/types/commands/manifest/scripts/assemble.d.mts +0 -14
  31. package/dist/types/commands/manifest/scripts/exclude-paths-glob.d.mts +0 -8
  32. package/dist/types/commands/manifest/scripts/facts.d.mts +0 -111
  33. package/dist/types/commands/manifest/scripts/records.d.mts +0 -124
  34. package/dist/types/commands/manifest/scripts/resolution-report-gradle.d.mts +0 -10
  35. package/dist/types/commands/manifest/scripts/resolution-report-ivy.d.mts +0 -6
  36. package/dist/types/commands/manifest/scripts/resolution-report-maven.d.mts +0 -7
  37. package/dist/types/commands/manifest/scripts/resolution-report-nuget.d.mts +0 -6
  38. package/dist/types/commands/manifest/scripts/resolution-report-render.d.mts +0 -63
  39. package/dist/types/commands/manifest/scripts/resolution-report.d.mts +0 -28
  40. package/dist/types/commands/manifest/scripts/run.d.mts +0 -67
  41. package/dist/types/commands/manifest/scripts/sidecar.d.mts +0 -60
  42. package/dist/types/commands/manifest/scripts/test/assemble-records.d.mts +0 -1
package/dist/utils.js CHANGED
@@ -10201,11 +10201,8 @@ async function snapshotSocketFacts(scanPaths, options) {
10201
10201
  function isFactsOnlyTypes(types) {
10202
10202
  return !!types.length;
10203
10203
  }
10204
-
10205
- // Maven alone keeps the older flag, which Coana releases before 15.14.1 also
10206
- // know.
10207
10204
  function useOnlySocketFactsArtifactsFlags(types) {
10208
- return types.length === 1 && types[0] === 'maven' ? ['--maven-use-only-socket-facts'] : ['--use-only-socket-facts-artifacts', [...types].sort().join(',')];
10205
+ return ['--use-only-socket-facts-artifacts', [...types].sort().join(',')];
10209
10206
  }
10210
10207
 
10211
10208
  function getEnterpriseOrgs(orgs) {
@@ -10218,6 +10215,143 @@ function hasEnterpriseOrgPlan(orgs) {
10218
10215
  return orgs.some(o => o.plan.includes('enterprise'));
10219
10216
  }
10220
10217
 
10218
+ // The purl type of the packages each tool resolves; exhaustive, so a new tool
10219
+ // cannot silently produce another ecosystem's purls.
10220
+ const PURL_TYPE_BY_TOOL = {
10221
+ __proto__: null,
10222
+ dotnet: 'nuget',
10223
+ gradle: 'maven',
10224
+ maven: 'maven',
10225
+ sbt: 'maven'
10226
+ };
10227
+ const BUILD_TOOLS = Object.keys(PURL_TYPE_BY_TOOL);
10228
+ const ECOSYSTEM_LABELS = {
10229
+ __proto__: null,
10230
+ dotnet: '.NET',
10231
+ gradle: 'Gradle',
10232
+ maven: 'Maven',
10233
+ sbt: 'sbt'
10234
+ };
10235
+ const FACTS_PURL_TYPES = [...new Set(Object.values(PURL_TYPE_BY_TOOL))].sort();
10236
+ function buildRootPath(root) {
10237
+ return path.join(root.dir, root.entryFile ?? '');
10238
+ }
10239
+ function buildToolsFor(purlTypes) {
10240
+ return BUILD_TOOLS.filter(tool => purlTypes.includes(PURL_TYPE_BY_TOOL[tool]));
10241
+ }
10242
+ function buildToolLabelsFor(purlTypes) {
10243
+ return buildToolsFor(purlTypes).map(tool => ECOSYSTEM_LABELS[tool]);
10244
+ }
10245
+ const BUILD_TOOL_PATH_ENV = {
10246
+ __proto__: null,
10247
+ gradle: 'SOCKET_CLI_GRADLE_PATH',
10248
+ maven: 'SOCKET_CLI_MAVEN_PATH',
10249
+ sbt: 'SOCKET_CLI_SBT_PATH'
10250
+ };
10251
+ function validatedEnvBuildToolPath(tool, projectDir) {
10252
+ const envName = BUILD_TOOL_PATH_ENV[tool];
10253
+ const selected = process.env[envName];
10254
+ if (!selected) {
10255
+ throw new Error(`Standalone Socket does not support ${tool} manifest execution without ${envName}: JVM runtime and toolchain assets are not bundled.`);
10256
+ }
10257
+ const executable = path.resolve(projectDir, selected);
10258
+ return validateExecutablePath(envName, selected, executable);
10259
+ }
10260
+ function validateExecutablePath(envName, selected, executable) {
10261
+ try {
10262
+ if (!u.statSync(executable).isFile()) {
10263
+ throw new Error('not a regular file');
10264
+ }
10265
+ u.accessSync(executable, u.constants.X_OK);
10266
+ return executable;
10267
+ } catch {
10268
+ throw new Error(`${envName} must point to a regular executable file; received '${selected}'.`);
10269
+ }
10270
+ }
10271
+
10272
+ // PATH fallback when no `bin` and no project wrapper.
10273
+ const DEFAULT_BUILD_TOOL_BIN = {
10274
+ __proto__: null,
10275
+ dotnet: 'dotnet',
10276
+ gradle: 'gradle',
10277
+ maven: 'mvn',
10278
+ sbt: 'sbt'
10279
+ };
10280
+
10281
+ // Project-local wrapper, preferred because it pins the expected build-tool
10282
+ // version. sbt has no wrapper convention. POSIX names only (no win32 target).
10283
+ const BUILD_TOOL_WRAPPER = {
10284
+ __proto__: null,
10285
+ gradle: 'gradlew',
10286
+ maven: 'mvnw'
10287
+ };
10288
+
10289
+ // Maven (`mvn --file`) and dotnet (`dotnet restore <file>`) build by file, so
10290
+ // a directory can hold several builds, matched case-insensitively. `walkGlob`
10291
+ // is a case-sensitive superset of `nocaseGlob`, for the walk.
10292
+
10293
+ // `settings.gradle(.kts)` covers Kotlin-DSL roots that have no root
10294
+ // `build.gradle`.
10295
+ const BUILD_FILES = {
10296
+ __proto__: null,
10297
+ // Solutions, and the project types the .NET SDK builds. A solution filter
10298
+ // (.slnf) narrows a solution, so it is only built when named explicitly.
10299
+ dotnet: {
10300
+ byFile: true,
10301
+ nocaseGlob: '*.{sln,slnx,csproj,fsproj,vbproj}',
10302
+ walkGlob: '*.{[sS][lL][nN],[sS][lL][nN][xX],[cCfFvV][sSbB][pP][rR][oO][jJ]}',
10303
+ // A solution covers the projects it lists.
10304
+ entryRank: file => isDotnetSolution(file) ? 0 : 1
10305
+ },
10306
+ gradle: {
10307
+ byFile: false,
10308
+ names: ['build.gradle', 'build.gradle.kts', 'settings.gradle', 'settings.gradle.kts'],
10309
+ rootMarkers: ['settings.gradle', 'settings.gradle.kts'],
10310
+ // Gradle builds `buildSrc` on its own.
10311
+ loadsAncestorBuild: {
10312
+ except: ['buildSrc']
10313
+ }
10314
+ },
10315
+ maven: {
10316
+ byFile: true,
10317
+ nocaseGlob: '{*-*.,}pom{.xml,}',
10318
+ walkGlob: '*[pP][oO][mM]*'
10319
+ },
10320
+ // A subproject's own `project/` is ignored by the build that includes it.
10321
+ sbt: {
10322
+ byFile: false,
10323
+ names: ['build.sbt'],
10324
+ rootMarkers: ['project']
10325
+ }
10326
+ };
10327
+
10328
+ // sbt happily runs in any directory, synthesizing a default project from its
10329
+ // name, so an sbt run outside a build yields a plausible but bogus SBOM. Maven
10330
+ // and Gradle refuse such a directory themselves.
10331
+ function looksLikeSbtBuild(projectDir) {
10332
+ return u.existsSync(path.resolve(projectDir, 'build.sbt')) || u.existsSync(path.resolve(projectDir, 'project'));
10333
+ }
10334
+ function resolveBuildToolBin(tool, projectDir, bin, standalone = false) {
10335
+ if (standalone) {
10336
+ return validatedEnvBuildToolPath(tool, projectDir);
10337
+ }
10338
+ const envOverride = process.env[BUILD_TOOL_PATH_ENV[tool]];
10339
+ if (envOverride) {
10340
+ return validateExecutablePath(BUILD_TOOL_PATH_ENV[tool], envOverride, path.resolve(projectDir, envOverride));
10341
+ }
10342
+ if (bin) {
10343
+ return bin;
10344
+ }
10345
+ const wrapperName = BUILD_TOOL_WRAPPER[tool];
10346
+ if (wrapperName && u.existsSync(path.resolve(projectDir, wrapperName))) {
10347
+ return `./${wrapperName}`;
10348
+ }
10349
+ return DEFAULT_BUILD_TOOL_BIN[tool];
10350
+ }
10351
+ function isDotnetSolution(file) {
10352
+ return /\.slnx?$/i.test(file);
10353
+ }
10354
+
10221
10355
  function getOrInsert(map, key, make) {
10222
10356
  if (map.has(key)) {
10223
10357
  return map.get(key);
@@ -10247,6 +10381,25 @@ function getOrInsert(map, key, make) {
10247
10381
  * - Supports both read and write operations
10248
10382
  */
10249
10383
 
10384
+ const REACHABILITY_BUILDS = ['compile', 'none'];
10385
+
10386
+ // Controls whether reachability analysis builds the project first.
10387
+ // Defaults to "none".
10388
+
10389
+ // Only reachability scans read these settings.
10390
+
10391
+ const REACHABILITY_FIELDS_BY_TOOL = {
10392
+ __proto__: null,
10393
+ dotnet: ['build', 'runtimeVersion'],
10394
+ gradle: ['build', 'javaHome'],
10395
+ maven: ['build', 'javaHome'],
10396
+ sbt: ['build', 'javaHome']
10397
+ };
10398
+
10399
+ // A null field clears its inherited value.
10400
+
10401
+ // The settings in effect for a build, which a reachability scan sends Coana.
10402
+
10250
10403
  function readOrDefaultSocketJson(cwd) {
10251
10404
  const jsonCResult = readSocketJsonSync(cwd, true);
10252
10405
  return jsonCResult.ok ? jsonCResult.data :
@@ -10269,7 +10422,29 @@ async function readOrDefaultSocketJsonUp(cwd) {
10269
10422
  return getDefaultSocketJson();
10270
10423
  }
10271
10424
 
10272
- // Shallow-merges `defaults.manifest.<ecosystem>` per ecosystem: fields set in
10425
+ // A build tool's section merges field by field, and so does each of its
10426
+ // object-valued fields (`reachability`).
10427
+ function mergeBuildToolDefaults(base, override) {
10428
+ const merged = {
10429
+ ...base,
10430
+ ...override
10431
+ };
10432
+ for (const {
10433
+ 0: key,
10434
+ 1: value
10435
+ } of Object.entries(override)) {
10436
+ const inherited = base?.[key];
10437
+ if (isRecord(inherited) && isRecord(value)) {
10438
+ merged[key] = {
10439
+ ...inherited,
10440
+ ...value
10441
+ };
10442
+ }
10443
+ }
10444
+ return merged;
10445
+ }
10446
+
10447
+ // Merges `defaults.manifest.<ecosystem>` per ecosystem: fields set in
10273
10448
  // `override` win, others fall through to `base`. Only this section cascades;
10274
10449
  // everything else in `defaults` comes from `base` only.
10275
10450
  function mergeManifestDefaults(base, override) {
@@ -10293,29 +10468,12 @@ function mergeManifestDefaults(base, override) {
10293
10468
  ...overrideManifest.conda
10294
10469
  };
10295
10470
  }
10296
- if (overrideManifest.dotnet) {
10297
- mergedManifest.dotnet = {
10298
- ...baseManifest?.dotnet,
10299
- ...overrideManifest.dotnet
10300
- };
10301
- }
10302
- if (overrideManifest.gradle) {
10303
- mergedManifest.gradle = {
10304
- ...baseManifest?.gradle,
10305
- ...overrideManifest.gradle
10306
- };
10307
- }
10308
- if (overrideManifest.maven) {
10309
- mergedManifest.maven = {
10310
- ...baseManifest?.maven,
10311
- ...overrideManifest.maven
10312
- };
10313
- }
10314
- if (overrideManifest.sbt) {
10315
- mergedManifest.sbt = {
10316
- ...baseManifest?.sbt,
10317
- ...overrideManifest.sbt
10318
- };
10471
+ for (const tool of BUILD_TOOLS) {
10472
+ if (overrideManifest[tool]) {
10473
+ Object.assign(mergedManifest, {
10474
+ [tool]: mergeBuildToolDefaults(baseManifest?.[tool], overrideManifest[tool])
10475
+ });
10476
+ }
10319
10477
  }
10320
10478
  return {
10321
10479
  ...base,
@@ -13794,17 +13952,27 @@ function safeNpmSpecToPurl(pkgSpec) {
13794
13952
 
13795
13953
  exports.ALL_PACKAGE_MANAGERS = ALL_PACKAGE_MANAGERS;
13796
13954
  exports.AuthError = AuthError;
13955
+ exports.BUILD_FILES = BUILD_FILES;
13956
+ exports.BUILD_TOOLS = BUILD_TOOLS;
13797
13957
  exports.COMPLETION_CMD_PREFIX = COMPLETION_CMD_PREFIX;
13798
13958
  exports.CVE_FORMAT_REGEXP = CVE_FORMAT_REGEXP;
13959
+ exports.ECOSYSTEM_LABELS = ECOSYSTEM_LABELS;
13960
+ exports.FACTS_PURL_TYPES = FACTS_PURL_TYPES;
13799
13961
  exports.GHSA_FORMAT_REGEXP = GHSA_FORMAT_REGEXP;
13800
13962
  exports.IGNORED_DIRS = IGNORED_DIRS;
13801
13963
  exports.InputError = InputError;
13802
13964
  exports.OAUTH_ISSUER = OAUTH_ISSUER;
13965
+ exports.PURL_TYPE_BY_TOOL = PURL_TYPE_BY_TOOL;
13966
+ exports.REACHABILITY_BUILDS = REACHABILITY_BUILDS;
13967
+ exports.REACHABILITY_FIELDS_BY_TOOL = REACHABILITY_FIELDS_BY_TOOL;
13803
13968
  exports.RangeStyles = RangeStyles;
13804
13969
  exports.apiFetch = apiFetch;
13805
13970
  exports.arrayUnique = arrayUnique;
13806
13971
  exports.assertEmbeddedToolAvailable = assertEmbeddedToolAvailable;
13807
13972
  exports.beginOAuthLogin = beginOAuthLogin;
13973
+ exports.buildRootPath = buildRootPath;
13974
+ exports.buildToolLabelsFor = buildToolLabelsFor;
13975
+ exports.buildToolsFor = buildToolsFor;
13808
13976
  exports.cacheFetch = cacheFetch;
13809
13977
  exports.camelToKebab = camelToKebab;
13810
13978
  exports.captureException = captureException;
@@ -13908,6 +14076,7 @@ exports.isAddCommand = isAddCommand;
13908
14076
  exports.isConfigFromFlag = isConfigFromFlag;
13909
14077
  exports.isDebug = isDebug;
13910
14078
  exports.isDirSync = isDirSync;
14079
+ exports.isDotnetSolution = isDotnetSolution;
13911
14080
  exports.isErrnoException = isErrnoException;
13912
14081
  exports.isFactsOnlyTypes = isFactsOnlyTypes;
13913
14082
  exports.isGitHubBlockingError = isGitHubBlockingError;
@@ -13936,6 +14105,7 @@ exports.loadSocketConfig = loadSocketConfig;
13936
14105
  exports.logAlertsMap = logAlertsMap;
13937
14106
  exports.logger = logger;
13938
14107
  exports.logoutOAuth = logoutOAuth;
14108
+ exports.looksLikeSbtBuild = looksLikeSbtBuild;
13939
14109
  exports.mailtoLink = mailtoLink;
13940
14110
  exports.mapToObject = mapToObject;
13941
14111
  exports.mdTable = mdTable;
@@ -13943,6 +14113,7 @@ exports.mdTableOfPairs = mdTableOfPairs;
13943
14113
  exports.mdTableStringNumber = mdTableStringNumber;
13944
14114
  exports.meowOrExit = meowOrExit;
13945
14115
  exports.meowWithSubcommands = meowWithSubcommands;
14116
+ exports.mergeBuildToolDefaults = mergeBuildToolDefaults;
13946
14117
  exports.mergeSocketJsonChain = mergeSocketJsonChain;
13947
14118
  exports.msAtHome = msAtHome;
13948
14119
  exports.normalizePath = normalizePath;
@@ -13968,6 +14139,7 @@ exports.readSocketJsonSync = readSocketJsonSync;
13968
14139
  exports.realpathOrResolved = realpathOrResolved;
13969
14140
  exports.resolveAdvisoryIds = resolveAdvisoryIds;
13970
14141
  exports.resolveBinPathSync = resolveBinPathSync;
14142
+ exports.resolveBuildToolBin = resolveBuildToolBin;
13971
14143
  exports.resolvePublicApiToken = resolvePublicApiToken;
13972
14144
  exports.runAgentInstall = runAgentInstall;
13973
14145
  exports.runEmbeddedJsTool = runEmbeddedJsTool;
@@ -14009,5 +14181,5 @@ exports.walkNestedMap = walkNestedMap;
14009
14181
  exports.webLink = webLink;
14010
14182
  exports.withTmpDir = withTmpDir;
14011
14183
  exports.writeSocketJson = writeSocketJson;
14012
- //# debugId=364c347c-e4ed-4982-8c01-50bb8ad8f1da
14184
+ //# debugId=6802e485-9030-430f-a7e9-c1b485dd2896
14013
14185
  //# sourceMappingURL=utils.js.map