cognium-dev 3.150.0 → 3.151.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 +96 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -28873,6 +28873,61 @@ class SourceSemanticsPass {
|
|
|
28873
28873
|
}
|
|
28874
28874
|
}
|
|
28875
28875
|
|
|
28876
|
+
// ../circle-ir/dist/analysis/passes/library-profile-source-gate-pass.js
|
|
28877
|
+
var SPECULATIVE_SOURCE_TYPES = new Set([
|
|
28878
|
+
"interprocedural_param",
|
|
28879
|
+
"constructor_field"
|
|
28880
|
+
]);
|
|
28881
|
+
function isLibraryShape(profile) {
|
|
28882
|
+
if (!profile || profile === "unknown")
|
|
28883
|
+
return false;
|
|
28884
|
+
return profile.startsWith("library/");
|
|
28885
|
+
}
|
|
28886
|
+
|
|
28887
|
+
class LibraryProfileSourceGatePass {
|
|
28888
|
+
name = "library-profile-source-gate";
|
|
28889
|
+
category = "security";
|
|
28890
|
+
run(ctx) {
|
|
28891
|
+
const { graph } = ctx;
|
|
28892
|
+
const profile = graph.ir.meta.projectProfile;
|
|
28893
|
+
if (!isLibraryShape(profile)) {
|
|
28894
|
+
return {
|
|
28895
|
+
profile,
|
|
28896
|
+
applied: false,
|
|
28897
|
+
dropped: 0,
|
|
28898
|
+
droppedByType: {}
|
|
28899
|
+
};
|
|
28900
|
+
}
|
|
28901
|
+
const sources = graph.ir.taint.sources;
|
|
28902
|
+
if (sources.length === 0) {
|
|
28903
|
+
return {
|
|
28904
|
+
profile,
|
|
28905
|
+
applied: true,
|
|
28906
|
+
dropped: 0,
|
|
28907
|
+
droppedByType: {}
|
|
28908
|
+
};
|
|
28909
|
+
}
|
|
28910
|
+
const droppedByType = {};
|
|
28911
|
+
const kept = [];
|
|
28912
|
+
for (const src of sources) {
|
|
28913
|
+
if (SPECULATIVE_SOURCE_TYPES.has(src.type)) {
|
|
28914
|
+
droppedByType[src.type] = (droppedByType[src.type] ?? 0) + 1;
|
|
28915
|
+
continue;
|
|
28916
|
+
}
|
|
28917
|
+
kept.push(src);
|
|
28918
|
+
}
|
|
28919
|
+
const dropped = sources.length - kept.length;
|
|
28920
|
+
sources.length = 0;
|
|
28921
|
+
sources.push(...kept);
|
|
28922
|
+
return {
|
|
28923
|
+
profile,
|
|
28924
|
+
applied: true,
|
|
28925
|
+
dropped,
|
|
28926
|
+
droppedByType
|
|
28927
|
+
};
|
|
28928
|
+
}
|
|
28929
|
+
}
|
|
28930
|
+
|
|
28876
28931
|
// ../circle-ir/dist/analysis/passes/sink-filter-pass.js
|
|
28877
28932
|
var JS_XSS_SANITIZERS = [
|
|
28878
28933
|
/\bDOMPurify\.sanitize\s*\(/,
|
|
@@ -41571,6 +41626,38 @@ function makeProfileResolver(p) {
|
|
|
41571
41626
|
return () => p;
|
|
41572
41627
|
return (file) => p.get(file) ?? "unknown";
|
|
41573
41628
|
}
|
|
41629
|
+
function computeProjectProfileSummary(fileAnalyses) {
|
|
41630
|
+
const byShape = {
|
|
41631
|
+
library: 0,
|
|
41632
|
+
application: 0,
|
|
41633
|
+
cli: 0,
|
|
41634
|
+
server: 0,
|
|
41635
|
+
plugin: 0,
|
|
41636
|
+
unknown: 0
|
|
41637
|
+
};
|
|
41638
|
+
const byEnv = {
|
|
41639
|
+
production: 0,
|
|
41640
|
+
dev: 0,
|
|
41641
|
+
sample: 0,
|
|
41642
|
+
benchmark: 0,
|
|
41643
|
+
test: 0,
|
|
41644
|
+
unknown: 0
|
|
41645
|
+
};
|
|
41646
|
+
for (const { analysis } of fileAnalyses) {
|
|
41647
|
+
const profile = analysis.meta.projectProfile ?? "unknown";
|
|
41648
|
+
if (profile === "unknown") {
|
|
41649
|
+
byShape.unknown += 1;
|
|
41650
|
+
byEnv.unknown += 1;
|
|
41651
|
+
continue;
|
|
41652
|
+
}
|
|
41653
|
+
const slash = profile.indexOf("/");
|
|
41654
|
+
const shape = profile.slice(0, slash);
|
|
41655
|
+
const env = profile.slice(slash + 1);
|
|
41656
|
+
byShape[shape] += 1;
|
|
41657
|
+
byEnv[env] += 1;
|
|
41658
|
+
}
|
|
41659
|
+
return { byShape, byEnv, totalFiles: fileAnalyses.length };
|
|
41660
|
+
}
|
|
41574
41661
|
async function analyze(code, filePath, language, options = {}) {
|
|
41575
41662
|
if (!initialized) {
|
|
41576
41663
|
await initAnalyzer(options);
|
|
@@ -41600,6 +41687,9 @@ async function analyze(code, filePath, language, options = {}) {
|
|
|
41600
41687
|
}
|
|
41601
41688
|
const nodeCache = collectAllNodes(tree.rootNode, getNodeTypesForLanguage(language));
|
|
41602
41689
|
const meta = extractMeta(code, tree, filePath, language);
|
|
41690
|
+
if (options.projectProfile !== undefined) {
|
|
41691
|
+
meta.projectProfile = makeProfileResolver(options.projectProfile)(filePath);
|
|
41692
|
+
}
|
|
41603
41693
|
const types = extractTypes(tree, nodeCache, language);
|
|
41604
41694
|
const calls = extractCalls(tree, nodeCache, language);
|
|
41605
41695
|
const imports = extractImports(tree, language);
|
|
@@ -41628,6 +41718,8 @@ async function analyze(code, filePath, language, options = {}) {
|
|
|
41628
41718
|
pipeline.add(new LanguageSourcesPass);
|
|
41629
41719
|
if (!disabledPasses.has("source-semantics"))
|
|
41630
41720
|
pipeline.add(new SourceSemanticsPass);
|
|
41721
|
+
if (!disabledPasses.has("library-profile-source-gate"))
|
|
41722
|
+
pipeline.add(new LibraryProfileSourceGatePass);
|
|
41631
41723
|
pipeline.add(new SinkFilterPass);
|
|
41632
41724
|
if (!disabledPasses.has("sink-semantics"))
|
|
41633
41725
|
pipeline.add(new SinkSemanticsPass);
|
|
@@ -41919,6 +42011,9 @@ async function analyzeProject(files, options = {}) {
|
|
|
41919
42011
|
total_loc: totalLoc,
|
|
41920
42012
|
analyzed_at: new Date().toISOString()
|
|
41921
42013
|
};
|
|
42014
|
+
if (options.projectProfile !== undefined) {
|
|
42015
|
+
meta.projectProfileSummary = computeProjectProfileSummary(fileAnalyses);
|
|
42016
|
+
}
|
|
41922
42017
|
const projectAnalysis = {
|
|
41923
42018
|
meta,
|
|
41924
42019
|
files: fileAnalyses,
|
|
@@ -42560,7 +42655,7 @@ var colors = {
|
|
|
42560
42655
|
};
|
|
42561
42656
|
|
|
42562
42657
|
// src/version.ts
|
|
42563
|
-
var version = "3.
|
|
42658
|
+
var version = "3.151.0";
|
|
42564
42659
|
|
|
42565
42660
|
// src/formatters.ts
|
|
42566
42661
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.151.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.151.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|