circle-ir 4.20.0 → 4.21.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/analysis/config-loader.d.ts.map +1 -1
- package/dist/analysis/config-loader.js +17 -2
- package/dist/analysis/config-loader.js.map +1 -1
- package/dist/analysis/constant-propagation/patterns.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/patterns.js +3 -0
- package/dist/analysis/constant-propagation/patterns.js.map +1 -1
- package/dist/analysis/constant-propagation/propagator.d.ts +46 -1
- package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
- package/dist/analysis/constant-propagation/propagator.js +407 -56
- package/dist/analysis/constant-propagation/propagator.js.map +1 -1
- package/dist/analysis/findings.d.ts.map +1 -1
- package/dist/analysis/findings.js +7 -5
- package/dist/analysis/findings.js.map +1 -1
- package/dist/analysis/interprocedural.d.ts +16 -0
- package/dist/analysis/interprocedural.d.ts.map +1 -1
- package/dist/analysis/interprocedural.js +545 -197
- package/dist/analysis/interprocedural.js.map +1 -1
- package/dist/analysis/passes/csrf-samesite-none-session-pass.d.ts +58 -0
- package/dist/analysis/passes/csrf-samesite-none-session-pass.d.ts.map +1 -0
- package/dist/analysis/passes/csrf-samesite-none-session-pass.js +159 -0
- package/dist/analysis/passes/csrf-samesite-none-session-pass.js.map +1 -0
- package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
- package/dist/analysis/passes/interprocedural-pass.js +83 -10
- package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
- package/dist/analysis/passes/language-sources-pass.d.ts +0 -18
- package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
- package/dist/analysis/passes/language-sources-pass.js +439 -16
- package/dist/analysis/passes/language-sources-pass.js.map +1 -1
- package/dist/analysis/passes/param-source-flow-gate-pass.d.ts.map +1 -1
- package/dist/analysis/passes/param-source-flow-gate-pass.js +71 -1
- package/dist/analysis/passes/param-source-flow-gate-pass.js.map +1 -1
- package/dist/analysis/passes/prompt-injection-safety-gate-pass.js +1 -1
- package/dist/analysis/passes/prompt-injection-safety-gate-pass.js.map +1 -1
- package/dist/analysis/passes/scan-secrets-pass.js +2 -2
- package/dist/analysis/passes/scan-secrets-pass.js.map +1 -1
- package/dist/analysis/passes/sensitive-data-in-log-pass.d.ts +66 -0
- package/dist/analysis/passes/sensitive-data-in-log-pass.d.ts.map +1 -0
- package/dist/analysis/passes/sensitive-data-in-log-pass.js +462 -0
- package/dist/analysis/passes/sensitive-data-in-log-pass.js.map +1 -0
- package/dist/analysis/passes/sink-filter-pass.d.ts +7 -1
- package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
- package/dist/analysis/passes/sink-filter-pass.js +372 -14
- package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.js +289 -13
- package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
- package/dist/analysis/project-callee-escape-gate.js +1 -1
- package/dist/analysis/project-callee-escape-gate.js.map +1 -1
- package/dist/analysis/rules.d.ts.map +1 -1
- package/dist/analysis/rules.js +9 -0
- package/dist/analysis/rules.js.map +1 -1
- package/dist/analysis/sbom.d.ts +49 -0
- package/dist/analysis/sbom.d.ts.map +1 -1
- package/dist/analysis/sbom.js +126 -1
- package/dist/analysis/sbom.js.map +1 -1
- package/dist/analysis/taint-matcher.d.ts.map +1 -1
- package/dist/analysis/taint-matcher.js +85 -16
- package/dist/analysis/taint-matcher.js.map +1 -1
- package/dist/analysis/taint-propagation.d.ts +1 -0
- package/dist/analysis/taint-propagation.d.ts.map +1 -1
- package/dist/analysis/taint-propagation.js +32 -0
- package/dist/analysis/taint-propagation.js.map +1 -1
- package/dist/analysis/test-to-production-taint-gate.d.ts +13 -0
- package/dist/analysis/test-to-production-taint-gate.d.ts.map +1 -0
- package/dist/analysis/test-to-production-taint-gate.js +30 -0
- package/dist/analysis/test-to-production-taint-gate.js.map +1 -0
- package/dist/analyzer.d.ts +15 -3
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +56 -2
- package/dist/analyzer.js.map +1 -1
- package/dist/browser/circle-ir.js +4972 -2470
- package/dist/core/circle-ir-core.cjs +2969 -2223
- package/dist/core/circle-ir-core.js +2969 -2219
- package/dist/core/extractors/calls.d.ts +10 -1
- package/dist/core/extractors/calls.d.ts.map +1 -1
- package/dist/core/extractors/calls.js +148 -6
- package/dist/core/extractors/calls.js.map +1 -1
- package/dist/core/extractors/cfg.d.ts.map +1 -1
- package/dist/core/extractors/cfg.js +12 -0
- package/dist/core/extractors/cfg.js.map +1 -1
- package/dist/core/extractors/dfg.d.ts.map +1 -1
- package/dist/core/extractors/dfg.js +151 -18
- package/dist/core/extractors/dfg.js.map +1 -1
- package/dist/core/extractors/types.d.ts +5 -0
- package/dist/core/extractors/types.d.ts.map +1 -1
- package/dist/core/extractors/types.js +149 -4
- package/dist/core/extractors/types.js.map +1 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +3 -1
- package/dist/core/parser.js.map +1 -1
- package/dist/core/ts-grammar-workarounds.d.ts +18 -0
- package/dist/core/ts-grammar-workarounds.d.ts.map +1 -0
- package/dist/core/ts-grammar-workarounds.js +40 -0
- package/dist/core/ts-grammar-workarounds.js.map +1 -0
- package/dist/facts/facts2.d.ts +12 -3
- package/dist/facts/facts2.d.ts.map +1 -1
- package/dist/facts/facts2.js +24 -7
- package/dist/facts/facts2.js.map +1 -1
- package/dist/facts/index.d.ts +3 -1
- package/dist/facts/index.d.ts.map +1 -1
- package/dist/facts/index.js +2 -1
- package/dist/facts/index.js.map +1 -1
- package/dist/facts/schema2.d.ts +3 -3
- package/dist/facts/schema2.js +3 -3
- package/dist/facts/t6.d.ts +84 -0
- package/dist/facts/t6.d.ts.map +1 -0
- package/dist/facts/t6.js +226 -0
- package/dist/facts/t6.js.map +1 -0
- package/dist/graph-facts/dead-code.d.ts.map +1 -1
- package/dist/graph-facts/dead-code.js +3 -2
- package/dist/graph-facts/dead-code.js.map +1 -1
- package/dist/graph-facts/index.d.ts +1 -1
- package/dist/graph-facts/index.d.ts.map +1 -1
- package/dist/graph-facts/index.js +1 -1
- package/dist/graph-facts/index.js.map +1 -1
- package/dist/graph-facts/reach.d.ts +31 -4
- package/dist/graph-facts/reach.d.ts.map +1 -1
- package/dist/graph-facts/reach.js +120 -4
- package/dist/graph-facts/reach.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/java-graph.d.ts +31 -9
- package/dist/navigation/java-graph.d.ts.map +1 -1
- package/dist/navigation/java-graph.js +174 -11
- package/dist/navigation/java-graph.js.map +1 -1
- package/dist/navigation/java-registrations.d.ts +93 -0
- package/dist/navigation/java-registrations.d.ts.map +1 -0
- package/dist/navigation/java-registrations.js +254 -0
- package/dist/navigation/java-registrations.js.map +1 -0
- package/dist/navigation/navigation-index.d.ts +65 -3
- package/dist/navigation/navigation-index.d.ts.map +1 -1
- package/dist/navigation/navigation-index.js +181 -11
- package/dist/navigation/navigation-index.js.map +1 -1
- package/dist/navigation/ts-call-edges.d.ts +6 -0
- package/dist/navigation/ts-call-edges.d.ts.map +1 -1
- package/dist/navigation/ts-call-edges.js.map +1 -1
- package/dist/navigation/ts-entry-tables.d.ts +1 -1
- package/dist/navigation/ts-entry-tables.d.ts.map +1 -1
- package/dist/navigation/ts-entry-tables.js.map +1 -1
- package/dist/navigation/xml-scan.d.ts +40 -0
- package/dist/navigation/xml-scan.d.ts.map +1 -0
- package/dist/navigation/xml-scan.js +269 -0
- package/dist/navigation/xml-scan.js.map +1 -0
- package/dist/stable-ids/index.d.ts +3 -3
- package/dist/stable-ids/index.d.ts.map +1 -1
- package/dist/stable-ids/index.js +16 -4
- package/dist/stable-ids/index.js.map +1 -1
- package/dist/stable-ids/nodes.d.ts +16 -6
- package/dist/stable-ids/nodes.d.ts.map +1 -1
- package/dist/stable-ids/nodes.js +17 -7
- package/dist/stable-ids/nodes.js.map +1 -1
- package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -1
- package/dist/stable-ids/ts-parse-errors.js +21 -2
- package/dist/stable-ids/ts-parse-errors.js.map +1 -1
- package/dist/stable-ids/typescript.d.ts +5 -0
- package/dist/stable-ids/typescript.d.ts.map +1 -1
- package/dist/stable-ids/typescript.js +41 -8
- package/dist/stable-ids/typescript.js.map +1 -1
- package/dist/types/index.d.ts +21 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/docs/SPEC.md +9 -0
- package/package.json +3 -3
|
@@ -198,8 +198,14 @@ export class LanguageSourcesPass {
|
|
|
198
198
|
additionalSources.push(...findOopFieldReadSources(types, code, language));
|
|
199
199
|
// -- Java (#78 round 2): static field stores inside the same class -------
|
|
200
200
|
additionalSources.push(...findStaticFieldSources(types, code, language));
|
|
201
|
+
// -- Java #1198: instance-field HTTP stores + reflection Field.get reads -
|
|
202
|
+
additionalSources.push(...findJavaInstanceFieldHttpSources(types, code, language));
|
|
203
|
+
additionalSources.push(...findJavaReflectionFieldGetSources(types, code, language));
|
|
204
|
+
additionalSources.push(...findJavaReflectionFieldSetSources(types, code, language));
|
|
201
205
|
// -- Java (#78 round 2): non-bean setter/getter chains -------------------
|
|
202
206
|
additionalSources.push(...findSetterChainSources(types, code, language));
|
|
207
|
+
// -- Java #1198: taint stored on locals' instance fields (Basic29-style) -
|
|
208
|
+
additionalSources.push(...findJavaHeapFieldDerivedSources(code, language));
|
|
203
209
|
// -- JavaScript/TypeScript: assignment sources and DOM XSS sinks ---------
|
|
204
210
|
additionalSources.push(...findJavaScriptAssignmentSources(code, language));
|
|
205
211
|
// -- C#: explicit ASP.NET request sources --------------------------------
|
|
@@ -1033,6 +1039,182 @@ function findStaticFieldSources(types, sourceCode, language) {
|
|
|
1033
1039
|
}
|
|
1034
1040
|
return sources;
|
|
1035
1041
|
}
|
|
1042
|
+
const JAVA_HTTP_RHS_PATTERN = /\b(?:req|request|httpRequest|servletRequest|httpServletRequest)\.(?:getParameter|getParameterValues|getParameterMap|getHeader|getHeaders|getCookies|getQueryString|getPathInfo|getRequestURI|getRequestURL|getInputStream|getReader)\b/;
|
|
1043
|
+
/** Shared line matchers for reflection field get/set heuristics (#1198). */
|
|
1044
|
+
const JAVA_DECLARE_FIELD_LINE_RE = /^\s*(?:[\w.]+\s+)?Field\s+(\w+)\s*=\s*.+\.(?:getField|getDeclaredField)\s*\(\s*"([^"]+)"\s*\)/;
|
|
1045
|
+
const JAVA_FIELD_SET_LINE_RE = /^\s*(\w+)\.set\s*\(\s*(\w+)\s*,\s*(\w+)\s*\)\s*;?/;
|
|
1046
|
+
/** cognium-dev #1198 — heap field stores `base.field = rhs;` (shared for regex-lint budget). */
|
|
1047
|
+
const JAVA_LOCAL_FIELD_ASSIGN_LINE_RE = /^\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\s*=\s*(.+?);\s*$/;
|
|
1048
|
+
const JAVA_BARE_ASSIGN_LINE_RE = /^\s*([A-Za-z_]\w*)\s*=\s*(.+?)(?:;\s*)?$/;
|
|
1049
|
+
/**
|
|
1050
|
+
* cognium-dev #1198 — Instance (non-static) field assigned from HTTP in any method.
|
|
1051
|
+
* Complements constructor-only #78 field sources (SecuriBench `Refl2` writes `name` in
|
|
1052
|
+
* `doGet`, not the ctor).
|
|
1053
|
+
*/
|
|
1054
|
+
function findJavaInstanceFieldHttpSources(types, sourceCode, language) {
|
|
1055
|
+
if (language !== 'java')
|
|
1056
|
+
return [];
|
|
1057
|
+
const sources = [];
|
|
1058
|
+
const lines = sourceCode.split('\n');
|
|
1059
|
+
for (const type of types) {
|
|
1060
|
+
if (type.kind !== 'class' || type.name === '<module>')
|
|
1061
|
+
continue;
|
|
1062
|
+
const instanceFields = new Set(type.fields.filter(f => !f.modifiers.includes('static')).map(f => f.name));
|
|
1063
|
+
if (instanceFields.size === 0)
|
|
1064
|
+
continue;
|
|
1065
|
+
for (const m of type.methods) {
|
|
1066
|
+
const mStart = m.start_line;
|
|
1067
|
+
const mEnd = m.end_line;
|
|
1068
|
+
for (let i = mStart - 1; i < Math.min(mEnd, lines.length); i++) {
|
|
1069
|
+
const trimmed = (lines[i] ?? '').trim();
|
|
1070
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1071
|
+
continue;
|
|
1072
|
+
const bm = trimmed.match(JAVA_BARE_ASSIGN_LINE_RE);
|
|
1073
|
+
if (!bm)
|
|
1074
|
+
continue;
|
|
1075
|
+
const fieldName = bm[1];
|
|
1076
|
+
const rhs = bm[2].trim().replace(/;\s*$/, '');
|
|
1077
|
+
if (!instanceFields.has(fieldName))
|
|
1078
|
+
continue;
|
|
1079
|
+
if (!JAVA_HTTP_RHS_PATTERN.test(rhs))
|
|
1080
|
+
continue;
|
|
1081
|
+
sources.push({
|
|
1082
|
+
type: 'http_param',
|
|
1083
|
+
location: `${type.name}.${fieldName} instance field (this.) set in ${m.name}() — #1198`,
|
|
1084
|
+
severity: 'high',
|
|
1085
|
+
line: i + 1,
|
|
1086
|
+
confidence: 0.85,
|
|
1087
|
+
variable: `this.${fieldName}`,
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
return sources;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* cognium-dev #1198 — `Field.get` on a reflectively looked-up instance field that was
|
|
1096
|
+
* tainted earlier in the class (SecuriBench `Refl2`).
|
|
1097
|
+
*/
|
|
1098
|
+
function findJavaReflectionFieldGetSources(types, sourceCode, language) {
|
|
1099
|
+
if (language !== 'java')
|
|
1100
|
+
return [];
|
|
1101
|
+
const lines = sourceCode.split('\n');
|
|
1102
|
+
const taintedFieldNames = new Set();
|
|
1103
|
+
for (const type of types) {
|
|
1104
|
+
if (type.kind !== 'class' || type.name === '<module>')
|
|
1105
|
+
continue;
|
|
1106
|
+
const instanceFields = new Set(type.fields.filter(f => !f.modifiers.includes('static')).map(f => f.name));
|
|
1107
|
+
for (const m of type.methods) {
|
|
1108
|
+
for (let i = m.start_line - 1; i < Math.min(m.end_line, lines.length); i++) {
|
|
1109
|
+
const trimmed = (lines[i] ?? '').trim();
|
|
1110
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1111
|
+
continue;
|
|
1112
|
+
const bm = trimmed.match(JAVA_BARE_ASSIGN_LINE_RE);
|
|
1113
|
+
if (!bm)
|
|
1114
|
+
continue;
|
|
1115
|
+
const fieldName = bm[1];
|
|
1116
|
+
const rhs = bm[2].trim().replace(/;\s*$/, '');
|
|
1117
|
+
if (instanceFields.has(fieldName) && JAVA_HTTP_RHS_PATTERN.test(rhs)) {
|
|
1118
|
+
taintedFieldNames.add(fieldName);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
if (taintedFieldNames.size === 0)
|
|
1124
|
+
return [];
|
|
1125
|
+
const sources = [];
|
|
1126
|
+
const fieldVarToName = new Map();
|
|
1127
|
+
const fieldGetAssignRe = /^\s*(?:[\w.]+\s+)?(\w+)\s*=\s*\([^)]*\)\s*(\w+)\.get\s*\(/;
|
|
1128
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1129
|
+
const trimmed = (lines[i] ?? '').trim();
|
|
1130
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1131
|
+
continue;
|
|
1132
|
+
const decl = trimmed.match(JAVA_DECLARE_FIELD_LINE_RE);
|
|
1133
|
+
if (decl) {
|
|
1134
|
+
const [, varName, reflectedField] = decl;
|
|
1135
|
+
if (taintedFieldNames.has(reflectedField)) {
|
|
1136
|
+
fieldVarToName.set(varName, reflectedField);
|
|
1137
|
+
}
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
const assign = trimmed.match(fieldGetAssignRe);
|
|
1141
|
+
if (!assign)
|
|
1142
|
+
continue;
|
|
1143
|
+
const [, lhs, fieldVar] = assign;
|
|
1144
|
+
const reflectedField = fieldVarToName.get(fieldVar);
|
|
1145
|
+
if (!reflectedField)
|
|
1146
|
+
continue;
|
|
1147
|
+
sources.push({
|
|
1148
|
+
type: 'http_param',
|
|
1149
|
+
location: `Field.get("${reflectedField}") assignment — #1198`,
|
|
1150
|
+
severity: 'high',
|
|
1151
|
+
line: i + 1,
|
|
1152
|
+
confidence: 0.85,
|
|
1153
|
+
variable: lhs,
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
return sources;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* cognium-dev #1198 — `Field.set` stores HTTP-tainted data into a reflectively
|
|
1160
|
+
* looked-up instance field (`Refl3`: set on inner class field, read at sink).
|
|
1161
|
+
*/
|
|
1162
|
+
function findJavaReflectionFieldSetSources(types, sourceCode, language) {
|
|
1163
|
+
if (language !== 'java')
|
|
1164
|
+
return [];
|
|
1165
|
+
const lines = sourceCode.split('\n');
|
|
1166
|
+
const taintedVars = new Set();
|
|
1167
|
+
for (const type of types) {
|
|
1168
|
+
if (type.kind !== 'class' || type.name === '<module>')
|
|
1169
|
+
continue;
|
|
1170
|
+
for (const m of type.methods) {
|
|
1171
|
+
for (let i = m.start_line - 1; i < Math.min(m.end_line, lines.length); i++) {
|
|
1172
|
+
const trimmed = (lines[i] ?? '').trim();
|
|
1173
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1174
|
+
continue;
|
|
1175
|
+
const bm = trimmed.match(JAVA_BARE_ASSIGN_LINE_RE);
|
|
1176
|
+
if (!bm)
|
|
1177
|
+
continue;
|
|
1178
|
+
const rhs = bm[2].trim().replace(/;\s*$/, '');
|
|
1179
|
+
if (JAVA_HTTP_RHS_PATTERN.test(rhs)) {
|
|
1180
|
+
taintedVars.add(bm[1]);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
if (taintedVars.size === 0)
|
|
1186
|
+
return [];
|
|
1187
|
+
const fieldVarToName = new Map();
|
|
1188
|
+
const sources = [];
|
|
1189
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1190
|
+
const trimmed = (lines[i] ?? '').trim();
|
|
1191
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1192
|
+
continue;
|
|
1193
|
+
const decl = trimmed.match(JAVA_DECLARE_FIELD_LINE_RE);
|
|
1194
|
+
if (decl) {
|
|
1195
|
+
fieldVarToName.set(decl[1], decl[2]);
|
|
1196
|
+
continue;
|
|
1197
|
+
}
|
|
1198
|
+
const setM = trimmed.match(JAVA_FIELD_SET_LINE_RE);
|
|
1199
|
+
if (!setM)
|
|
1200
|
+
continue;
|
|
1201
|
+
const [, fieldVar, targetObj, valueArg] = setM;
|
|
1202
|
+
const reflectedField = fieldVarToName.get(fieldVar);
|
|
1203
|
+
if (!reflectedField)
|
|
1204
|
+
continue;
|
|
1205
|
+
if (!taintedVars.has(valueArg))
|
|
1206
|
+
continue;
|
|
1207
|
+
sources.push({
|
|
1208
|
+
type: 'http_param',
|
|
1209
|
+
location: `Field.set("${reflectedField}") on ${targetObj} — #1198`,
|
|
1210
|
+
severity: 'high',
|
|
1211
|
+
line: i + 1,
|
|
1212
|
+
confidence: 0.85,
|
|
1213
|
+
variable: `${targetObj}.${reflectedField}`,
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
return sources;
|
|
1217
|
+
}
|
|
1036
1218
|
/**
|
|
1037
1219
|
* Issue #78 round 2 — Non-bean setter/getter chains (Java).
|
|
1038
1220
|
*
|
|
@@ -1050,7 +1232,8 @@ function findStaticFieldSources(types, sourceCode, language) {
|
|
|
1050
1232
|
* Strategy: for each class, build a `field -> { setter, getter }` map.
|
|
1051
1233
|
* A setter is a 1-param method whose only body statement is
|
|
1052
1234
|
* `this.<field> = <param>;`. A getter is a 0-param method whose only
|
|
1053
|
-
* body statement is `return this.<field
|
|
1235
|
+
* body statement is `return this.<field>;` or `return <field>;` (common
|
|
1236
|
+
* in SecuriBench heap-widget cases). Then walk the whole source
|
|
1054
1237
|
* for setter call sites whose argument matches a known HTTP source —
|
|
1055
1238
|
* emit a synthetic source on the setter call line bound to the *getter*
|
|
1056
1239
|
* method name, so the variable-name scan in `TaintPropagationPass`
|
|
@@ -1065,6 +1248,19 @@ function findSetterChainSources(types, sourceCode, language) {
|
|
|
1065
1248
|
const sources = [];
|
|
1066
1249
|
const lines = sourceCode.split('\n');
|
|
1067
1250
|
const javaHttpPattern = /\b(?:req|request|httpRequest|servletRequest|httpServletRequest)\.(?:getParameter|getParameterValues|getParameterMap|getHeader|getHeaders|getCookies|getQueryString|getPathInfo|getRequestURI|getRequestURL|getInputStream|getReader)\b/;
|
|
1251
|
+
const setterArgFromHttp = (arg) => {
|
|
1252
|
+
const trimmed = arg.trim();
|
|
1253
|
+
if (javaHttpPattern.test(trimmed))
|
|
1254
|
+
return true;
|
|
1255
|
+
const id = /^\s*([A-Za-z_]\w*)\s*$/.exec(trimmed);
|
|
1256
|
+
if (!id)
|
|
1257
|
+
return false;
|
|
1258
|
+
const v = id[1].replace(/[$]/g, '\\$&');
|
|
1259
|
+
// cognium-dev#1198 — SecuriBench Basic16 passes taint as a local (`writePayload(s)`)
|
|
1260
|
+
// after `String s = req.getParameter(...)`; the setter-chain emitter only
|
|
1261
|
+
// matched literal HTTP call expressions in the argument position.
|
|
1262
|
+
return new RegExp(`\\b(?:[\\w.<>,\\s]+\\s+)?${v}\\s*=\\s*[^;\\n]*\\b(?:req|request|httpRequest|servletRequest|httpServletRequest)\\.(?:getParameter|getParameterValues|getHeader|getCookies|getQueryString|getInputStream|getReader)\\s*\\(`).test(sourceCode);
|
|
1263
|
+
};
|
|
1068
1264
|
for (const type of types) {
|
|
1069
1265
|
if (type.kind !== 'class')
|
|
1070
1266
|
continue;
|
|
@@ -1073,7 +1269,7 @@ function findSetterChainSources(types, sourceCode, language) {
|
|
|
1073
1269
|
// Build setter/getter pairs by inspecting per-method bodies.
|
|
1074
1270
|
const pairs = new Map();
|
|
1075
1271
|
const setterRe = /this\.([A-Za-z_]\w*)\s*=\s*([A-Za-z_]\w*)\s*;?/;
|
|
1076
|
-
const getterRe = /return\s+this\.([A-Za-z_]\w*)\s*;?/;
|
|
1272
|
+
const getterRe = /return\s+(?:this\.)?([A-Za-z_]\w*)\s*;?/;
|
|
1077
1273
|
for (const m of type.methods) {
|
|
1078
1274
|
if (m.name === type.name)
|
|
1079
1275
|
continue; // skip constructor
|
|
@@ -1132,7 +1328,7 @@ function findSetterChainSources(types, sourceCode, language) {
|
|
|
1132
1328
|
if (!cm)
|
|
1133
1329
|
continue;
|
|
1134
1330
|
const arg = cm[2];
|
|
1135
|
-
if (!
|
|
1331
|
+
if (!setterArgFromHttp(arg))
|
|
1136
1332
|
continue;
|
|
1137
1333
|
sources.push({
|
|
1138
1334
|
type: 'http_param',
|
|
@@ -1147,6 +1343,60 @@ function findSetterChainSources(types, sourceCode, language) {
|
|
|
1147
1343
|
}
|
|
1148
1344
|
return sources;
|
|
1149
1345
|
}
|
|
1346
|
+
/**
|
|
1347
|
+
* cognium-dev #1198 — `next.value = name` heap field stores and reference aliases
|
|
1348
|
+
* (`head.next = next`) for SecuriBench Basic29-style linked structures.
|
|
1349
|
+
*/
|
|
1350
|
+
function findJavaHeapFieldDerivedSources(code, language) {
|
|
1351
|
+
if (language !== 'java')
|
|
1352
|
+
return [];
|
|
1353
|
+
const seeds = new Set();
|
|
1354
|
+
for (const line of code.split('\n')) {
|
|
1355
|
+
const trimmed = line.trim();
|
|
1356
|
+
if (!trimmed || trimmed.startsWith('//'))
|
|
1357
|
+
continue;
|
|
1358
|
+
if (!JAVA_HTTP_RHS_PATTERN.test(trimmed))
|
|
1359
|
+
continue;
|
|
1360
|
+
const eq = trimmed.indexOf('=');
|
|
1361
|
+
if (eq < 0)
|
|
1362
|
+
continue;
|
|
1363
|
+
const rhs = trimmed.slice(eq + 1).trim().replace(/;\s*$/, '');
|
|
1364
|
+
if (!JAVA_HTTP_RHS_PATTERN.test(rhs))
|
|
1365
|
+
continue;
|
|
1366
|
+
const lhs = trimmed.slice(0, eq).trim();
|
|
1367
|
+
const bare = JAVA_BARE_ASSIGN_LINE_RE.exec(`${lhs} = ${rhs};`);
|
|
1368
|
+
const local = bare
|
|
1369
|
+
? bare[1]
|
|
1370
|
+
: lhs.split(/\s+/).pop() ?? '';
|
|
1371
|
+
if (isSimpleJavaLocalIdent(local))
|
|
1372
|
+
seeds.add(local);
|
|
1373
|
+
}
|
|
1374
|
+
if (seeds.size === 0)
|
|
1375
|
+
return [];
|
|
1376
|
+
const derived = buildJavaTaintedVars(code, seeds);
|
|
1377
|
+
const sources = [];
|
|
1378
|
+
for (const [varName, line] of derived) {
|
|
1379
|
+
if (!varName.includes('.'))
|
|
1380
|
+
continue;
|
|
1381
|
+
const lineText = code.split('\n')[line - 1]?.trim() ?? '';
|
|
1382
|
+
const m = JAVA_LOCAL_FIELD_ASSIGN_LINE_RE.exec(lineText);
|
|
1383
|
+
if (!m)
|
|
1384
|
+
continue;
|
|
1385
|
+
const written = `${m[1]}.${m[2]}`;
|
|
1386
|
+
// Direct write or same-line alias (e.g. head.next.value after next.value = name).
|
|
1387
|
+
if (varName !== written && !varName.endsWith(`.${m[2]}`))
|
|
1388
|
+
continue;
|
|
1389
|
+
sources.push({
|
|
1390
|
+
type: 'http_param',
|
|
1391
|
+
location: `heap field read ${varName} — #1198`,
|
|
1392
|
+
severity: 'high',
|
|
1393
|
+
line,
|
|
1394
|
+
confidence: 0.8,
|
|
1395
|
+
variable: varName,
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
return sources;
|
|
1399
|
+
}
|
|
1150
1400
|
/**
|
|
1151
1401
|
* Explicit ASP.NET Core request sources (cognium-dev C#/.NET Phase-1).
|
|
1152
1402
|
*
|
|
@@ -2254,6 +2504,7 @@ function findJavaScriptAssignmentSources(sourceCode, language) {
|
|
|
2254
2504
|
// event-name allowlist to avoid firing on unrelated `.on('drain', cb)`
|
|
2255
2505
|
// / `.on('close', cb)` etc. that carry non-user-input.
|
|
2256
2506
|
sources.push(...findJavaScriptCallbackParamSources(sourceCode));
|
|
2507
|
+
sources.push(...findJavaScriptSubscribeCallbackParamSources(sourceCode));
|
|
2257
2508
|
sources.push(...findExpressDestructuredRequestSources(sourceCode));
|
|
2258
2509
|
if (language === 'javascript' || language === 'typescript') {
|
|
2259
2510
|
sources.push(...findGraphqlResolverArgSources(sourceCode));
|
|
@@ -2660,6 +2911,41 @@ function findJavaScriptCallbackParamSources(sourceCode) {
|
|
|
2660
2911
|
}
|
|
2661
2912
|
return sources;
|
|
2662
2913
|
}
|
|
2914
|
+
/**
|
|
2915
|
+
* cognium-dev #1224 — RxJS/Observable `.subscribe` callback first-parameter sources.
|
|
2916
|
+
*
|
|
2917
|
+
* Angular services return HTTP payloads through `service.method().subscribe((data) => …)`.
|
|
2918
|
+
* The first callback argument is user-influenced response body (stored-XSS shapes in Juice Shop).
|
|
2919
|
+
* Scoped to `.subscribe(` only — not every higher-order function — to avoid unrelated FPs.
|
|
2920
|
+
*/
|
|
2921
|
+
function findJavaScriptSubscribeCallbackParamSources(sourceCode) {
|
|
2922
|
+
const sources = [];
|
|
2923
|
+
const SUBSCRIBE_CB_RE = /\.subscribe\s*\(\s*(?:async\s+)?(?:function\s*\*?\s*(?:\w+\s*)?\(\s*(\w+)|\(\s*(\w+)\s*(?:[,):]|$)|(\w+)\s*=>)/;
|
|
2924
|
+
const lines = sourceCode.split('\n');
|
|
2925
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2926
|
+
const line = lines[i];
|
|
2927
|
+
const trimmed = line.trimStart();
|
|
2928
|
+
if (trimmed.startsWith('//') || trimmed.startsWith('*'))
|
|
2929
|
+
continue;
|
|
2930
|
+
const m = line.match(SUBSCRIBE_CB_RE);
|
|
2931
|
+
if (!m)
|
|
2932
|
+
continue;
|
|
2933
|
+
const paramName = m[1] ?? m[2] ?? m[3];
|
|
2934
|
+
if (!paramName)
|
|
2935
|
+
continue;
|
|
2936
|
+
if (paramName === 'err' || paramName === 'error')
|
|
2937
|
+
continue;
|
|
2938
|
+
sources.push({
|
|
2939
|
+
type: 'http_body',
|
|
2940
|
+
location: `Observable .subscribe(...) callback param '${paramName}' at line ${i + 1}`,
|
|
2941
|
+
severity: 'high',
|
|
2942
|
+
line: i + 1,
|
|
2943
|
+
confidence: 0.9,
|
|
2944
|
+
variable: paramName,
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2947
|
+
return sources;
|
|
2948
|
+
}
|
|
2663
2949
|
function findPythonAssignmentSources(sourceCode, language) {
|
|
2664
2950
|
if (language !== 'python')
|
|
2665
2951
|
return [];
|
|
@@ -4062,23 +4348,60 @@ export function buildJavaScriptTaintedVars(sourceCode, language) {
|
|
|
4062
4348
|
continue;
|
|
4063
4349
|
tainted.set(paramName, i + 1);
|
|
4064
4350
|
}
|
|
4351
|
+
// cognium-dev#582 / #490: scan every assignment on the line; #1149: skip
|
|
4352
|
+
// matches inside string literals so `WHERE name = '…'` in SQL is not a bind.
|
|
4353
|
+
const assignmentRe = /(?:(?:var|let|const)\s+(\w+)\s*:\s*[^=;]+?\s*=(?![>=])|(?:(?:var|let|const)\s+)?(\w+)\s*=)\s*/g;
|
|
4354
|
+
function isInsideStringLiteral(line, index) {
|
|
4355
|
+
let inSingle = false;
|
|
4356
|
+
let inDouble = false;
|
|
4357
|
+
let inTemplate = false;
|
|
4358
|
+
let escape = false;
|
|
4359
|
+
for (let pos = 0; pos < index; pos++) {
|
|
4360
|
+
const c = line[pos];
|
|
4361
|
+
if (escape) {
|
|
4362
|
+
escape = false;
|
|
4363
|
+
continue;
|
|
4364
|
+
}
|
|
4365
|
+
if (c === '\\') {
|
|
4366
|
+
escape = true;
|
|
4367
|
+
continue;
|
|
4368
|
+
}
|
|
4369
|
+
if (!inDouble && !inTemplate && c === "'")
|
|
4370
|
+
inSingle = !inSingle;
|
|
4371
|
+
else if (!inSingle && !inTemplate && c === '"')
|
|
4372
|
+
inDouble = !inDouble;
|
|
4373
|
+
else if (!inSingle && !inDouble && c === '`')
|
|
4374
|
+
inTemplate = !inTemplate;
|
|
4375
|
+
}
|
|
4376
|
+
return inSingle || inDouble || inTemplate;
|
|
4377
|
+
}
|
|
4065
4378
|
for (let i = 0; i < lines.length; i++) {
|
|
4066
4379
|
const line = lines[i];
|
|
4067
4380
|
const trimmed = line.trimStart();
|
|
4068
4381
|
if (trimmed.startsWith('//') || trimmed.startsWith('*'))
|
|
4069
4382
|
continue;
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4383
|
+
assignmentRe.lastIndex = 0;
|
|
4384
|
+
for (const assignmentMatch of line.matchAll(assignmentRe)) {
|
|
4385
|
+
const matchIndex = assignmentMatch.index ?? 0;
|
|
4386
|
+
if (isInsideStringLiteral(line, matchIndex))
|
|
4387
|
+
continue;
|
|
4388
|
+
const lhs = assignmentMatch[1] ?? assignmentMatch[2];
|
|
4389
|
+
if (!lhs)
|
|
4390
|
+
continue;
|
|
4391
|
+
if (['if', 'while', 'for', 'return', 'true', 'false', 'null', 'undefined', 'case'].includes(lhs)) {
|
|
4392
|
+
continue;
|
|
4393
|
+
}
|
|
4394
|
+
let rhs = line.slice(matchIndex + assignmentMatch[0].length).trim();
|
|
4395
|
+
const semi = rhs.indexOf(';');
|
|
4396
|
+
if (semi >= 0)
|
|
4397
|
+
rhs = rhs.slice(0, semi).trim();
|
|
4398
|
+
if (isConstTableLookup(rhs, lookupTables))
|
|
4399
|
+
continue; // #667
|
|
4400
|
+
const isDirectSource = JS_TAINTED_PATTERNS.some((p) => p.pattern.test(rhs));
|
|
4401
|
+
const isTaintedPropagation = tainted.size > 0 && [...tainted.keys()].some((v) => new RegExp(`\\b${v}\\b`).test(rhs));
|
|
4402
|
+
if (isDirectSource || isTaintedPropagation)
|
|
4403
|
+
tainted.set(lhs, i + 1);
|
|
4404
|
+
}
|
|
4082
4405
|
}
|
|
4083
4406
|
return tainted;
|
|
4084
4407
|
}
|
|
@@ -4294,6 +4617,27 @@ function joinWrappedJavaStatement(lines, i) {
|
|
|
4294
4617
|
* consumed by `detectExpressionScanFlows` in `taint-propagation-pass.ts`
|
|
4295
4618
|
* to synthesize a virtual source for each derived var.
|
|
4296
4619
|
*/
|
|
4620
|
+
/** Reference-RHS alias in heap-field stores (no regex — regex-lint budget). */
|
|
4621
|
+
function isSimpleJavaLocalIdent(name) {
|
|
4622
|
+
if (!name)
|
|
4623
|
+
return false;
|
|
4624
|
+
const first = name.charCodeAt(0);
|
|
4625
|
+
if (!((first >= 65 && first <= 90) ||
|
|
4626
|
+
(first >= 97 && first <= 122) ||
|
|
4627
|
+
first === 95)) {
|
|
4628
|
+
return false;
|
|
4629
|
+
}
|
|
4630
|
+
for (let i = 1; i < name.length; i++) {
|
|
4631
|
+
const ch = name.charCodeAt(i);
|
|
4632
|
+
if (!((ch >= 48 && ch <= 57) ||
|
|
4633
|
+
(ch >= 65 && ch <= 90) ||
|
|
4634
|
+
(ch >= 97 && ch <= 122) ||
|
|
4635
|
+
ch === 95)) {
|
|
4636
|
+
return false;
|
|
4637
|
+
}
|
|
4638
|
+
}
|
|
4639
|
+
return true;
|
|
4640
|
+
}
|
|
4297
4641
|
export function buildJavaTaintedVars(sourceCode, seedVars, deadBranchLines,
|
|
4298
4642
|
/**
|
|
4299
4643
|
* `trackSlots` (cognium-dev#913/#914/#916/#917): follow which element of a list
|
|
@@ -4353,6 +4697,29 @@ options) {
|
|
|
4353
4697
|
complexTaintedRes.push(new RegExp(`(?<![\\p{L}\\p{N}_])${esc}(?![\\p{L}\\p{N}_])`, 'u'));
|
|
4354
4698
|
}
|
|
4355
4699
|
}
|
|
4700
|
+
/** cognium-dev#1198 — `head.next = next` reference alias for heap field reads. */
|
|
4701
|
+
const localRefAlias = new Map();
|
|
4702
|
+
const markQualifiedFieldTainted = (qualified, lineNo) => {
|
|
4703
|
+
if (knownTainted.has(qualified))
|
|
4704
|
+
return;
|
|
4705
|
+
derived.set(qualified, lineNo);
|
|
4706
|
+
knownTainted.add(qualified);
|
|
4707
|
+
if (!/^[\p{L}\p{N}_]+$/u.test(qualified)) {
|
|
4708
|
+
const esc = qualified.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
4709
|
+
complexTaintedRes.push(new RegExp(`(?<![\\p{L}\\p{N}_])${esc}(?![\\p{L}\\p{N}_])`, 'u'));
|
|
4710
|
+
}
|
|
4711
|
+
changed = true;
|
|
4712
|
+
const dot = qualified.lastIndexOf('.');
|
|
4713
|
+
if (dot <= 0)
|
|
4714
|
+
return;
|
|
4715
|
+
const recv = qualified.slice(0, dot);
|
|
4716
|
+
const field = qualified.slice(dot + 1);
|
|
4717
|
+
for (const [aliasPath, targetLocal] of localRefAlias) {
|
|
4718
|
+
if (targetLocal !== recv)
|
|
4719
|
+
continue;
|
|
4720
|
+
markQualifiedFieldTainted(`${aliasPath}.${field}`, lineNo);
|
|
4721
|
+
}
|
|
4722
|
+
};
|
|
4356
4723
|
let changed = true;
|
|
4357
4724
|
let guard = 0;
|
|
4358
4725
|
while (changed && guard < lines.length + 2) {
|
|
@@ -4406,6 +4773,39 @@ options) {
|
|
|
4406
4773
|
}
|
|
4407
4774
|
continue;
|
|
4408
4775
|
}
|
|
4776
|
+
const thisFieldListAddRe = /^\s*this\.([A-Za-z_]\w*)\.add\s*\(/;
|
|
4777
|
+
const thisListAdd = thisFieldListAddRe.exec(line);
|
|
4778
|
+
if (thisListAdd) {
|
|
4779
|
+
const field = thisListAdd[1];
|
|
4780
|
+
const argMatch = /this\.\w+\.add\s*\(\s*([^)]+)\)/.exec(line);
|
|
4781
|
+
if (argMatch) {
|
|
4782
|
+
const argCode = argMatch[1]
|
|
4783
|
+
.replace(/@?"(?:[^"\\]|\\.)*"/g, ' ')
|
|
4784
|
+
.replace(/'(?:[^'\\]|\\.)'/g, ' ');
|
|
4785
|
+
const idents = argCode.match(/[\p{L}\p{N}_]+/gu);
|
|
4786
|
+
const ref = (idents !== null && idents.some(t => knownTainted.has(t))) ||
|
|
4787
|
+
(complexTaintedRes.length > 0 && complexTaintedRes.some(re => re.test(argCode)));
|
|
4788
|
+
if (ref) {
|
|
4789
|
+
const aliases = [field, `this.${field}`];
|
|
4790
|
+
for (const name of aliases) {
|
|
4791
|
+
if (!knownTainted.has(name)) {
|
|
4792
|
+
derived.set(name, i + 1);
|
|
4793
|
+
knownTainted.add(name);
|
|
4794
|
+
changed = true;
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
continue;
|
|
4800
|
+
}
|
|
4801
|
+
const addAllRe = /^\s*([A-Za-z_]\w*)\.addAll\s*\(\s*([A-Za-z_]\w*)\s*\)\s*;?\s*$/;
|
|
4802
|
+
const addAllMatch = addAllRe.exec(line.trimEnd());
|
|
4803
|
+
if (addAllMatch && knownTainted.has(addAllMatch[2]) && !knownTainted.has(addAllMatch[1])) {
|
|
4804
|
+
derived.set(addAllMatch[1], i + 1);
|
|
4805
|
+
knownTainted.add(addAllMatch[1]);
|
|
4806
|
+
changed = true;
|
|
4807
|
+
continue;
|
|
4808
|
+
}
|
|
4409
4809
|
let statement = line;
|
|
4410
4810
|
let declMatch = declRe.exec(statement);
|
|
4411
4811
|
let assignMatch = !declMatch ? assignRe.exec(statement) : null;
|
|
@@ -4472,6 +4872,29 @@ options) {
|
|
|
4472
4872
|
}
|
|
4473
4873
|
continue;
|
|
4474
4874
|
}
|
|
4875
|
+
const localFieldMatch = JAVA_LOCAL_FIELD_ASSIGN_LINE_RE.exec(statement.trim());
|
|
4876
|
+
if (localFieldMatch) {
|
|
4877
|
+
const recv = localFieldMatch[1];
|
|
4878
|
+
const field = localFieldMatch[2];
|
|
4879
|
+
const rhs = localFieldMatch[3];
|
|
4880
|
+
const qualified = `${recv}.${field}`;
|
|
4881
|
+
const rhsTrim = rhs.trim();
|
|
4882
|
+
if (isSimpleJavaLocalIdent(rhsTrim) &&
|
|
4883
|
+
!JAVA_KEYWORDS.has(rhsTrim)) {
|
|
4884
|
+
localRefAlias.set(qualified, rhsTrim);
|
|
4885
|
+
}
|
|
4886
|
+
const rhsCode = rhs
|
|
4887
|
+
.replace(/\$@?"(?:[^"\\]|\\.)*"/g, lit => ' ' + [...lit.matchAll(/\{([^}]*)\}/g)].map(x => x[1]).join(' ') + ' ')
|
|
4888
|
+
.replace(/@?"(?:[^"\\]|\\.)*"/g, ' ')
|
|
4889
|
+
.replace(/'(?:[^'\\]|\\.)'/g, ' ');
|
|
4890
|
+
const rhsIdents = rhsCode.match(/[\p{L}\p{N}_]+/gu);
|
|
4891
|
+
const ref = (rhsIdents !== null && rhsIdents.some(t => knownTainted.has(t))) ||
|
|
4892
|
+
(complexTaintedRes.length > 0 && complexTaintedRes.some(re => re.test(rhsCode)));
|
|
4893
|
+
if (ref) {
|
|
4894
|
+
markQualifiedFieldTainted(qualified, i + 1);
|
|
4895
|
+
}
|
|
4896
|
+
continue;
|
|
4897
|
+
}
|
|
4475
4898
|
const m = declMatch ?? assignMatch;
|
|
4476
4899
|
if (!m)
|
|
4477
4900
|
continue;
|
|
@@ -5403,7 +5826,7 @@ function findGoMapAllowlistGuardSanitizers(code) {
|
|
|
5403
5826
|
// (`if err != nil || !<mapName>[u.Host] {`, #293): the block runs when any
|
|
5404
5827
|
// disjunct holds, so falling past it proves the key is in the map. The key
|
|
5405
5828
|
// may be a selector (`u.Host`). Captures the map identifier in group 1.
|
|
5406
|
-
const guardOpen = /^\s*if\s+(?:[^{&|]
|
|
5829
|
+
const guardOpen = /^\s*if\s+(?:[^{&|]+\|\|)*\s*!\s*([A-Za-z_][A-Za-z0-9_]*)\s*\[\s*[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)?\s*\]\s*(?:\|\|[^{&]+)?\{/;
|
|
5407
5830
|
// Allow-list naming heuristic.
|
|
5408
5831
|
const allowlistName = /^(?:[A-Z][A-Z0-9_]+|.*?(allowed|accepted|whitelist|permitted|valid|approved).*)$/i;
|
|
5409
5832
|
for (let i = 0; i < lines.length; i++) {
|