cognium-dev 3.47.0 → 3.48.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 +100 -74
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -3391,11 +3391,14 @@ function disposeTree(tree) {
|
|
|
3391
3391
|
} catch {}
|
|
3392
3392
|
}
|
|
3393
3393
|
function walkTree(node, visitor) {
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
const
|
|
3397
|
-
|
|
3398
|
-
|
|
3394
|
+
const stack = [node];
|
|
3395
|
+
while (stack.length > 0) {
|
|
3396
|
+
const current = stack.pop();
|
|
3397
|
+
visitor(current);
|
|
3398
|
+
for (let i2 = current.childCount - 1;i2 >= 0; i2--) {
|
|
3399
|
+
const child = current.child(i2);
|
|
3400
|
+
if (child)
|
|
3401
|
+
stack.push(child);
|
|
3399
3402
|
}
|
|
3400
3403
|
}
|
|
3401
3404
|
}
|
|
@@ -13202,9 +13205,11 @@ class ConstantPropagator {
|
|
|
13202
13205
|
return findAssignments(methodBody);
|
|
13203
13206
|
}
|
|
13204
13207
|
collectClassFields(root) {
|
|
13205
|
-
const
|
|
13208
|
+
const stack = [root];
|
|
13209
|
+
while (stack.length > 0) {
|
|
13210
|
+
const n = stack.pop();
|
|
13206
13211
|
if (!n)
|
|
13207
|
-
|
|
13212
|
+
continue;
|
|
13208
13213
|
if (n.type === "class_body") {
|
|
13209
13214
|
for (const child of n.children) {
|
|
13210
13215
|
if (child.type === "field_declaration") {
|
|
@@ -13218,34 +13223,30 @@ class ConstantPropagator {
|
|
|
13218
13223
|
}
|
|
13219
13224
|
}
|
|
13220
13225
|
}
|
|
13221
|
-
|
|
13222
|
-
traverse(child, true, true);
|
|
13223
|
-
} else {
|
|
13224
|
-
traverse(child, true, false);
|
|
13225
|
-
}
|
|
13226
|
+
stack.push(child);
|
|
13226
13227
|
}
|
|
13227
|
-
|
|
13228
|
+
continue;
|
|
13228
13229
|
}
|
|
13229
13230
|
for (const child of n.children) {
|
|
13230
|
-
|
|
13231
|
+
stack.push(child);
|
|
13231
13232
|
}
|
|
13232
|
-
}
|
|
13233
|
-
traverse(root, false, false);
|
|
13233
|
+
}
|
|
13234
13234
|
}
|
|
13235
13235
|
findAllMethods(node) {
|
|
13236
13236
|
const methods = [];
|
|
13237
|
-
const
|
|
13237
|
+
const stack = [node];
|
|
13238
|
+
while (stack.length > 0) {
|
|
13239
|
+
const n = stack.pop();
|
|
13238
13240
|
if (!n)
|
|
13239
|
-
|
|
13241
|
+
continue;
|
|
13240
13242
|
if (n.type === "method_declaration" || n.type === "function_declaration") {
|
|
13241
13243
|
methods.push(n);
|
|
13242
13244
|
}
|
|
13243
13245
|
for (const child of n.children) {
|
|
13244
13246
|
if (child)
|
|
13245
|
-
|
|
13247
|
+
stack.push(child);
|
|
13246
13248
|
}
|
|
13247
|
-
}
|
|
13248
|
-
traverse(node);
|
|
13249
|
+
}
|
|
13249
13250
|
return methods;
|
|
13250
13251
|
}
|
|
13251
13252
|
getMethodName(method) {
|
|
@@ -13290,9 +13291,20 @@ class ConstantPropagator {
|
|
|
13290
13291
|
}
|
|
13291
13292
|
}
|
|
13292
13293
|
visit(node) {
|
|
13294
|
+
const stack = [node];
|
|
13295
|
+
while (stack.length > 0) {
|
|
13296
|
+
const current = stack.pop();
|
|
13297
|
+
if (this.visitOne(current))
|
|
13298
|
+
continue;
|
|
13299
|
+
for (let i2 = current.children.length - 1;i2 >= 0; i2--) {
|
|
13300
|
+
stack.push(current.children[i2]);
|
|
13301
|
+
}
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13304
|
+
visitOne(node) {
|
|
13293
13305
|
const line = getNodeLine(node);
|
|
13294
13306
|
if (this.unreachableLines.has(line)) {
|
|
13295
|
-
return;
|
|
13307
|
+
return true;
|
|
13296
13308
|
}
|
|
13297
13309
|
if (this.conditionStack.length > 0 && !this.lineConditions.has(line)) {
|
|
13298
13310
|
this.lineConditions.set(line, this.conditionStack[this.conditionStack.length - 1]);
|
|
@@ -13301,42 +13313,40 @@ class ConstantPropagator {
|
|
|
13301
13313
|
case "method_declaration":
|
|
13302
13314
|
case "constructor_declaration":
|
|
13303
13315
|
this.handleMethodDeclaration(node);
|
|
13304
|
-
return;
|
|
13316
|
+
return true;
|
|
13305
13317
|
case "local_variable_declaration":
|
|
13306
13318
|
this.handleVariableDeclaration(node);
|
|
13307
|
-
|
|
13319
|
+
return false;
|
|
13308
13320
|
case "assignment_expression":
|
|
13309
13321
|
this.handleAssignment(node);
|
|
13310
|
-
|
|
13322
|
+
return false;
|
|
13311
13323
|
case "update_expression":
|
|
13312
13324
|
this.handleUpdateExpression(node);
|
|
13313
|
-
|
|
13325
|
+
return false;
|
|
13314
13326
|
case "if_statement":
|
|
13315
13327
|
this.handleIfStatement(node);
|
|
13316
|
-
return;
|
|
13328
|
+
return true;
|
|
13317
13329
|
case "switch_expression":
|
|
13318
13330
|
case "switch_statement":
|
|
13319
13331
|
this.handleSwitch(node);
|
|
13320
|
-
return;
|
|
13332
|
+
return true;
|
|
13321
13333
|
case "ternary_expression":
|
|
13322
13334
|
this.handleTernary(node);
|
|
13323
|
-
|
|
13335
|
+
return false;
|
|
13324
13336
|
case "expression_statement":
|
|
13325
13337
|
this.handleExpressionStatement(node);
|
|
13326
|
-
|
|
13338
|
+
return false;
|
|
13327
13339
|
case "for_statement":
|
|
13328
13340
|
case "enhanced_for_statement":
|
|
13329
13341
|
case "while_statement":
|
|
13330
13342
|
case "do_statement":
|
|
13331
13343
|
this.handleLoopStatement(node);
|
|
13332
|
-
return;
|
|
13344
|
+
return true;
|
|
13333
13345
|
case "synchronized_statement":
|
|
13334
13346
|
this.handleSynchronizedStatement(node);
|
|
13335
|
-
return;
|
|
13347
|
+
return true;
|
|
13336
13348
|
default:
|
|
13337
|
-
|
|
13338
|
-
this.visit(child);
|
|
13339
|
-
}
|
|
13349
|
+
return false;
|
|
13340
13350
|
}
|
|
13341
13351
|
}
|
|
13342
13352
|
handleMethodDeclaration(node) {
|
|
@@ -14038,6 +14048,21 @@ class ConstantPropagator {
|
|
|
14038
14048
|
return null;
|
|
14039
14049
|
}
|
|
14040
14050
|
isTaintedExpression(node) {
|
|
14051
|
+
const stack = [node];
|
|
14052
|
+
while (stack.length > 0) {
|
|
14053
|
+
const current = stack.pop();
|
|
14054
|
+
const result = this.isTaintedExpressionStep(current);
|
|
14055
|
+
if (result === true)
|
|
14056
|
+
return true;
|
|
14057
|
+
if (result === false)
|
|
14058
|
+
continue;
|
|
14059
|
+
for (let i2 = current.children.length - 1;i2 >= 0; i2--) {
|
|
14060
|
+
stack.push(current.children[i2]);
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
14063
|
+
return false;
|
|
14064
|
+
}
|
|
14065
|
+
isTaintedExpressionStep(node) {
|
|
14041
14066
|
const text = getNodeText2(node, this.source);
|
|
14042
14067
|
if (node.type === "method_invocation") {
|
|
14043
14068
|
const nameNode = node.childForFieldName("name");
|
|
@@ -14290,12 +14315,7 @@ class ConstantPropagator {
|
|
|
14290
14315
|
}
|
|
14291
14316
|
return isTainted;
|
|
14292
14317
|
}
|
|
14293
|
-
|
|
14294
|
-
if (this.isTaintedExpression(child)) {
|
|
14295
|
-
return true;
|
|
14296
|
-
}
|
|
14297
|
-
}
|
|
14298
|
-
return false;
|
|
14318
|
+
return;
|
|
14299
14319
|
}
|
|
14300
14320
|
checkCollectionTaint(node) {
|
|
14301
14321
|
const objectNode = node.childForFieldName("object");
|
|
@@ -14597,19 +14617,18 @@ class BaseLanguagePlugin {
|
|
|
14597
14617
|
}
|
|
14598
14618
|
findNodes(root, type) {
|
|
14599
14619
|
const nodes = [];
|
|
14600
|
-
const
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14620
|
+
const stack = [root];
|
|
14621
|
+
while (stack.length > 0) {
|
|
14622
|
+
const node = stack.pop();
|
|
14623
|
+
if (node.type === type) {
|
|
14624
|
+
nodes.push(node);
|
|
14604
14625
|
}
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
cursor.gotoParent();
|
|
14626
|
+
for (let i2 = node.childCount - 1;i2 >= 0; i2--) {
|
|
14627
|
+
const child = node.child(i2);
|
|
14628
|
+
if (child)
|
|
14629
|
+
stack.push(child);
|
|
14610
14630
|
}
|
|
14611
|
-
}
|
|
14612
|
-
visit();
|
|
14631
|
+
}
|
|
14613
14632
|
return nodes;
|
|
14614
14633
|
}
|
|
14615
14634
|
findChildByType(node, type) {
|
|
@@ -14930,17 +14949,18 @@ class JavaPlugin extends BaseLanguagePlugin {
|
|
|
14930
14949
|
}
|
|
14931
14950
|
}
|
|
14932
14951
|
};
|
|
14933
|
-
const
|
|
14952
|
+
const stack = [tree.rootNode];
|
|
14953
|
+
while (stack.length > 0) {
|
|
14954
|
+
const node = stack.pop();
|
|
14934
14955
|
if (node.type === "field_declaration" || node.type === "local_variable_declaration") {
|
|
14935
14956
|
collectDecl(node);
|
|
14936
14957
|
}
|
|
14937
14958
|
for (let i2 = 0;i2 < node.childCount; i2++) {
|
|
14938
14959
|
const child = node.child(i2);
|
|
14939
14960
|
if (child)
|
|
14940
|
-
|
|
14961
|
+
stack.push(child);
|
|
14941
14962
|
}
|
|
14942
|
-
}
|
|
14943
|
-
walk(tree.rootNode);
|
|
14963
|
+
}
|
|
14944
14964
|
this._typeMapCache.set(tree, map);
|
|
14945
14965
|
return map;
|
|
14946
14966
|
}
|
|
@@ -19455,16 +19475,19 @@ function extractHtmlContent(rootNode) {
|
|
|
19455
19475
|
return { scriptBlocks, eventHandlers };
|
|
19456
19476
|
}
|
|
19457
19477
|
function walkNode(node, scriptBlocks, eventHandlers) {
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19478
|
+
const stack = [node];
|
|
19479
|
+
while (stack.length > 0) {
|
|
19480
|
+
const current = stack.pop();
|
|
19481
|
+
if (current.type === "script_element") {
|
|
19482
|
+
extractScriptBlock(current, scriptBlocks);
|
|
19483
|
+
}
|
|
19484
|
+
if (current.type === "element" || current.type === "self_closing_tag") {
|
|
19485
|
+
extractEventHandlers(current, eventHandlers);
|
|
19486
|
+
}
|
|
19487
|
+
for (let i2 = current.childCount - 1;i2 >= 0; i2--) {
|
|
19488
|
+
const child = current.child(i2);
|
|
19489
|
+
if (child)
|
|
19490
|
+
stack.push(child);
|
|
19468
19491
|
}
|
|
19469
19492
|
}
|
|
19470
19493
|
}
|
|
@@ -19569,13 +19592,16 @@ function runHtmlAttributeSecurityChecks(rootNode, filePath) {
|
|
|
19569
19592
|
return findings;
|
|
19570
19593
|
}
|
|
19571
19594
|
function walkForSecurityChecks(node, filePath, findings) {
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19595
|
+
const stack = [node];
|
|
19596
|
+
while (stack.length > 0) {
|
|
19597
|
+
const current = stack.pop();
|
|
19598
|
+
if (current.type === "element" || current.type === "self_closing_tag" || current.type === "script_element" || current.type === "style_element") {
|
|
19599
|
+
checkElement(current, filePath, findings);
|
|
19600
|
+
}
|
|
19601
|
+
for (let i2 = current.childCount - 1;i2 >= 0; i2--) {
|
|
19602
|
+
const child = current.child(i2);
|
|
19603
|
+
if (child)
|
|
19604
|
+
stack.push(child);
|
|
19579
19605
|
}
|
|
19580
19606
|
}
|
|
19581
19607
|
}
|
|
@@ -28058,7 +28084,7 @@ var colors = {
|
|
|
28058
28084
|
};
|
|
28059
28085
|
|
|
28060
28086
|
// src/version.ts
|
|
28061
|
-
var version = "3.
|
|
28087
|
+
var version = "3.48.0";
|
|
28062
28088
|
|
|
28063
28089
|
// src/formatters.ts
|
|
28064
28090
|
var SINK_SEVERITY = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.48.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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"registry": "https://registry.npmjs.org/"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"circle-ir": "^3.
|
|
68
|
+
"circle-ir": "^3.48.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "^25.5.0",
|