@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
@@ -1,123 +0,0 @@
1
- // Invoke via:
2
- // ./gradlew --init-script socket-workspaces.init.gradle socketWorkspaces
3
-
4
- // Sibling of socket-facts.init.gradle: emits only `meta`/`buildRoot`/`project`/`projectBuild`
5
- // records, no dependency resolution. Kept as a separate script so it can't affect that file's
6
- // already-verified, wide Gradle-version compatibility (1.0+).
7
-
8
- // `Project.findProperty` only exists since Gradle 2.13; fall back to hasProperty/property for older Gradle.
9
- gradle.ext.socketProp = { proj, name -> proj.hasProperty(name) ? proj.property(name) : null }
10
-
11
- // `-Psocket.excludePaths` → PRE-COMPILED, comma-joined, anchored regex pattern sources, used only
12
- // to skip whole excluded subprojects. The CLI compiles the user-facing globs in
13
- // exclude-paths-glob.mts (the single glob implementation, tested in CI); this script only
14
- // Pattern.compile()s what it receives.
15
- gradle.ext.socketExcludeMatchersCache = null
16
- gradle.ext.socketExcludeMatchers = {
17
- if (gradle.ext.socketExcludeMatchersCache != null) return gradle.ext.socketExcludeMatchersCache
18
- def raw = gradle.socketProp.call(gradle.rootProject, 'socket.excludePaths')?.toString()
19
- def patterns = []
20
- if (raw != null && !raw.trim().isEmpty()) {
21
- raw.split(',').each { r ->
22
- def p = r.trim()
23
- if (!p.isEmpty()) {
24
- // A pattern that doesn't compile is dropped, never thrown: the CLI emits a
25
- // dialect-portable subset, so this only guards against a broken transport.
26
- try { patterns << java.util.regex.Pattern.compile(p) }
27
- catch (java.util.regex.PatternSyntaxException ignored) { }
28
- }
29
- }
30
- }
31
- gradle.ext.socketExcludeMatchersCache = patterns
32
- patterns
33
- }
34
- gradle.ext.socketIsExcluded = { String rel ->
35
- def c = (rel == null ? '' : rel).replace('\\', '/')
36
- while (c.startsWith('./')) { c = c.substring(2) }
37
- while (c.startsWith('/')) { c = c.substring(1) }
38
- while (c.endsWith('/')) { c = c.substring(0, c.length() - 1) }
39
- if (c.isEmpty()) { return false }
40
- gradle.ext.socketExcludeMatchers.call().any { p -> p.matcher(c).matches() }
41
- }
42
- // `-Psocket.excludeBase` (the scan root; the root project's dir by default) anchors `--exclude-paths`:
43
- // a project relocated outside the build root still matches, one outside the scan root never does.
44
- gradle.ext.socketExcludeBaseCache = null
45
- gradle.ext.socketIsExcludedDir = { java.io.File dir ->
46
- if (gradle.ext.socketExcludeMatchers.call().isEmpty()) { return false }
47
- if (gradle.ext.socketExcludeBaseCache == null) {
48
- def base = gradle.socketProp.call(gradle.rootProject, 'socket.excludeBase')?.toString()
49
- gradle.ext.socketExcludeBaseCache = (base ? new java.io.File(base) : gradle.rootProject.projectDir).canonicalFile.toPath()
50
- }
51
- def path = dir.canonicalFile.toPath()
52
- // On another Windows drive than the scan root, so outside it.
53
- if (path.root != gradle.ext.socketExcludeBaseCache.root) { return false }
54
- def rel = gradle.ext.socketExcludeBaseCache.relativize(path).toString().replace(File.separator, '/')
55
- !(rel == '..' || rel.startsWith('../')) && gradle.ext.socketIsExcluded.call(rel.isEmpty() ? '.' : rel)
56
- }
57
-
58
- gradle.ext.socketWorkspacesInfo = Collections.synchronizedList([])
59
-
60
- // Collect every non-excluded project's identity at configuration time - cheap, no dependency
61
- // resolution, no sourceSets/jar introspection (unlike the full facts script, which also stamps
62
- // sources/targets/artifact-ext for resolution-time use).
63
- gradle.projectsEvaluated { g ->
64
- def rootPath = g.rootProject.projectDir.toPath()
65
- def rel = { java.io.File f ->
66
- def r = rootPath.relativize(f.toPath()).toString().replace(File.separator, '/')
67
- r.isEmpty() ? '.' : r
68
- }
69
- g.rootProject.allprojects.each { p ->
70
- if (g.ext.socketIsExcludedDir.call(p.projectDir)) {
71
- return
72
- }
73
- def buildFiles = []
74
- try {
75
- def bf = p.buildFile
76
- if (bf != null) buildFiles << rel(bf)
77
- } catch (Exception ignore) {}
78
- g.socketWorkspacesInfo.add([
79
- path : p.path,
80
- group : (p.group ?: '').toString(),
81
- name : p.name,
82
- version: (p.version ?: '').toString(),
83
- dir : rel(p.projectDir),
84
- buildFiles: buildFiles,
85
- ])
86
- }
87
- }
88
-
89
- rootProject { rp ->
90
- def recordsFileOverride = gradle.socketProp.call(rp, 'socket.recordsFile')?.toString()
91
- def defaultRecordsFile = new File(rp.projectDir, '.socket.workspaces.records.tsv').absolutePath
92
- def buildRootPath = rp.projectDir.absolutePath
93
-
94
- rp.tasks.create('socketWorkspaces') {
95
- group = 'socket'
96
- description = 'Emits Socket workspace records (project list only; no dependency resolution)'
97
- outputs.upToDateWhen { false }
98
-
99
- doLast {
100
- def esc = { v ->
101
- (v == null ? '' : v.toString())
102
- .replace('\\', '\\\\').replace('\t', '\\t').replace('\n', '\\n').replace('\r', '\\r')
103
- }
104
- def lines = []
105
- def rec = { List fields -> lines << fields.collect { esc(it) }.join('\t') }
106
-
107
- rec(['meta', 'gradle', gradle.gradleVersion, System.getProperty('java.version')])
108
- rec(['buildRoot', buildRootPath])
109
-
110
- def info
111
- synchronized (gradle.socketWorkspacesInfo) { info = new ArrayList(gradle.socketWorkspacesInfo) }
112
- info.each { pi ->
113
- rec(['project', pi.path, pi.group, pi.name, pi.version, pi.dir])
114
- pi.buildFiles.each { f -> rec(['projectBuild', pi.path, f]) }
115
- }
116
-
117
- def outFile = new File(recordsFileOverride ?: defaultRecordsFile)
118
- outFile.parentFile?.mkdirs()
119
- outFile.withWriter('UTF-8') { it.write(lines.join('\n') + '\n') }
120
- println "Socket workspace records written to: ${outFile.absolutePath}"
121
- }
122
- }
123
- }
@@ -1,147 +0,0 @@
1
- package socket
2
-
3
- import sbt._
4
- import sbt.Keys._
5
-
6
- /**
7
- * Sibling of SocketFactsPlugin (socket-facts.plugin.scala): emits only `meta`/`buildRoot`/
8
- * `project`/`projectBuild` records, no dependency resolution. Kept as a separate plugin so it
9
- * can't affect that file's already-verified wide sbt-version compatibility (0.13.x+).
10
- *
11
- * Must compile on Scala 2.10/sbt 0.13 and Scala 2.12/sbt 1.x, same constraint as the facts plugin.
12
- */
13
- object SocketWorkspacesPlugin extends AutoPlugin {
14
- override def trigger = allRequirements
15
-
16
- object autoImport {
17
- val socketWorkspaces =
18
- taskKey[Unit]("Emit Socket workspace records (project list only; no dependency resolution)")
19
- }
20
- import autoImport._
21
-
22
- override def projectSettings: Seq[Setting[_]] = Seq(
23
- aggregate in socketWorkspaces := false,
24
- socketWorkspaces := {
25
- val st = state.value
26
- val buildRoot = (baseDirectory in ThisBuild).value
27
-
28
- val extracted = Project.extract(st)
29
- val allRefs = extracted.structure.allProjectRefs
30
-
31
- // `-Dsocket.excludePaths` (scan-root-relative globs): a subproject whose dir is wholly excluded
32
- // emits no project record. Mirrors socket-facts.plugin.scala / the gradle / maven producers.
33
- val excludeMatchers = parseExcludeMatchers()
34
- val rootCanonPath = buildRoot.getCanonicalFile.toPath
35
- def relTo(base: java.nio.file.Path)(f: File): String = {
36
- val r = base.relativize(f.getCanonicalFile.toPath).toString.replace(java.io.File.separator, "/")
37
- if (r.isEmpty) "." else r
38
- }
39
- def relOf(f: File): String = relTo(rootCanonPath)(f)
40
- // `-Dsocket.excludeBase`: the directory `--exclude-paths` is relative to (the scan root; the
41
- // build root by default); a project outside it never matches.
42
- val excludeBase = sys.props.get("socket.excludeBase").filter(_.nonEmpty)
43
- .map(b => new File(b).getCanonicalFile.toPath).getOrElse(rootCanonPath)
44
- def isExcludedRef(ref: ProjectRef): Boolean = excludeMatchers.nonEmpty && {
45
- val dir = extracted.get(baseDirectory.in(ref))
46
- // Another Windows drive than the scan root is outside it.
47
- dir.getCanonicalFile.toPath.getRoot == excludeBase.getRoot && {
48
- val rel = relTo(excludeBase)(dir)
49
- rel != ".." && !rel.startsWith("../") && isExcludedPath(rel, excludeMatchers)
50
- }
51
- }
52
-
53
- def rootIdOf(ref: ProjectRef): ModuleID = {
54
- val sv = extracted.get(scalaVersion.in(ref))
55
- val sbv = extracted.get(scalaBinaryVersion.in(ref))
56
- CrossVersion.apply(sv, sbv)(extracted.get(projectID.in(ref)))
57
- }
58
-
59
- // Mirrors socket-facts.plugin.scala's projectBuild records.
60
- val buildFilesByRef: Map[ProjectRef, Seq[String]] =
61
- extracted.structure.settings
62
- .flatMap { setting =>
63
- (setting.key.scope.project, setting.pos) match {
64
- case (Select(ref: ProjectRef), pos: FilePosition) =>
65
- val f = new File(pos.path)
66
- if (f.isAbsolute && f.isFile && f.getCanonicalFile.toPath.startsWith(rootCanonPath)) Some(ref -> relOf(f))
67
- else None
68
- case _ => None
69
- }
70
- }
71
- .groupBy(_._1)
72
- .map { case (ref, pairs) => ref -> pairs.map(_._2) }
73
-
74
- val sb = new StringBuilder
75
- def rec(fields: String*): Unit = {
76
- sb.append(fields.map(esc).mkString("\t")); sb.append('\n')
77
- }
78
-
79
- rec("meta", "sbt", extracted.getOpt(sbtVersion).getOrElse(""), sys.props.getOrElse("java.version", ""))
80
- rec("buildRoot", rootCanonPath.toString)
81
-
82
- allRefs.foreach { ref =>
83
- if (!isExcludedRef(ref)) {
84
- val mid = rootIdOf(ref)
85
- val ver = if (mid.revision == null) "" else mid.revision
86
- val baseDir = extracted.get(baseDirectory.in(ref))
87
- rec("project", ref.project, mid.organization, mid.name, ver, relOf(baseDir))
88
- (buildFilesByRef.getOrElse(ref, Nil) ++ baseBuildSbt(baseDir, rootCanonPath).map(relOf)).distinct.sorted
89
- .foreach(f => rec("projectBuild", ref.project, f))
90
- }
91
- }
92
-
93
- val recordsFile = sys.props.get("socket.recordsFile").filter(_.nonEmpty) match {
94
- case Some(p) => new File(p)
95
- case None => new File(buildRoot, ".socket.workspaces.records.tsv")
96
- }
97
- Option(recordsFile.getParentFile).foreach(_.mkdirs())
98
- IO.write(recordsFile, sb.toString)
99
- println("Socket workspace records written to: " + recordsFile.getAbsolutePath)
100
- }
101
- )
102
-
103
- // ---- config selection / path exclusion (mirrors socket-facts.plugin.scala) ----------------
104
-
105
- // `-Dsocket.excludePaths` → PRE-COMPILED, comma-joined, anchored regex pattern sources, used only
106
- // to skip whole excluded subprojects. The CLI compiles the user-facing globs in
107
- // exclude-paths-glob.mts (the single glob implementation, tested in CI); this plugin only
108
- // Pattern.compile()s what it receives.
109
- private def parseExcludeMatchers(): Seq[java.util.regex.Pattern] = {
110
- sys.props.get("socket.excludePaths").map(_.trim).filter(_.nonEmpty) match {
111
- case None => Nil
112
- case Some(raw) =>
113
- raw.split(",").toSeq.flatMap { r =>
114
- val p = r.trim
115
- // A pattern that doesn't compile is dropped, never thrown: the CLI emits a
116
- // dialect-portable subset, so this only guards against a broken transport.
117
- if (p.isEmpty) Nil
118
- else
119
- try Seq(java.util.regex.Pattern.compile(p))
120
- catch { case _: java.util.regex.PatternSyntaxException => Nil }
121
- }
122
- }
123
- }
124
-
125
- private def isExcludedPath(rel: String, patterns: Seq[java.util.regex.Pattern]): Boolean = {
126
- if (patterns.isEmpty) false
127
- else {
128
- var c = (if (rel == null) "" else rel).replace("\\", "/")
129
- while (c.startsWith("./")) c = c.substring(2)
130
- while (c.startsWith("/")) c = c.substring(1)
131
- while (c.endsWith("/")) c = c.substring(0, c.length - 1)
132
- if (c.isEmpty) false
133
- else patterns.exists(_.matcher(c).matches())
134
- }
135
- }
136
-
137
- // sbt loads the `.sbt` files in a project's base directory into that project
138
- // (Load.configurationSources), so its build.sbt is the project's even when it sets nothing.
139
- private def baseBuildSbt(base: File, rootCanonPath: java.nio.file.Path): Option[File] =
140
- Some(new File(base, "build.sbt")).filter(f => f.isFile && f.getCanonicalFile.toPath.startsWith(rootCanonPath))
141
-
142
- // Backslash-escape so a value can never break line/field framing (see records.ts unescape).
143
- private def esc(v: String): String = {
144
- if (v == null) ""
145
- else v.replace("\\", "\\\\").replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r")
146
- }
147
- }
@@ -1,14 +0,0 @@
1
- import { type ResolvedArtifactPaths, type SocketFactsSbom } from './facts.mts';
2
- import type { ParsedRecords } from './records.mts';
3
- import type { ResolutionReport } from './resolution-report.mts';
4
- export type AssembleResult = {
5
- facts: SocketFactsSbom;
6
- report: ResolutionReport;
7
- artifactPaths: ResolvedArtifactPaths;
8
- };
9
- export type AssembleOptions = {
10
- // Injectable for tests; an uncompiled module's output dir is dropped (module
11
- // stays resolvable via its sources).
12
- fileExists?: ((path: string) => boolean) | undefined;
13
- };
14
- export declare function assembleFacts(parsed: ParsedRecords, opts?: AssembleOptions): AssembleResult;
@@ -1,8 +0,0 @@
1
- export declare function excludePathGlobToRegexSource(glob: string): string;
2
- // A Windows-style `foo\bar` means the path `foo/bar`.
3
- export declare function compileExcludePathPatterns(paths: readonly string[] | undefined): string[];
4
- // Transport form handed to the build-tool scripts: comma-joined pattern
5
- // sources. Empty string when there are no patterns.
6
- export declare function serializeExcludePathPatterns(paths: readonly string[] | undefined): string;
7
- export type ExcludePathFilter = (relPath: string) => boolean;
8
- export declare function createExcludePathFilter(paths: readonly string[] | undefined): ExcludePathFilter;
@@ -1,111 +0,0 @@
1
- export type AnyPURL = {
2
- type: string;
3
- namespace?: string | undefined;
4
- name: string;
5
- version?: string | undefined;
6
- qualifiers?: Record<string, string> | undefined;
7
- };
8
- // No sources/targets here: those are local absolute paths, returned in-memory
9
- // as ResolvedArtifactPaths, never serialized into the SBOM.
10
- export type SocketFactsSbom = {
11
- metadata?: SocketFactsSbomMetadata | undefined;
12
- projects?: SocketFactsSbomProject[] | undefined;
13
- components: SocketFactsSbomComponent[];
14
- dependencies?: SocketFactsSbomDependency[] | undefined;
15
- };
16
- export type SocketFactsSbomMetadata = {
17
- format: 'socket-facts-sbom';
18
- tool: 'dotnet' | 'gradle' | 'maven' | 'sbt';
19
- toolVersion: string;
20
- javaVersion?: string | undefined;
21
- // Lets a facts file be traced back to the generator release that produced it.
22
- socketCliVersion?: string | undefined;
23
- };
24
- export type SocketFactsSbomComponent = AnyPURL & {
25
- id: string;
26
- direct?: boolean | undefined;
27
- dev?: boolean | undefined;
28
- // A module of the scanned build itself (same GAV as a projects[] entry).
29
- firstParty?: true | undefined;
30
- };
31
- // Relative to the facts file's directory.
32
- export type SocketFactsManifestReference = {
33
- file: string;
34
- };
35
- // A component with one exact subtree, shared by every position whose subtree
36
- // is identical.
37
- export type SocketFactsSbomDependency = {
38
- // Index into components[].
39
- component: number;
40
- // Indices into dependencies[].
41
- children?: number[] | undefined;
42
- };
43
- export type SocketFactsSbomProject = AnyPURL & {
44
- // The build tool's own project identity, unique within the facts file:
45
- // Maven's GAV, Gradle's project path, sbt's project id, the project file's
46
- // build-root-relative path for dotnet.
47
- id: string;
48
- subprojectDir: string;
49
- // The build files the tool reports for the project, e.g. a POM other than
50
- // `<subprojectDir>/pom.xml`, or a Gradle build file absent on disk.
51
- manifestFiles?: SocketFactsManifestReference[] | undefined;
52
- // Indices into dependencies[]: this subproject's direct dependencies.
53
- children: number[];
54
- };
55
- // One dotnet build of a project: a target framework, and a runtime where
56
- // restore resolved one. `framework` is the NuGet short folder name, `alias` the
57
- // project's own name for it; ids are those of the facts file's components.
58
- export type ProjectFramework = {
59
- alias: string;
60
- framework: string;
61
- runtime?: string | undefined;
62
- targetFrameworkMoniker?: string | undefined;
63
- language?: string | undefined;
64
- langVersion?: string | undefined;
65
- nullable?: string | undefined;
66
- assemblyName?: string | undefined;
67
- frameworkReferences: string[];
68
- // As evaluated: the SDK's implicit framework symbols (NET8_0_OR_GREATER,
69
- // ...) are absent.
70
- defineConstants: string[];
71
- usings: Array<{
72
- namespace: string;
73
- alias?: string;
74
- static?: true;
75
- }>;
76
- // In compiler order, as evaluated: sources that build targets generate
77
- // are absent.
78
- sources: string[];
79
- targets: string[];
80
- dependencies: string[];
81
- classpath: string[];
82
- };
83
- // A package's runtime assemblies in one target framework (and runtime); no
84
- // `targets` when restore's assemblies for it are missing.
85
- export type ComponentFramework = {
86
- framework: string;
87
- runtime?: string | undefined;
88
- targets?: string[] | undefined;
89
- // What the project's sources compile against (often reference assemblies).
90
- compile?: string[] | undefined;
91
- };
92
- // Resolved on-disk paths for a --with-files run, keyed by component or project
93
- // id (a project and its own component share one). `targets` = classpath
94
- // entries (jars / module output dirs), absent when the component's artifact
95
- // did not resolve; `sources` = module source roots.
96
- export type ResolvedArtifactPaths = {
97
- pathsById: Map<string, {
98
- sources: string[];
99
- targets?: string[] | undefined;
100
- }>;
101
- // Component ids on each project's resolved classpath (union over its
102
- // configurations), keyed by project id. A component on no classpath, such as
103
- // a Maven 4 `none` dependency, is in the SBOM but not here.
104
- classpathByProject: Map<string, string[]>;
105
- // Component ids of each project's direct dependencies on its classpath, keyed
106
- // by project id.
107
- directDependenciesByProject: Map<string, string[]>;
108
- // dotnet only: the same per target framework.
109
- frameworksByProject?: Map<string, ProjectFramework[]> | undefined;
110
- frameworksById?: Map<string, ComponentFramework[]> | undefined;
111
- };
@@ -1,124 +0,0 @@
1
- import type { ResolutionFailure, Unscannable } from './resolution-report.mts';
2
- // Line-protocol the build-tool scripts emit to a records file (NOT stdout — sbt
3
- // prints unsilenceable resolution noise there). One record per line, fields
4
- // backslash-escaped (\\, \t, \n, \r) so a value can't break framing:
5
- //
6
- // <tag>\t<field>\t<field>...
7
- //
8
- // meta tool toolVersion javaVersion (dotnet: the SDK version; no javaVersion)
9
- // buildRoot path (absolute; the facts file's directory)
10
- // entry path (file-addressed builds; build-root-relative)
11
- // member path (dotnet --members: a project the entry builds; build-root-relative)
12
- // project projectKey group name version dir
13
- // projectSrc projectKey path [config] (--with-files only)
14
- // projectTgt projectKey path [config] (--with-files only)
15
- // projectInfo projectKey config name value (dotnet, --with-files only; a name may repeat)
16
- // projectUsing projectKey config namespace alias static(0|1) (dotnet, --with-files only)
17
- // projectBuild projectKey path (build-root-relative; may be absent on disk)
18
- // excludedProject projectKey (--with-files only; paths without a project)
19
- // root rootId projectKey config prod(0|1) [framework runtime alias] (dotnet: NuGet short folder name, RID, TargetFrameworks entry)
20
- // noClasspath rootId (its nodes are on no classpath: in the SBOM, not on a reachability classpath)
21
- // node rootId coordId group name version ext classifier direct(0|1) project
22
- // edge rootId parentCoordId childCoordId
23
- // file rootId coordId path (--with-files only)
24
- // compileFile rootId coordId path (dotnet, --with-files only; what sources compile against)
25
- // unfetched rootId coordId (--with-files only; requested artifact not fetched)
26
- // scanned config
27
- // failure coord detail config projectKey (config empty: not placeable in one)
28
- // unscannable config detail projectKey (config empty: whole project)
29
- //
30
- // `projectKey` is the tool's unique project identity (Maven: GAV; Gradle:
31
- // project path; sbt: project id), emitted as the project id; a `node` whose
32
- // `project` names one resolves to that build project.
33
- // A `root` is one (subproject, configuration) resolution root; `coordId` is the
34
- // coordinate key (`group:name:ext:classifier:version`, empty segments dropped),
35
- // used opaquely as the per-root node key. Unknown tags are ignored.
36
- export type RawCoord = {
37
- group: string;
38
- name: string;
39
- version: string;
40
- ext: string;
41
- classifier: string;
42
- };
43
- export type RawNode = {
44
- coordId: string;
45
- coord: RawCoord;
46
- direct: boolean;
47
- // projectKey of the build project this node resolves to; empty for an
48
- // external artifact.
49
- project: string;
50
- // --with-files only.
51
- targets: string[];
52
- // dotnet, --with-files only.
53
- compileTargets: string[];
54
- unfetched: boolean;
55
- };
56
- // dotnet: the target framework's NuGet short folder name, the runtime
57
- // identifier of a runtime-specific target (empty when none), and the
58
- // framework's alias in the project.
59
- export type RawTarget = {
60
- alias: string;
61
- framework: string;
62
- runtime: string;
63
- };
64
- export type RawRoot = {
65
- rootId: string;
66
- projectKey: string;
67
- prod: boolean;
68
- onClasspath: boolean;
69
- target?: RawTarget | undefined;
70
- nodes: Map<string, RawNode>;
71
- edges: Array<[string, string]>;
72
- };
73
- export type RawUsing = {
74
- namespace: string;
75
- alias: string;
76
- static: boolean;
77
- };
78
- // One dotnet target framework build of a project, by its alias.
79
- export type RawBuild = {
80
- assemblyName?: string | undefined;
81
- defineConstants: string[];
82
- framework?: string | undefined;
83
- frameworkReferences: string[];
84
- langVersion?: string | undefined;
85
- language?: string | undefined;
86
- nullable?: string | undefined;
87
- sources: string[];
88
- targetFrameworkMoniker?: string | undefined;
89
- targets: string[];
90
- usings: RawUsing[];
91
- };
92
- export type RawProject = {
93
- projectKey: string;
94
- group: string;
95
- name: string;
96
- version: string;
97
- dir: string;
98
- sources: string[];
99
- targets: string[];
100
- // The project's build files, build-root-relative.
101
- buildFiles: string[];
102
- builds: Map<string, RawBuild>;
103
- };
104
- export type ParsedRecords = {
105
- tool: string;
106
- toolVersion: string;
107
- javaVersion: string;
108
- // Absolute directory the build is rooted at; the facts file is written there.
109
- buildRoot: string;
110
- // The file the build was invoked on (Maven's top-level POM); empty for a
111
- // directory-addressed build.
112
- entry: string;
113
- projects: Map<string, RawProject>;
114
- members: string[];
115
- // Excluded from the scan: not projects of their own, but their paths serve
116
- // the kept projects depending on them.
117
- excludedProjects: Map<string, RawProject>;
118
- roots: Map<string, RawRoot>;
119
- scannedConfigs: string[];
120
- failures: ResolutionFailure[];
121
- unscannable: Unscannable[];
122
- };
123
- export declare function unescapeField(s: string): string;
124
- export declare function parseRecords(text: string): ParsedRecords;
@@ -1,10 +0,0 @@
1
- import type { FailureCategory, ResolutionDialect } from './resolution-report-render.mts';
2
- // Gradle's variant-aware resolver: distinct exceptions give mutually-exclusive
3
- // phrasing, so most-specific-first substring checks classify reliably.
4
- export declare function classifyGradleFailure(detail: string): FailureCategory;
5
- // Every kind blocks except variant-ambiguity: the module demonstrably exists
6
- // and is almost always captured via another configuration, so it's benign for
7
- // the SBOM (non-blocking, count only). The renderer blocks it anyway when the
8
- // module resolved in no configuration of its project. Nor does checksum-missing:
9
- // teams often record checksums only for what their own tasks resolve.
10
- export declare const GRADLE_DIALECT: ResolutionDialect;
@@ -1,6 +0,0 @@
1
- import type { FailureCategory, ResolutionDialect } from './resolution-report-render.mts';
2
- // Ivy/sbt resolver: no attribute-based variants, so no variant categories
3
- // (Gradle-only). Ivy degrades transport failures to "not found".
4
- export declare function classifyIvyFailure(detail: string): FailureCategory;
5
- // Every kind blocks; no non-blocking kind because Ivy has no variant ambiguity.
6
- export declare const SBT_DIALECT: ResolutionDialect;
@@ -1,7 +0,0 @@
1
- import type { FailureCategory, ResolutionDialect } from './resolution-report-render.mts';
2
- // Maven's resolver (Aether/maven-resolver): no attribute-based variants. Both
3
- // failure shapes (artifact-resolution miss, dependency-graph build failure)
4
- // classify off the root-cause message.
5
- export declare function classifyMavenFailure(detail: string): FailureCategory;
6
- // Every kind blocks; no non-blocking kind because Maven has no variant ambiguity.
7
- export declare const MAVEN_DIALECT: ResolutionDialect;
@@ -1,6 +0,0 @@
1
- import type { FailureCategory, ResolutionDialect } from './resolution-report-render.mts';
2
- // The socket-facts-dotnet tool reports restore errors as `<code>: <message>`,
3
- // and evaluation errors as `<finding>: <code>: <message>`; its findings
4
- // without a code count as other failures.
5
- export declare function classifyNugetFailure(detail: string): FailureCategory;
6
- export declare const NUGET_DIALECT: ResolutionDialect;
@@ -1,63 +0,0 @@
1
- import type { BuildTool } from './build-tool.mts';
2
- import type { ResolutionFailure, Unscannable } from './resolution-report.mts';
3
- // Recognized from the build tool's message; drives wording AND whether the kind
4
- // is blocking. An unrecognized message degrades to 'other' (blocking) — safe.
5
- export type FailureCategory = 'not-found' | 'no-matching-variant' | 'capability-conflict' | 'variant-ambiguity' | 'checksum-missing' | 'repository-or-network' | 'config-problem' | 'other';
6
- export type FailureCategorySpec = {
7
- key: FailureCategory;
8
- // Whether failures of this kind fail the run (fail-closed unless
9
- // --ignore-unresolved). A non-blocking kind never affects the exit code and
10
- // is surfaced only as a one-line `notice`.
11
- blocking: boolean;
12
- header?: ((toolLabel: string) => string) | undefined;
13
- showReason?: boolean | undefined;
14
- notice?: ((toolLabel: string, depCount: number, configCount: number) => string) | undefined;
15
- };
16
- // Per-resolver classify + render/score policy.
17
- export type ResolutionDialect = {
18
- label: string;
19
- classify: (detail: string) => FailureCategory;
20
- categories: FailureCategorySpec[];
21
- };
22
- export type BuildOption = 'excludeConfigs' | 'ignoreUnresolved' | 'verbose';
23
- // Where the invoking command lets the user set each build option, so a remedy
24
- // names something they can actually set.
25
- export type BuildOptionHints = {
26
- // Reachability scans only: reachability cannot install a dependency that
27
- // `ignoreUnresolved` lets through, so it must be told to continue too.
28
- continueOnInstallErrorsFlag?: string | undefined;
29
- // Taken as flags; every other option is set in `socketJson`.
30
- flags: ReadonlySet<BuildOption>;
31
- // Wizard that writes `socketJson`.
32
- setupCommand: string;
33
- socketJson: string;
34
- };
35
- export declare const DSI_SETUP_COMMAND = "socket manifest setup --dynamic-sbom-inference";
36
- export declare const REACH_CONTINUE_ON_INSTALL_ERRORS_FLAG = "--reach-continue-on-install-errors";
37
- // The single-build manifest commands take every option as a flag.
38
- export declare const FLAG_HINTS: BuildOptionHints;
39
- export type RenderedResolutionReport = {
40
- // Failure report for blocking kinds; empty when nothing blocks.
41
- summary: string;
42
- // Build tool's own full messages for all kinds; surfaced at --verbose.
43
- details: string;
44
- // Caller fails the run iff this is true and not --ignore-unresolved.
45
- hasBlockingFailures: boolean;
46
- // One-liner(s) for non-blocking kinds; empty when none.
47
- nonBlockingNotice: string;
48
- };
49
- // What resolved elsewhere is consulted only by module (group:name): a failed
50
- // selector carries no classifier/type to relate it to one artifact.
51
- export declare function renderResolutionReport(failures: ResolutionFailure[], scannedConfigs: string[], tool: BuildTool, opts?: {
52
- hints?: BuildOptionHints | undefined;
53
- ignoreUnresolved?: boolean | undefined;
54
- resolvedModules?: ReadonlySet<string> | undefined;
55
- unscannable?: Unscannable[] | undefined;
56
- }): RenderedResolutionReport;
57
- export declare function renderResolutionErrorReport(failures: ResolutionFailure[], scannedConfigs?: string[], tool?: BuildTool, opts?: {
58
- hints?: BuildOptionHints | undefined;
59
- ignoreUnresolved?: boolean | undefined;
60
- resolvedModules?: ReadonlySet<string> | undefined;
61
- unscannable?: Unscannable[] | undefined;
62
- }): RenderedResolutionReport;
63
- export declare function verboseHint(hints: BuildOptionHints, tool: BuildTool): string;
@@ -1,28 +0,0 @@
1
- export type ResolutionFailure = {
2
- coord: string;
3
- // Build tool's own failure message (deepest cause; may be multi-line).
4
- // Classified on; first line shown by default, whole thing at --verbose.
5
- detail: string;
6
- // Empty when the failure cannot be placed in a configuration; it then counts
7
- // against every configuration of its project.
8
- config: string;
9
- // projectKey of the subproject being resolved.
10
- project: string;
11
- };
12
- // A resolution that threw without naming a dependency: one configuration, or
13
- // with an empty `config` the whole project.
14
- export type Unscannable = {
15
- config: string;
16
- detail: string;
17
- project: string;
18
- };
19
- // A module (`group:name`, from any longer coordinate) within one project.
20
- export declare function moduleKey(project: string, coord: string): string;
21
- export type ResolutionReport = {
22
- failures: ResolutionFailure[];
23
- // moduleKey of every module a project resolved in some configuration; empty
24
- // when nothing failed.
25
- resolvedModules: ReadonlySet<string>;
26
- scannedConfigs: string[];
27
- unscannable: Unscannable[];
28
- };