cognium-dev 3.203.0 → 3.205.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.
- package/dist/cli.js +146 -14
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -13632,7 +13632,13 @@ var SAFE_RECEIVERS_BY_METHOD = {
|
|
|
13632
13632
|
"graphql",
|
|
13633
13633
|
"apollo",
|
|
13634
13634
|
"querybuilder",
|
|
13635
|
-
"criteria"
|
|
13635
|
+
"criteria",
|
|
13636
|
+
"logger",
|
|
13637
|
+
"logging",
|
|
13638
|
+
"winston",
|
|
13639
|
+
"pino",
|
|
13640
|
+
"bunyan",
|
|
13641
|
+
"console"
|
|
13636
13642
|
]),
|
|
13637
13643
|
authenticate: new Set([
|
|
13638
13644
|
"auth",
|
|
@@ -45966,6 +45972,102 @@ function parsePep508(spec) {
|
|
|
45966
45972
|
const version = verMatch && verMatch[1] ? verMatch[1] : "unknown";
|
|
45967
45973
|
return { name: m[1], version };
|
|
45968
45974
|
}
|
|
45975
|
+
function parseNpmLockDependencies(packageLock) {
|
|
45976
|
+
if (!packageLock)
|
|
45977
|
+
return [];
|
|
45978
|
+
let parsed;
|
|
45979
|
+
try {
|
|
45980
|
+
parsed = JSON.parse(packageLock);
|
|
45981
|
+
} catch {
|
|
45982
|
+
return [];
|
|
45983
|
+
}
|
|
45984
|
+
if (!parsed || typeof parsed !== "object")
|
|
45985
|
+
return [];
|
|
45986
|
+
const root = parsed;
|
|
45987
|
+
const out2 = [];
|
|
45988
|
+
const scopeOf = (info2) => info2.dev === true ? "dev" : info2.optional === true ? "optional" : "required";
|
|
45989
|
+
const packages = root.packages;
|
|
45990
|
+
if (packages && typeof packages === "object") {
|
|
45991
|
+
for (const [path, raw] of Object.entries(packages)) {
|
|
45992
|
+
if (!path || !raw || typeof raw !== "object")
|
|
45993
|
+
continue;
|
|
45994
|
+
const info2 = raw;
|
|
45995
|
+
const marker = "node_modules/";
|
|
45996
|
+
const idx = path.lastIndexOf(marker);
|
|
45997
|
+
const name2 = idx >= 0 ? path.slice(idx + marker.length) : typeof info2.name === "string" ? info2.name : path;
|
|
45998
|
+
if (!name2)
|
|
45999
|
+
continue;
|
|
46000
|
+
const version = typeof info2.version === "string" ? info2.version : "unknown";
|
|
46001
|
+
const entry = dep("npm", name2, version, scopeOf(info2));
|
|
46002
|
+
if (typeof info2.license === "string" && info2.license)
|
|
46003
|
+
entry.license = info2.license;
|
|
46004
|
+
out2.push(entry);
|
|
46005
|
+
}
|
|
46006
|
+
} else if (root.dependencies && typeof root.dependencies === "object") {
|
|
46007
|
+
const walk = (deps) => {
|
|
46008
|
+
for (const [name2, raw] of Object.entries(deps)) {
|
|
46009
|
+
if (!raw || typeof raw !== "object")
|
|
46010
|
+
continue;
|
|
46011
|
+
const info2 = raw;
|
|
46012
|
+
const version = typeof info2.version === "string" ? info2.version : "unknown";
|
|
46013
|
+
out2.push(dep("npm", name2, version, scopeOf(info2)));
|
|
46014
|
+
if (info2.dependencies && typeof info2.dependencies === "object") {
|
|
46015
|
+
walk(info2.dependencies);
|
|
46016
|
+
}
|
|
46017
|
+
}
|
|
46018
|
+
};
|
|
46019
|
+
walk(root.dependencies);
|
|
46020
|
+
}
|
|
46021
|
+
const seen = new Set;
|
|
46022
|
+
return out2.filter((d) => {
|
|
46023
|
+
const key = `${d.name}|${d.version}|${d.scope}`;
|
|
46024
|
+
if (seen.has(key))
|
|
46025
|
+
return false;
|
|
46026
|
+
seen.add(key);
|
|
46027
|
+
return true;
|
|
46028
|
+
});
|
|
46029
|
+
}
|
|
46030
|
+
function parseTomlPackageArray(content, ecosystem) {
|
|
46031
|
+
const out2 = [];
|
|
46032
|
+
let name2 = null;
|
|
46033
|
+
let version = null;
|
|
46034
|
+
let inPackage = false;
|
|
46035
|
+
const flush = () => {
|
|
46036
|
+
if (inPackage && name2 && version)
|
|
46037
|
+
out2.push(dep(ecosystem, name2, version, "required"));
|
|
46038
|
+
name2 = null;
|
|
46039
|
+
version = null;
|
|
46040
|
+
};
|
|
46041
|
+
for (const raw of content.split(/\r?\n/)) {
|
|
46042
|
+
const line = raw.trim();
|
|
46043
|
+
if (line === "[[package]]") {
|
|
46044
|
+
flush();
|
|
46045
|
+
inPackage = true;
|
|
46046
|
+
continue;
|
|
46047
|
+
}
|
|
46048
|
+
if (line.startsWith("[")) {
|
|
46049
|
+
flush();
|
|
46050
|
+
inPackage = false;
|
|
46051
|
+
continue;
|
|
46052
|
+
}
|
|
46053
|
+
if (!inPackage)
|
|
46054
|
+
continue;
|
|
46055
|
+
const nm = line.match(/^name\s*=\s*"([^"]+)"/);
|
|
46056
|
+
if (nm)
|
|
46057
|
+
name2 = nm[1];
|
|
46058
|
+
const vm = line.match(/^version\s*=\s*"([^"]+)"/);
|
|
46059
|
+
if (vm)
|
|
46060
|
+
version = vm[1];
|
|
46061
|
+
}
|
|
46062
|
+
flush();
|
|
46063
|
+
return out2;
|
|
46064
|
+
}
|
|
46065
|
+
function parseCargoLockDependencies(cargoLock) {
|
|
46066
|
+
return cargoLock ? parseTomlPackageArray(cargoLock, "cargo") : [];
|
|
46067
|
+
}
|
|
46068
|
+
function parsePoetryLockDependencies(poetryLock) {
|
|
46069
|
+
return poetryLock ? parseTomlPackageArray(poetryLock, "pypi") : [];
|
|
46070
|
+
}
|
|
45969
46071
|
function parsePypiDependencies(requirementsTxt) {
|
|
45970
46072
|
if (!requirementsTxt)
|
|
45971
46073
|
return [];
|
|
@@ -46187,7 +46289,8 @@ function toCycloneDx(deps, meta = {}) {
|
|
|
46187
46289
|
metadata2.component = {
|
|
46188
46290
|
type: "application",
|
|
46189
46291
|
name: meta.name,
|
|
46190
|
-
...meta.version ? { version: meta.version } : {}
|
|
46292
|
+
...meta.version ? { version: meta.version } : {},
|
|
46293
|
+
...meta.license ? { licenses: [{ license: { name: meta.license } }] } : {}
|
|
46191
46294
|
};
|
|
46192
46295
|
}
|
|
46193
46296
|
bom.metadata = metadata2;
|
|
@@ -46197,6 +46300,7 @@ function toCycloneDx(deps, meta = {}) {
|
|
|
46197
46300
|
version: d.version,
|
|
46198
46301
|
purl: d.purl,
|
|
46199
46302
|
scope: d.scope === "dev" ? "excluded" : d.scope === "optional" ? "optional" : "required",
|
|
46303
|
+
...d.license ? { licenses: [{ license: { name: d.license } }] } : {},
|
|
46200
46304
|
"bom-ref": d.purl
|
|
46201
46305
|
}));
|
|
46202
46306
|
return bom;
|
|
@@ -46212,6 +46316,8 @@ function toSpdx(deps, meta = {}) {
|
|
|
46212
46316
|
versionInfo: d.version,
|
|
46213
46317
|
downloadLocation: "NOASSERTION",
|
|
46214
46318
|
filesAnalyzed: false,
|
|
46319
|
+
licenseConcluded: "NOASSERTION",
|
|
46320
|
+
licenseDeclared: d.license ?? "NOASSERTION",
|
|
46215
46321
|
externalRefs: [
|
|
46216
46322
|
{
|
|
46217
46323
|
referenceCategory: "PACKAGE-MANAGER",
|
|
@@ -46850,7 +46956,7 @@ var colors = {
|
|
|
46850
46956
|
};
|
|
46851
46957
|
|
|
46852
46958
|
// src/version.ts
|
|
46853
|
-
var version = "3.
|
|
46959
|
+
var version = "3.205.0";
|
|
46854
46960
|
|
|
46855
46961
|
// src/formatters.ts
|
|
46856
46962
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
|
@@ -47510,6 +47616,8 @@ SBOM OPTIONS:
|
|
|
47510
47616
|
-o, --output <file> Write the document to a file (default: stdout)
|
|
47511
47617
|
Discovers package.json / requirements.txt / pyproject.toml /
|
|
47512
47618
|
pom.xml / build.gradle(.kts) / Cargo.toml / go.mod.
|
|
47619
|
+
A package-lock.json supersedes its package.json
|
|
47620
|
+
(exact + transitive versions).
|
|
47513
47621
|
CVE matching is out of scope (deterministic SAST — no network).
|
|
47514
47622
|
|
|
47515
47623
|
EXAMPLES:
|
|
@@ -48549,14 +48657,24 @@ function parseCrossFileBudgetMs(raw) {
|
|
|
48549
48657
|
}
|
|
48550
48658
|
var SBOM_MANIFESTS = {
|
|
48551
48659
|
"package.json": parseNpmDependencies,
|
|
48660
|
+
"package-lock.json": parseNpmLockDependencies,
|
|
48661
|
+
"npm-shrinkwrap.json": parseNpmLockDependencies,
|
|
48552
48662
|
"requirements.txt": parsePypiDependencies,
|
|
48553
48663
|
"pyproject.toml": parsePyprojectDependencies,
|
|
48664
|
+
"poetry.lock": parsePoetryLockDependencies,
|
|
48554
48665
|
"pom.xml": parseMavenDependencies,
|
|
48555
48666
|
"build.gradle": parseGradleDependencies,
|
|
48556
48667
|
"build.gradle.kts": parseGradleDependencies,
|
|
48557
48668
|
"Cargo.toml": parseCargoDependencies,
|
|
48669
|
+
"Cargo.lock": parseCargoLockDependencies,
|
|
48558
48670
|
"go.mod": parseGoDependencies
|
|
48559
48671
|
};
|
|
48672
|
+
var SBOM_SUPERSEDES = {
|
|
48673
|
+
"package-lock.json": "package.json",
|
|
48674
|
+
"npm-shrinkwrap.json": "package.json",
|
|
48675
|
+
"poetry.lock": "pyproject.toml",
|
|
48676
|
+
"Cargo.lock": "Cargo.toml"
|
|
48677
|
+
};
|
|
48560
48678
|
var SBOM_SKIP_DIRS = /^(node_modules|vendor|target|dist|build|out|coverage)$/;
|
|
48561
48679
|
async function collectManifestFiles(targetPath) {
|
|
48562
48680
|
const found = [];
|
|
@@ -48590,22 +48708,34 @@ async function runSbom(targetPath, options) {
|
|
|
48590
48708
|
}
|
|
48591
48709
|
const manifests = await collectManifestFiles(absPath);
|
|
48592
48710
|
if (manifests.length === 0) {
|
|
48593
|
-
console.error(colors.red("Error: no supported manifests found (package.json, requirements.txt, pyproject.toml, pom.xml, build.gradle, Cargo.toml, go.mod)"));
|
|
48711
|
+
console.error(colors.red("Error: no supported manifests found (package.json/-lock, requirements.txt, pyproject.toml, poetry.lock, pom.xml, build.gradle, Cargo.toml/.lock, go.mod)"));
|
|
48594
48712
|
process.exit(1);
|
|
48595
48713
|
}
|
|
48596
|
-
|
|
48597
|
-
let projectName = options.name;
|
|
48714
|
+
const supersededInDir = new Set;
|
|
48598
48715
|
for (const m of manifests) {
|
|
48599
|
-
const
|
|
48600
|
-
|
|
48601
|
-
|
|
48716
|
+
const superseded = SBOM_SUPERSEDES[basename(m)];
|
|
48717
|
+
if (superseded)
|
|
48718
|
+
supersededInDir.add(`${dirname3(m)}\x00${superseded}`);
|
|
48719
|
+
}
|
|
48720
|
+
const effective = manifests.filter((m) => !supersededInDir.has(`${dirname3(m)}\x00${basename(m)}`));
|
|
48721
|
+
let projectName = options.name;
|
|
48722
|
+
let projectLicense;
|
|
48723
|
+
{
|
|
48724
|
+
const pkg = manifests.find((m) => basename(m) === "package.json");
|
|
48725
|
+
if (pkg) {
|
|
48602
48726
|
try {
|
|
48603
|
-
const
|
|
48604
|
-
if (typeof
|
|
48605
|
-
projectName =
|
|
48727
|
+
const parsed = JSON.parse(readFileSync(pkg, "utf-8"));
|
|
48728
|
+
if (!projectName && typeof parsed.name === "string" && parsed.name)
|
|
48729
|
+
projectName = parsed.name;
|
|
48730
|
+
if (typeof parsed.license === "string" && parsed.license)
|
|
48731
|
+
projectLicense = parsed.license;
|
|
48606
48732
|
} catch {}
|
|
48607
48733
|
}
|
|
48608
48734
|
}
|
|
48735
|
+
let deps = [];
|
|
48736
|
+
for (const m of effective) {
|
|
48737
|
+
deps.push(...SBOM_MANIFESTS[basename(m)](readFileSync(m, "utf-8")));
|
|
48738
|
+
}
|
|
48609
48739
|
const seen = new Set;
|
|
48610
48740
|
deps = deps.filter((d) => {
|
|
48611
48741
|
const key = `${d.ecosystem}|${d.name}|${d.version}|${d.scope}`;
|
|
@@ -48619,6 +48749,8 @@ async function runSbom(targetPath, options) {
|
|
|
48619
48749
|
if (!projectName)
|
|
48620
48750
|
projectName = basename(absPath) || "project";
|
|
48621
48751
|
const meta = { name: projectName, tool: "cognium-dev" };
|
|
48752
|
+
if (projectLicense)
|
|
48753
|
+
meta.license = projectLicense;
|
|
48622
48754
|
if (!options.deterministic) {
|
|
48623
48755
|
meta.timestamp = new Date().toISOString();
|
|
48624
48756
|
const { randomUUID } = await import("crypto");
|
|
@@ -48629,10 +48761,10 @@ async function runSbom(targetPath, options) {
|
|
|
48629
48761
|
const out2 = JSON.stringify(doc, null, 2);
|
|
48630
48762
|
if (options.output) {
|
|
48631
48763
|
writeFileSync(options.output, out2);
|
|
48632
|
-
console.error(colors.green(`SBOM written to ${options.output} — ${deps.length} dependencies from ${
|
|
48764
|
+
console.error(colors.green(`SBOM written to ${options.output} — ${deps.length} dependencies from ${effective.length} manifest(s)`));
|
|
48633
48765
|
} else {
|
|
48634
48766
|
console.log(out2);
|
|
48635
|
-
console.error(colors.green(`SBOM: ${deps.length} dependencies from ${
|
|
48767
|
+
console.error(colors.green(`SBOM: ${deps.length} dependencies from ${effective.length} manifest(s)`));
|
|
48636
48768
|
}
|
|
48637
48769
|
process.exit(0);
|
|
48638
48770
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.205.0",
|
|
4
4
|
"description": "Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@cognium/project-profile-detect": "^1.1.0",
|
|
69
|
-
"circle-ir": "^3.
|
|
69
|
+
"circle-ir": "^3.205.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|