@socketsecurity/cli-with-sentry 1.1.152 → 1.1.153
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.
- package/CHANGELOG.md +5 -0
- package/dist/cli.js +2348 -629
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/manifest-scripts/socket-facts.init.gradle +14 -45
- package/dist/manifest-scripts/socket-facts.plugin.scala +15 -46
- package/dist/manifest-scripts/socket-workspaces.init.gradle +99 -0
- package/dist/manifest-scripts/socket-workspaces.plugin.scala +112 -0
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/manifest/cmd-manifest-dynamic-sbom-inference.d.mts +9 -0
- package/dist/types/commands/manifest/cmd-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-maven.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts +18 -0
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts.map +1 -0
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts +19 -0
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts.map +1 -0
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts +10 -0
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts.map +1 -0
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts +37 -0
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts.map +1 -0
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/handle-manifest-dynamic-sbom-inference.d.mts +8 -0
- package/dist/types/commands/manifest/handle-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts +1 -1
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +1 -1
- package/dist/types/commands/manifest/manifest-flags.d.mts +6 -0
- package/dist/types/commands/manifest/manifest-flags.d.mts.map +1 -0
- package/dist/types/commands/manifest/output-manifest-dynamic-sbom-inference.d.mts +4 -0
- package/dist/types/commands/manifest/output-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/run-manifest-facts.d.mts +13 -2
- package/dist/types/commands/manifest/run-manifest-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/exclude-paths-glob.d.mts +8 -0
- package/dist/types/commands/manifest/scripts/exclude-paths-glob.d.mts.map +1 -0
- package/dist/types/commands/manifest/scripts/run.d.mts +10 -1
- package/dist/types/commands/manifest/scripts/run.d.mts.map +1 -1
- package/dist/types/commands/manifest/setup-manifest-config.d.mts +19 -0
- package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +1 -1
- package/dist/types/commands/manifest/setup-recursive-manifest-config.d.mts +120 -0
- package/dist/types/commands/manifest/setup-recursive-manifest-config.d.mts.map +1 -0
- package/dist/types/commands/scan/create-scan-from-github.d.mts +17 -0
- package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
- package/dist/types/utils/github-errors.d.mts +51 -0
- package/dist/types/utils/github-errors.d.mts.map +1 -0
- package/dist/types/utils/socket-json.d.mts +38 -14
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/utils.js +307 -3
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package socket
|
|
2
|
+
|
|
3
|
+
import sbt._
|
|
4
|
+
import sbt.Keys._
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sibling of SocketFactsPlugin (socket-facts.plugin.scala): emits only `meta`/`project`
|
|
8
|
+
* records, no dependency resolution. Kept as a separate plugin so it can't affect that
|
|
9
|
+
* 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 relOf(f: File): String = {
|
|
36
|
+
val r = rootCanonPath.relativize(f.getCanonicalFile.toPath).toString.replace(java.io.File.separator, "/")
|
|
37
|
+
if (r.isEmpty) "." else r
|
|
38
|
+
}
|
|
39
|
+
def isExcludedRef(ref: ProjectRef): Boolean =
|
|
40
|
+
isExcludedPath(relOf(extracted.get(baseDirectory.in(ref))), excludeMatchers)
|
|
41
|
+
|
|
42
|
+
def rootIdOf(ref: ProjectRef): ModuleID = {
|
|
43
|
+
val sv = extracted.get(scalaVersion.in(ref))
|
|
44
|
+
val sbv = extracted.get(scalaBinaryVersion.in(ref))
|
|
45
|
+
CrossVersion.apply(sv, sbv)(extracted.get(projectID.in(ref)))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
val sb = new StringBuilder
|
|
49
|
+
def rec(fields: String*): Unit = {
|
|
50
|
+
sb.append(fields.map(esc).mkString("\t")); sb.append('\n')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
rec("meta", "sbt", extracted.getOpt(sbtVersion).getOrElse(""), sys.props.getOrElse("java.version", ""))
|
|
54
|
+
|
|
55
|
+
allRefs.foreach { ref =>
|
|
56
|
+
if (!isExcludedRef(ref)) {
|
|
57
|
+
val mid = rootIdOf(ref)
|
|
58
|
+
val ver = if (mid.revision == null) "" else mid.revision
|
|
59
|
+
rec("project", ref.project, mid.organization, mid.name, ver, relOf(extracted.get(baseDirectory.in(ref))))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
val recordsFile = sys.props.get("socket.recordsFile").filter(_.nonEmpty) match {
|
|
64
|
+
case Some(p) => new File(p)
|
|
65
|
+
case None => new File(buildRoot, ".socket.workspaces.records.tsv")
|
|
66
|
+
}
|
|
67
|
+
Option(recordsFile.getParentFile).foreach(_.mkdirs())
|
|
68
|
+
IO.write(recordsFile, sb.toString)
|
|
69
|
+
println("Socket workspace records written to: " + recordsFile.getAbsolutePath)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
// ---- config selection / path exclusion (mirrors socket-facts.plugin.scala) ----------------
|
|
74
|
+
|
|
75
|
+
// `-Dsocket.excludePaths` → PRE-COMPILED, comma-joined, anchored regex pattern sources, used only
|
|
76
|
+
// to skip whole excluded subprojects. The CLI compiles the user-facing globs in
|
|
77
|
+
// exclude-paths-glob.mts (the single glob implementation, tested in CI); this plugin only
|
|
78
|
+
// Pattern.compile()s what it receives.
|
|
79
|
+
private def parseExcludeMatchers(): Seq[java.util.regex.Pattern] = {
|
|
80
|
+
sys.props.get("socket.excludePaths").map(_.trim).filter(_.nonEmpty) match {
|
|
81
|
+
case None => Nil
|
|
82
|
+
case Some(raw) =>
|
|
83
|
+
raw.split(",").toSeq.flatMap { r =>
|
|
84
|
+
val p = r.trim
|
|
85
|
+
// A pattern that doesn't compile is dropped, never thrown: the CLI emits a
|
|
86
|
+
// dialect-portable subset, so this only guards against a broken transport.
|
|
87
|
+
if (p.isEmpty) Nil
|
|
88
|
+
else
|
|
89
|
+
try Seq(java.util.regex.Pattern.compile(p))
|
|
90
|
+
catch { case _: java.util.regex.PatternSyntaxException => Nil }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private def isExcludedPath(rel: String, patterns: Seq[java.util.regex.Pattern]): Boolean = {
|
|
96
|
+
if (patterns.isEmpty) false
|
|
97
|
+
else {
|
|
98
|
+
var c = (if (rel == null) "" else rel).replace("\\", "/")
|
|
99
|
+
while (c.startsWith("./")) c = c.substring(2)
|
|
100
|
+
while (c.startsWith("/")) c = c.substring(1)
|
|
101
|
+
while (c.endsWith("/")) c = c.substring(0, c.length - 1)
|
|
102
|
+
if (c.isEmpty) false
|
|
103
|
+
else patterns.exists(_.matcher(c).matches())
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Backslash-escape so a value can never break line/field framing (see records.ts unescape).
|
|
108
|
+
private def esc(v: String): String = {
|
|
109
|
+
if (v == null) ""
|
|
110
|
+
else v.replace("\\", "\\\\").replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r")
|
|
111
|
+
}
|
|
112
|
+
}
|