cognium-dev 3.197.0 → 3.199.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.
Files changed (2) hide show
  1. package/dist/cli.js +89 -3
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -3651,6 +3651,10 @@ function extractJavaScriptTypes(tree, cache) {
3651
3651
  for (const cls of classes) {
3652
3652
  types.push(extractJSClassInfo(cls));
3653
3653
  }
3654
+ const interfaces = getNodesFromCache(tree.rootNode, "interface_declaration", cache);
3655
+ for (const iface of interfaces) {
3656
+ types.push(extractTSInterfaceInfo(iface));
3657
+ }
3654
3658
  const functions = getNodesFromCache(tree.rootNode, "function_declaration", cache);
3655
3659
  if (functions.length > 0) {
3656
3660
  const moduleFunctions = [];
@@ -3997,6 +4001,76 @@ function extractSelfAssignments(body2, fields, fieldNames) {
3997
4001
  }
3998
4002
  }
3999
4003
  }
4004
+ function extractTSInterfaceInfo(node) {
4005
+ const name2 = getIdentifier(node, "name") ?? "Anonymous";
4006
+ const parents = [];
4007
+ for (let i2 = 0;i2 < node.childCount; i2++) {
4008
+ const child = node.child(i2);
4009
+ if (!child || child.type !== "extends_type_clause")
4010
+ continue;
4011
+ for (let j = 0;j < child.childCount; j++) {
4012
+ const gc = child.child(j);
4013
+ if (!gc)
4014
+ continue;
4015
+ if (gc.type === "type_identifier" || gc.type === "generic_type" || gc.type === "nested_type_identifier") {
4016
+ parents.push(getNodeText(gc));
4017
+ }
4018
+ }
4019
+ }
4020
+ const body2 = node.childForFieldName("body");
4021
+ const methods = [];
4022
+ const fields = [];
4023
+ if (body2) {
4024
+ for (let i2 = 0;i2 < body2.childCount; i2++) {
4025
+ const member = body2.child(i2);
4026
+ if (!member)
4027
+ continue;
4028
+ if (member.type === "method_signature") {
4029
+ const methodName = getIdentifier(member, "name") ?? getNodeText(member.child(0) ?? member);
4030
+ const params = member.childForFieldName("parameters");
4031
+ const returnType = member.childForFieldName("return_type");
4032
+ methods.push({
4033
+ name: methodName,
4034
+ return_type: returnType ? getNodeText(returnType).replace(/^:\s*/, "") : null,
4035
+ parameters: params ? extractJSParameters(params) : [],
4036
+ annotations: [],
4037
+ modifiers: [],
4038
+ start_line: member.startPosition.row + 1,
4039
+ end_line: member.endPosition.row + 1
4040
+ });
4041
+ continue;
4042
+ }
4043
+ if (member.type === "property_signature") {
4044
+ const fieldName = getIdentifier(member, "name") ?? getNodeText(member.child(0) ?? member);
4045
+ const typeNode = member.childForFieldName("type");
4046
+ const modifiers = [];
4047
+ const text = getNodeText(member);
4048
+ if (/^\s*readonly\b/.test(text))
4049
+ modifiers.push("readonly");
4050
+ if (/\?\s*:/.test(text))
4051
+ modifiers.push("optional");
4052
+ fields.push({
4053
+ name: fieldName,
4054
+ type: typeNode ? getNodeText(typeNode).replace(/^:\s*/, "") : null,
4055
+ modifiers,
4056
+ annotations: []
4057
+ });
4058
+ }
4059
+ }
4060
+ }
4061
+ return {
4062
+ name: name2,
4063
+ kind: "interface",
4064
+ package: null,
4065
+ extends: parents[0] ?? null,
4066
+ implements: parents.slice(1),
4067
+ annotations: [],
4068
+ methods,
4069
+ fields,
4070
+ start_line: node.startPosition.row + 1,
4071
+ end_line: node.endPosition.row + 1
4072
+ };
4073
+ }
4000
4074
  function extractJSClassInfo(node) {
4001
4075
  const name2 = getIdentifier(node, "name") ?? "Anonymous";
4002
4076
  let extendsType = null;
@@ -45368,6 +45442,10 @@ async function analyze(code, filePath, language, options = {}) {
45368
45442
  return analyzeMarkupFile(code, filePath, options, language);
45369
45443
  }
45370
45444
  let parseGrammar = language;
45445
+ if (language === "tsx") {
45446
+ parseGrammar = "tsx";
45447
+ language = "typescript";
45448
+ }
45371
45449
  if (language === "javascript" || language === "typescript") {
45372
45450
  const lower = filePath.toLowerCase();
45373
45451
  if (lower.endsWith(".tsx") || lower.endsWith(".jsx")) {
@@ -46416,7 +46494,7 @@ var colors = {
46416
46494
  };
46417
46495
 
46418
46496
  // src/version.ts
46419
- var version = "3.197.0";
46497
+ var version = "3.199.0";
46420
46498
 
46421
46499
  // src/formatters.ts
46422
46500
  var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
@@ -46452,7 +46530,11 @@ var SINK_SEVERITY = {
46452
46530
  format_string: "high",
46453
46531
  crlf: "medium",
46454
46532
  mass_assignment: "high",
46455
- prompt_injection: "high"
46533
+ prompt_injection: "high",
46534
+ insecure_storage: "medium",
46535
+ prototype_pollution: "high",
46536
+ regex_dos: "high",
46537
+ unsafe_memory: "high"
46456
46538
  };
46457
46539
  var SINK_CWE = {
46458
46540
  sql_injection: "CWE-89",
@@ -46479,7 +46561,11 @@ var SINK_CWE = {
46479
46561
  format_string: "CWE-134",
46480
46562
  crlf: "CWE-113",
46481
46563
  mass_assignment: "CWE-915",
46482
- prompt_injection: "CWE-1427"
46564
+ prompt_injection: "CWE-1427",
46565
+ insecure_storage: "CWE-922",
46566
+ prototype_pollution: "CWE-1321",
46567
+ regex_dos: "CWE-1333",
46568
+ unsafe_memory: "CWE-119"
46483
46569
  };
46484
46570
  var VULNERABILITY_HELP = {
46485
46571
  sql_injection: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognium-dev",
3
- "version": "3.197.0",
3
+ "version": "3.199.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.197.0"
69
+ "circle-ir": "^3.199.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^25.5.0",