cognium-dev 4.9.29 → 4.10.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 +98 -9
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -3667,7 +3667,7 @@ function detectLanguage(tree) {
|
|
|
3667
3667
|
return "python";
|
|
3668
3668
|
return jsScore > javaScore ? "javascript" : "java";
|
|
3669
3669
|
}
|
|
3670
|
-
function extractTypes(tree, cache, language) {
|
|
3670
|
+
function extractTypes(tree, cache, language, options) {
|
|
3671
3671
|
const effectiveLanguage = language ?? detectLanguage(tree);
|
|
3672
3672
|
const isJavaScript = effectiveLanguage === "javascript" || effectiveLanguage === "typescript" || effectiveLanguage === "tsx";
|
|
3673
3673
|
const isPython = effectiveLanguage === "python";
|
|
@@ -3687,7 +3687,7 @@ function extractTypes(tree, cache, language) {
|
|
|
3687
3687
|
if (effectiveLanguage === "csharp") {
|
|
3688
3688
|
return extractCSharpTypes(tree, cache);
|
|
3689
3689
|
}
|
|
3690
|
-
return extractJavaTypes(tree, cache);
|
|
3690
|
+
return extractJavaTypes(tree, cache, options);
|
|
3691
3691
|
}
|
|
3692
3692
|
function csharpMemberNodes(body2) {
|
|
3693
3693
|
if (!body2)
|
|
@@ -3843,7 +3843,7 @@ function extractCSharpModifiers(node) {
|
|
|
3843
3843
|
}
|
|
3844
3844
|
return mods;
|
|
3845
3845
|
}
|
|
3846
|
-
function extractJavaTypes(tree, cache) {
|
|
3846
|
+
function extractJavaTypes(tree, cache, options) {
|
|
3847
3847
|
const types = [];
|
|
3848
3848
|
const classes = getNodesFromCache(tree.rootNode, "class_declaration", cache);
|
|
3849
3849
|
for (const cls of classes) {
|
|
@@ -3857,8 +3857,81 @@ function extractJavaTypes(tree, cache) {
|
|
|
3857
3857
|
for (const enumDecl of enums) {
|
|
3858
3858
|
types.push(extractEnumInfo(enumDecl));
|
|
3859
3859
|
}
|
|
3860
|
+
if (!options?.navigationTypes)
|
|
3861
|
+
return types;
|
|
3862
|
+
for (const rec of getNodesFromCache(tree.rootNode, "record_declaration", cache)) {
|
|
3863
|
+
const info2 = extractClassInfo(rec);
|
|
3864
|
+
info2.is_record = true;
|
|
3865
|
+
for (const comp of recordComponents(rec)) {
|
|
3866
|
+
if (!info2.fields.some((f) => f.name === comp.name)) {
|
|
3867
|
+
info2.fields.push({
|
|
3868
|
+
name: comp.name,
|
|
3869
|
+
type: comp.type,
|
|
3870
|
+
modifiers: ["private", "final"],
|
|
3871
|
+
annotations: []
|
|
3872
|
+
});
|
|
3873
|
+
}
|
|
3874
|
+
if (!info2.methods.some((m) => m.name === comp.name)) {
|
|
3875
|
+
info2.methods.push({
|
|
3876
|
+
name: comp.name,
|
|
3877
|
+
return_type: comp.type,
|
|
3878
|
+
parameters: [],
|
|
3879
|
+
annotations: [],
|
|
3880
|
+
modifiers: ["public"],
|
|
3881
|
+
start_line: rec.startPosition.row + 1,
|
|
3882
|
+
end_line: rec.startPosition.row + 1
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
types.push(info2);
|
|
3887
|
+
}
|
|
3888
|
+
const declNodes = [
|
|
3889
|
+
...classes,
|
|
3890
|
+
...interfaces,
|
|
3891
|
+
...enums,
|
|
3892
|
+
...getNodesFromCache(tree.rootNode, "record_declaration", cache)
|
|
3893
|
+
];
|
|
3894
|
+
for (const t of types) {
|
|
3895
|
+
const node = declNodes.find((n) => n.startPosition.row + 1 === t.start_line && getIdentifier(n, "name") === t.name);
|
|
3896
|
+
const path = node ? enclosingTypePath(node) : [];
|
|
3897
|
+
if (path.length > 0)
|
|
3898
|
+
t.enclosing_type = path.join(".");
|
|
3899
|
+
}
|
|
3860
3900
|
return types;
|
|
3861
3901
|
}
|
|
3902
|
+
function recordComponents(node) {
|
|
3903
|
+
const out2 = [];
|
|
3904
|
+
const params = node.childForFieldName("parameters");
|
|
3905
|
+
if (!params)
|
|
3906
|
+
return out2;
|
|
3907
|
+
for (let i2 = 0;i2 < params.childCount; i2++) {
|
|
3908
|
+
const c = params.child(i2);
|
|
3909
|
+
if (!c || c.type !== "formal_parameter")
|
|
3910
|
+
continue;
|
|
3911
|
+
const name2 = c.childForFieldName("name");
|
|
3912
|
+
const type = c.childForFieldName("type");
|
|
3913
|
+
if (name2)
|
|
3914
|
+
out2.push({ name: getNodeText(name2), type: type ? getNodeText(type) : null });
|
|
3915
|
+
}
|
|
3916
|
+
return out2;
|
|
3917
|
+
}
|
|
3918
|
+
function enclosingTypePath(node) {
|
|
3919
|
+
const DECLS = new Set([
|
|
3920
|
+
"class_declaration",
|
|
3921
|
+
"interface_declaration",
|
|
3922
|
+
"enum_declaration",
|
|
3923
|
+
"record_declaration"
|
|
3924
|
+
]);
|
|
3925
|
+
const path = [];
|
|
3926
|
+
for (let p = node.parent;p; p = p.parent) {
|
|
3927
|
+
if (!DECLS.has(p.type))
|
|
3928
|
+
continue;
|
|
3929
|
+
const n = getIdentifier(p, "name");
|
|
3930
|
+
if (n)
|
|
3931
|
+
path.unshift(n);
|
|
3932
|
+
}
|
|
3933
|
+
return path;
|
|
3934
|
+
}
|
|
3862
3935
|
function extractJavaScriptTypes(tree, cache) {
|
|
3863
3936
|
const types = [];
|
|
3864
3937
|
const classes = getNodesFromCache(tree.rootNode, "class_declaration", cache);
|
|
@@ -12591,6 +12664,22 @@ var DEFAULT_SINKS = [
|
|
|
12591
12664
|
{ method: "deserialize", class: "bincode", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0] },
|
|
12592
12665
|
{ method: "from_str", class: "toml", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12593
12666
|
{ method: "from_str", class: "ron", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12667
|
+
{ method: "from_slice", class: "rmp_serde", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12668
|
+
{ method: "from_read", class: "rmp_serde", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12669
|
+
{ method: "from_read_ref", class: "rmp_serde", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12670
|
+
{ method: "from_slice", class: "serde_yaml", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12671
|
+
{ method: "from_slice", class: "toml", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12672
|
+
{ method: "from_reader", class: "ron", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12673
|
+
{ method: "from_bytes", class: "postcard", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12674
|
+
{ method: "from_slice", class: "serde_cbor", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12675
|
+
{ method: "from_reader", class: "serde_cbor", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12676
|
+
{ method: "from_reader", class: "ciborium", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12677
|
+
{ method: "from_str", class: "serde_xml_rs", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12678
|
+
{ method: "from_reader", class: "serde_xml_rs", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12679
|
+
{ method: "from_str", class: "quick_xml", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12680
|
+
{ method: "from_reader", class: "quick_xml", type: "deserialization", cwe: "CWE-502", severity: "high", arg_positions: [0] },
|
|
12681
|
+
{ method: "from_slice", class: "bincode", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0] },
|
|
12682
|
+
{ method: "deserialize_from", class: "bincode", type: "deserialization", cwe: "CWE-502", severity: "critical", arg_positions: [0] },
|
|
12594
12683
|
{ method: "body", class: "HttpResponseBuilder", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
12595
12684
|
{ method: "body", class: "HttpResponse", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
12596
12685
|
{ method: "Html", type: "xss", cwe: "CWE-79", severity: "high", arg_positions: [0] },
|
|
@@ -49270,7 +49359,7 @@ async function analyze(code, filePath, language, options = {}) {
|
|
|
49270
49359
|
};
|
|
49271
49360
|
}
|
|
49272
49361
|
const tTypes = phaseStart();
|
|
49273
|
-
const types = extractTypes(tree, nodeCache, language);
|
|
49362
|
+
const types = extractTypes(tree, nodeCache, language, { navigationTypes: options.navigationTypes });
|
|
49274
49363
|
phaseEnd("extractTypes", tTypes);
|
|
49275
49364
|
const tCalls = phaseStart();
|
|
49276
49365
|
const calls = extractCalls(tree, nodeCache, language);
|
|
@@ -50785,7 +50874,7 @@ var colors = {
|
|
|
50785
50874
|
};
|
|
50786
50875
|
|
|
50787
50876
|
// src/version.ts
|
|
50788
|
-
var version = "4.
|
|
50877
|
+
var version = "4.10.0";
|
|
50789
50878
|
|
|
50790
50879
|
// src/formatters.ts
|
|
50791
50880
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
|
@@ -51337,8 +51426,8 @@ function generateSarifResults(results, crossFileData) {
|
|
|
51337
51426
|
|
|
51338
51427
|
// src/build-info.ts
|
|
51339
51428
|
var buildInfo = {
|
|
51340
|
-
gitSha: "
|
|
51341
|
-
builtAt: "2026-10-
|
|
51429
|
+
gitSha: "598f8fc",
|
|
51430
|
+
builtAt: "2026-10-02T23:23:28.653Z"
|
|
51342
51431
|
};
|
|
51343
51432
|
|
|
51344
51433
|
// src/utils/args.ts
|
|
@@ -51966,7 +52055,7 @@ async function initWasm(spin) {
|
|
|
51966
52055
|
go: join3(wasmDir, "tree-sitter-go.wasm"),
|
|
51967
52056
|
java: join3(wasmDir, "tree-sitter-java.wasm"),
|
|
51968
52057
|
javascript: join3(wasmDir, "tree-sitter-javascript.wasm"),
|
|
51969
|
-
typescript: join3(wasmDir, "tree-sitter-
|
|
52058
|
+
typescript: join3(wasmDir, "tree-sitter-typescript.wasm"),
|
|
51970
52059
|
python: join3(wasmDir, "tree-sitter-python.wasm"),
|
|
51971
52060
|
rust: join3(wasmDir, "tree-sitter-rust.wasm"),
|
|
51972
52061
|
html: join3(wasmDir, "tree-sitter-html.wasm"),
|
|
@@ -52001,7 +52090,7 @@ Please ensure the wasm/ directory is located next to the binary or in your curre
|
|
|
52001
52090
|
go: wasmBasePath + "tree-sitter-go.wasm",
|
|
52002
52091
|
java: wasmBasePath + "tree-sitter-java.wasm",
|
|
52003
52092
|
javascript: wasmBasePath + "tree-sitter-javascript.wasm",
|
|
52004
|
-
typescript: wasmBasePath + "tree-sitter-
|
|
52093
|
+
typescript: wasmBasePath + "tree-sitter-typescript.wasm",
|
|
52005
52094
|
python: wasmBasePath + "tree-sitter-python.wasm",
|
|
52006
52095
|
rust: wasmBasePath + "tree-sitter-rust.wasm",
|
|
52007
52096
|
html: wasmBasePath + "tree-sitter-html.wasm",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cognium-dev": "dist/cli.js"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "bun test",
|
|
13
13
|
"clean": "rm -rf dist cognium-dev cognium-dev-* *.bun-build wasm",
|
|
14
14
|
"typecheck": "tsc --noEmit",
|
|
15
|
-
"version": "node -e \"const v = require('./package.json').version; require('fs').writeFileSync('src/version.ts', '/**\\n * Version information\\n *\\n * Kept in sync with package.json via the \\`version\\` npm lifecycle script.\\n * Do not edit manually
|
|
15
|
+
"version": "node -e \"const v = require('./package.json').version; require('fs').writeFileSync('src/version.ts', '/**\\n * Version information\\n *\\n * Kept in sync with package.json via the \\`version\\` npm lifecycle script.\\n * Do not edit manually — use \\`npm version patch|minor|major\\` instead.\\n */\\nexport const version = \\x27' + v + '\\x27;\\n')\" && git add src/version.ts",
|
|
16
16
|
"dogfood": "bun run src/cli.ts scan src/ -q",
|
|
17
17
|
"prepublishOnly": "bun run build",
|
|
18
18
|
"test:coverage": "bun test --coverage"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@cognium/project-profile-detect": "1.1.2",
|
|
68
|
-
"circle-ir": "4.
|
|
68
|
+
"circle-ir": "4.10.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "^26.6.2",
|