cognium-dev 3.203.0 → 3.204.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 +124 -10
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -45966,6 +45966,99 @@ function parsePep508(spec) {
|
|
|
45966
45966
|
const version = verMatch && verMatch[1] ? verMatch[1] : "unknown";
|
|
45967
45967
|
return { name: m[1], version };
|
|
45968
45968
|
}
|
|
45969
|
+
function parseNpmLockDependencies(packageLock) {
|
|
45970
|
+
if (!packageLock)
|
|
45971
|
+
return [];
|
|
45972
|
+
let parsed;
|
|
45973
|
+
try {
|
|
45974
|
+
parsed = JSON.parse(packageLock);
|
|
45975
|
+
} catch {
|
|
45976
|
+
return [];
|
|
45977
|
+
}
|
|
45978
|
+
if (!parsed || typeof parsed !== "object")
|
|
45979
|
+
return [];
|
|
45980
|
+
const root = parsed;
|
|
45981
|
+
const out2 = [];
|
|
45982
|
+
const scopeOf = (info2) => info2.dev === true ? "dev" : info2.optional === true ? "optional" : "required";
|
|
45983
|
+
const packages = root.packages;
|
|
45984
|
+
if (packages && typeof packages === "object") {
|
|
45985
|
+
for (const [path, raw] of Object.entries(packages)) {
|
|
45986
|
+
if (!path || !raw || typeof raw !== "object")
|
|
45987
|
+
continue;
|
|
45988
|
+
const info2 = raw;
|
|
45989
|
+
const marker = "node_modules/";
|
|
45990
|
+
const idx = path.lastIndexOf(marker);
|
|
45991
|
+
const name2 = idx >= 0 ? path.slice(idx + marker.length) : typeof info2.name === "string" ? info2.name : path;
|
|
45992
|
+
if (!name2)
|
|
45993
|
+
continue;
|
|
45994
|
+
const version = typeof info2.version === "string" ? info2.version : "unknown";
|
|
45995
|
+
out2.push(dep("npm", name2, version, scopeOf(info2)));
|
|
45996
|
+
}
|
|
45997
|
+
} else if (root.dependencies && typeof root.dependencies === "object") {
|
|
45998
|
+
const walk = (deps) => {
|
|
45999
|
+
for (const [name2, raw] of Object.entries(deps)) {
|
|
46000
|
+
if (!raw || typeof raw !== "object")
|
|
46001
|
+
continue;
|
|
46002
|
+
const info2 = raw;
|
|
46003
|
+
const version = typeof info2.version === "string" ? info2.version : "unknown";
|
|
46004
|
+
out2.push(dep("npm", name2, version, scopeOf(info2)));
|
|
46005
|
+
if (info2.dependencies && typeof info2.dependencies === "object") {
|
|
46006
|
+
walk(info2.dependencies);
|
|
46007
|
+
}
|
|
46008
|
+
}
|
|
46009
|
+
};
|
|
46010
|
+
walk(root.dependencies);
|
|
46011
|
+
}
|
|
46012
|
+
const seen = new Set;
|
|
46013
|
+
return out2.filter((d) => {
|
|
46014
|
+
const key = `${d.name}|${d.version}|${d.scope}`;
|
|
46015
|
+
if (seen.has(key))
|
|
46016
|
+
return false;
|
|
46017
|
+
seen.add(key);
|
|
46018
|
+
return true;
|
|
46019
|
+
});
|
|
46020
|
+
}
|
|
46021
|
+
function parseTomlPackageArray(content, ecosystem) {
|
|
46022
|
+
const out2 = [];
|
|
46023
|
+
let name2 = null;
|
|
46024
|
+
let version = null;
|
|
46025
|
+
let inPackage = false;
|
|
46026
|
+
const flush = () => {
|
|
46027
|
+
if (inPackage && name2 && version)
|
|
46028
|
+
out2.push(dep(ecosystem, name2, version, "required"));
|
|
46029
|
+
name2 = null;
|
|
46030
|
+
version = null;
|
|
46031
|
+
};
|
|
46032
|
+
for (const raw of content.split(/\r?\n/)) {
|
|
46033
|
+
const line = raw.trim();
|
|
46034
|
+
if (line === "[[package]]") {
|
|
46035
|
+
flush();
|
|
46036
|
+
inPackage = true;
|
|
46037
|
+
continue;
|
|
46038
|
+
}
|
|
46039
|
+
if (line.startsWith("[")) {
|
|
46040
|
+
flush();
|
|
46041
|
+
inPackage = false;
|
|
46042
|
+
continue;
|
|
46043
|
+
}
|
|
46044
|
+
if (!inPackage)
|
|
46045
|
+
continue;
|
|
46046
|
+
const nm = line.match(/^name\s*=\s*"([^"]+)"/);
|
|
46047
|
+
if (nm)
|
|
46048
|
+
name2 = nm[1];
|
|
46049
|
+
const vm = line.match(/^version\s*=\s*"([^"]+)"/);
|
|
46050
|
+
if (vm)
|
|
46051
|
+
version = vm[1];
|
|
46052
|
+
}
|
|
46053
|
+
flush();
|
|
46054
|
+
return out2;
|
|
46055
|
+
}
|
|
46056
|
+
function parseCargoLockDependencies(cargoLock) {
|
|
46057
|
+
return cargoLock ? parseTomlPackageArray(cargoLock, "cargo") : [];
|
|
46058
|
+
}
|
|
46059
|
+
function parsePoetryLockDependencies(poetryLock) {
|
|
46060
|
+
return poetryLock ? parseTomlPackageArray(poetryLock, "pypi") : [];
|
|
46061
|
+
}
|
|
45969
46062
|
function parsePypiDependencies(requirementsTxt) {
|
|
45970
46063
|
if (!requirementsTxt)
|
|
45971
46064
|
return [];
|
|
@@ -46850,7 +46943,7 @@ var colors = {
|
|
|
46850
46943
|
};
|
|
46851
46944
|
|
|
46852
46945
|
// src/version.ts
|
|
46853
|
-
var version = "3.
|
|
46946
|
+
var version = "3.204.0";
|
|
46854
46947
|
|
|
46855
46948
|
// src/formatters.ts
|
|
46856
46949
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
|
@@ -47510,6 +47603,8 @@ SBOM OPTIONS:
|
|
|
47510
47603
|
-o, --output <file> Write the document to a file (default: stdout)
|
|
47511
47604
|
Discovers package.json / requirements.txt / pyproject.toml /
|
|
47512
47605
|
pom.xml / build.gradle(.kts) / Cargo.toml / go.mod.
|
|
47606
|
+
A package-lock.json supersedes its package.json
|
|
47607
|
+
(exact + transitive versions).
|
|
47513
47608
|
CVE matching is out of scope (deterministic SAST — no network).
|
|
47514
47609
|
|
|
47515
47610
|
EXAMPLES:
|
|
@@ -48549,14 +48644,24 @@ function parseCrossFileBudgetMs(raw) {
|
|
|
48549
48644
|
}
|
|
48550
48645
|
var SBOM_MANIFESTS = {
|
|
48551
48646
|
"package.json": parseNpmDependencies,
|
|
48647
|
+
"package-lock.json": parseNpmLockDependencies,
|
|
48648
|
+
"npm-shrinkwrap.json": parseNpmLockDependencies,
|
|
48552
48649
|
"requirements.txt": parsePypiDependencies,
|
|
48553
48650
|
"pyproject.toml": parsePyprojectDependencies,
|
|
48651
|
+
"poetry.lock": parsePoetryLockDependencies,
|
|
48554
48652
|
"pom.xml": parseMavenDependencies,
|
|
48555
48653
|
"build.gradle": parseGradleDependencies,
|
|
48556
48654
|
"build.gradle.kts": parseGradleDependencies,
|
|
48557
48655
|
"Cargo.toml": parseCargoDependencies,
|
|
48656
|
+
"Cargo.lock": parseCargoLockDependencies,
|
|
48558
48657
|
"go.mod": parseGoDependencies
|
|
48559
48658
|
};
|
|
48659
|
+
var SBOM_SUPERSEDES = {
|
|
48660
|
+
"package-lock.json": "package.json",
|
|
48661
|
+
"npm-shrinkwrap.json": "package.json",
|
|
48662
|
+
"poetry.lock": "pyproject.toml",
|
|
48663
|
+
"Cargo.lock": "Cargo.toml"
|
|
48664
|
+
};
|
|
48560
48665
|
var SBOM_SKIP_DIRS = /^(node_modules|vendor|target|dist|build|out|coverage)$/;
|
|
48561
48666
|
async function collectManifestFiles(targetPath) {
|
|
48562
48667
|
const found = [];
|
|
@@ -48590,22 +48695,31 @@ async function runSbom(targetPath, options) {
|
|
|
48590
48695
|
}
|
|
48591
48696
|
const manifests = await collectManifestFiles(absPath);
|
|
48592
48697
|
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)"));
|
|
48698
|
+
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
48699
|
process.exit(1);
|
|
48595
48700
|
}
|
|
48596
|
-
|
|
48597
|
-
let projectName = options.name;
|
|
48701
|
+
const supersededInDir = new Set;
|
|
48598
48702
|
for (const m of manifests) {
|
|
48599
|
-
const
|
|
48600
|
-
|
|
48601
|
-
|
|
48703
|
+
const superseded = SBOM_SUPERSEDES[basename(m)];
|
|
48704
|
+
if (superseded)
|
|
48705
|
+
supersededInDir.add(`${dirname3(m)}\x00${superseded}`);
|
|
48706
|
+
}
|
|
48707
|
+
const effective = manifests.filter((m) => !supersededInDir.has(`${dirname3(m)}\x00${basename(m)}`));
|
|
48708
|
+
let projectName = options.name;
|
|
48709
|
+
if (!projectName) {
|
|
48710
|
+
const pkg = manifests.find((m) => basename(m) === "package.json");
|
|
48711
|
+
if (pkg) {
|
|
48602
48712
|
try {
|
|
48603
|
-
const n = JSON.parse(
|
|
48713
|
+
const n = JSON.parse(readFileSync(pkg, "utf-8")).name;
|
|
48604
48714
|
if (typeof n === "string" && n)
|
|
48605
48715
|
projectName = n;
|
|
48606
48716
|
} catch {}
|
|
48607
48717
|
}
|
|
48608
48718
|
}
|
|
48719
|
+
let deps = [];
|
|
48720
|
+
for (const m of effective) {
|
|
48721
|
+
deps.push(...SBOM_MANIFESTS[basename(m)](readFileSync(m, "utf-8")));
|
|
48722
|
+
}
|
|
48609
48723
|
const seen = new Set;
|
|
48610
48724
|
deps = deps.filter((d) => {
|
|
48611
48725
|
const key = `${d.ecosystem}|${d.name}|${d.version}|${d.scope}`;
|
|
@@ -48629,10 +48743,10 @@ async function runSbom(targetPath, options) {
|
|
|
48629
48743
|
const out2 = JSON.stringify(doc, null, 2);
|
|
48630
48744
|
if (options.output) {
|
|
48631
48745
|
writeFileSync(options.output, out2);
|
|
48632
|
-
console.error(colors.green(`SBOM written to ${options.output} — ${deps.length} dependencies from ${
|
|
48746
|
+
console.error(colors.green(`SBOM written to ${options.output} — ${deps.length} dependencies from ${effective.length} manifest(s)`));
|
|
48633
48747
|
} else {
|
|
48634
48748
|
console.log(out2);
|
|
48635
|
-
console.error(colors.green(`SBOM: ${deps.length} dependencies from ${
|
|
48749
|
+
console.error(colors.green(`SBOM: ${deps.length} dependencies from ${effective.length} manifest(s)`));
|
|
48636
48750
|
}
|
|
48637
48751
|
process.exit(0);
|
|
48638
48752
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.204.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.204.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|