cognium-dev 4.9.20 → 4.9.22
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 +181 -81
- package/package.json +10 -7
package/dist/cli.js
CHANGED
|
@@ -113,44 +113,65 @@ function setModule(module2) {
|
|
|
113
113
|
}
|
|
114
114
|
__name(setModule, "setModule");
|
|
115
115
|
var C;
|
|
116
|
+
function newFinalizer(handler) {
|
|
117
|
+
try {
|
|
118
|
+
return new FinalizationRegistry(handler);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.error("Unsupported FinalizationRegistry:", e);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
__name(newFinalizer, "newFinalizer");
|
|
125
|
+
var finalizer = newFinalizer((address) => {
|
|
126
|
+
C._ts_lookahead_iterator_delete(address);
|
|
127
|
+
});
|
|
116
128
|
var LookaheadIterator = class {
|
|
117
129
|
static {
|
|
118
130
|
__name(this, "LookaheadIterator");
|
|
119
131
|
}
|
|
120
132
|
[0] = 0;
|
|
121
133
|
language;
|
|
134
|
+
positioned = false;
|
|
122
135
|
constructor(internal, address, language) {
|
|
123
136
|
assertInternal(internal);
|
|
124
137
|
this[0] = address;
|
|
125
138
|
this.language = language;
|
|
139
|
+
finalizer?.register(this, address, this);
|
|
126
140
|
}
|
|
127
141
|
get currentTypeId() {
|
|
128
|
-
return C._ts_lookahead_iterator_current_symbol(this[0]);
|
|
142
|
+
return this.positioned ? C._ts_lookahead_iterator_current_symbol(this[0]) : null;
|
|
129
143
|
}
|
|
130
144
|
get currentType() {
|
|
131
|
-
|
|
145
|
+
const id = this.currentTypeId;
|
|
146
|
+
if (id === null)
|
|
147
|
+
return null;
|
|
148
|
+
return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
|
|
132
149
|
}
|
|
133
150
|
delete() {
|
|
151
|
+
finalizer?.unregister(this);
|
|
134
152
|
C._ts_lookahead_iterator_delete(this[0]);
|
|
135
153
|
this[0] = 0;
|
|
136
154
|
}
|
|
137
155
|
reset(language, stateId) {
|
|
138
156
|
if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
|
|
139
157
|
this.language = language;
|
|
158
|
+
this.positioned = false;
|
|
140
159
|
return true;
|
|
141
160
|
}
|
|
142
161
|
return false;
|
|
143
162
|
}
|
|
144
163
|
resetState(stateId) {
|
|
145
|
-
|
|
164
|
+
if (!C._ts_lookahead_iterator_reset_state(this[0], stateId))
|
|
165
|
+
return false;
|
|
166
|
+
this.positioned = false;
|
|
167
|
+
return true;
|
|
146
168
|
}
|
|
147
169
|
[Symbol.iterator]() {
|
|
148
170
|
return {
|
|
149
171
|
next: /* @__PURE__ */ __name(() => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
return { done: true, value: "" };
|
|
172
|
+
this.positioned = Boolean(C._ts_lookahead_iterator_next(this[0]));
|
|
173
|
+
const value = this.currentType;
|
|
174
|
+
return value === null ? { done: true, value: "" } : { done: false, value };
|
|
154
175
|
}, "next")
|
|
155
176
|
};
|
|
156
177
|
}
|
|
@@ -176,6 +197,9 @@ function getText(tree, startIndex, endIndex, startPosition) {
|
|
|
176
197
|
return result ?? "";
|
|
177
198
|
}
|
|
178
199
|
__name(getText, "getText");
|
|
200
|
+
var finalizer2 = newFinalizer((address) => {
|
|
201
|
+
C._ts_tree_delete(address);
|
|
202
|
+
});
|
|
179
203
|
var Tree = class _Tree {
|
|
180
204
|
static {
|
|
181
205
|
__name(this, "Tree");
|
|
@@ -188,12 +212,14 @@ var Tree = class _Tree {
|
|
|
188
212
|
this[0] = address;
|
|
189
213
|
this.language = language;
|
|
190
214
|
this.textCallback = textCallback;
|
|
215
|
+
finalizer2?.register(this, address, this);
|
|
191
216
|
}
|
|
192
217
|
copy() {
|
|
193
218
|
const address = C._ts_tree_copy(this[0]);
|
|
194
219
|
return new _Tree(INTERNAL, address, this.language, this.textCallback);
|
|
195
220
|
}
|
|
196
221
|
delete() {
|
|
222
|
+
finalizer2?.unregister(this);
|
|
197
223
|
C._ts_tree_delete(this[0]);
|
|
198
224
|
this[0] = 0;
|
|
199
225
|
}
|
|
@@ -249,6 +275,9 @@ var Tree = class _Tree {
|
|
|
249
275
|
return result;
|
|
250
276
|
}
|
|
251
277
|
};
|
|
278
|
+
var finalizer3 = newFinalizer((address) => {
|
|
279
|
+
C._ts_tree_cursor_delete_wasm(address);
|
|
280
|
+
});
|
|
252
281
|
var TreeCursor = class _TreeCursor {
|
|
253
282
|
static {
|
|
254
283
|
__name(this, "TreeCursor");
|
|
@@ -262,6 +291,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
262
291
|
assertInternal(internal);
|
|
263
292
|
this.tree = tree;
|
|
264
293
|
unmarshalTreeCursor(this);
|
|
294
|
+
finalizer3?.register(this, this.tree[0], this);
|
|
265
295
|
}
|
|
266
296
|
copy() {
|
|
267
297
|
const copy = new _TreeCursor(INTERNAL, this.tree);
|
|
@@ -270,6 +300,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
270
300
|
return copy;
|
|
271
301
|
}
|
|
272
302
|
delete() {
|
|
303
|
+
finalizer3?.unregister(this);
|
|
273
304
|
marshalTreeCursor(this);
|
|
274
305
|
C._ts_tree_cursor_delete_wasm(this.tree[0]);
|
|
275
306
|
this[0] = this[1] = this[2] = 0;
|
|
@@ -1029,16 +1060,23 @@ ${body2}`);
|
|
|
1029
1060
|
}
|
|
1030
1061
|
}
|
|
1031
1062
|
const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
|
|
1063
|
+
return _Language.loadFromWasmExports(mod, { sync: false });
|
|
1064
|
+
}
|
|
1065
|
+
static loadFromWasmExports(mod, { sync }) {
|
|
1032
1066
|
const symbolNames = Object.keys(mod);
|
|
1033
1067
|
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
1034
1068
|
if (!functionName) {
|
|
1035
1069
|
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
1036
1070
|
${JSON.stringify(symbolNames, null, 2)}`);
|
|
1037
|
-
throw new Error("
|
|
1071
|
+
throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
|
|
1038
1072
|
}
|
|
1039
1073
|
const languageAddress = mod[functionName]();
|
|
1040
1074
|
return new _Language(INTERNAL, languageAddress);
|
|
1041
1075
|
}
|
|
1076
|
+
static loadSync(wasmModule) {
|
|
1077
|
+
const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
|
|
1078
|
+
return _Language.loadFromWasmExports(mod, { sync: true });
|
|
1079
|
+
}
|
|
1042
1080
|
};
|
|
1043
1081
|
async function Module2(moduleArg = {}) {
|
|
1044
1082
|
var moduleRtn;
|
|
@@ -1558,7 +1596,7 @@ async function Module2(moduleArg = {}) {
|
|
|
1558
1596
|
newDSO("__main__", 0, wasmImports);
|
|
1559
1597
|
}
|
|
1560
1598
|
};
|
|
1561
|
-
var ___heap_base =
|
|
1599
|
+
var ___heap_base = 82240;
|
|
1562
1600
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
1563
1601
|
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
1564
1602
|
if (runtimeInitialized) {
|
|
@@ -2084,12 +2122,12 @@ async function Module2(moduleArg = {}) {
|
|
|
2084
2122
|
value: "i32",
|
|
2085
2123
|
mutable: false
|
|
2086
2124
|
}, 1024);
|
|
2087
|
-
var ___stack_high =
|
|
2088
|
-
var ___stack_low =
|
|
2125
|
+
var ___stack_high = 82240;
|
|
2126
|
+
var ___stack_low = 16704;
|
|
2089
2127
|
var ___stack_pointer = new WebAssembly.Global({
|
|
2090
2128
|
value: "i32",
|
|
2091
2129
|
mutable: true
|
|
2092
|
-
},
|
|
2130
|
+
}, 82240);
|
|
2093
2131
|
var ___table_base = new WebAssembly.Global({
|
|
2094
2132
|
value: "i32",
|
|
2095
2133
|
mutable: false
|
|
@@ -2356,7 +2394,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2356
2394
|
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
2357
2395
|
Module["LE_HEAP_STORE_I64"] = LE_HEAP_STORE_I64;
|
|
2358
2396
|
var ASM_CONSTS = {};
|
|
2359
|
-
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
2397
|
+
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_copy, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswpunct, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
2360
2398
|
function assignWasmExports(wasmExports2) {
|
|
2361
2399
|
Module["_malloc"] = _malloc = wasmExports2["malloc"];
|
|
2362
2400
|
Module["_calloc"] = _calloc = wasmExports2["calloc"];
|
|
@@ -2390,6 +2428,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2390
2428
|
Module["_ts_query_delete"] = _ts_query_delete = wasmExports2["ts_query_delete"];
|
|
2391
2429
|
Module["_iswspace"] = _iswspace = wasmExports2["iswspace"];
|
|
2392
2430
|
Module["_iswalnum"] = _iswalnum = wasmExports2["iswalnum"];
|
|
2431
|
+
Module["_ts_query_copy"] = _ts_query_copy = wasmExports2["ts_query_copy"];
|
|
2393
2432
|
Module["_ts_query_pattern_count"] = _ts_query_pattern_count = wasmExports2["ts_query_pattern_count"];
|
|
2394
2433
|
Module["_ts_query_capture_count"] = _ts_query_capture_count = wasmExports2["ts_query_capture_count"];
|
|
2395
2434
|
Module["_ts_query_string_count"] = _ts_query_string_count = wasmExports2["ts_query_string_count"];
|
|
@@ -2495,6 +2534,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2495
2534
|
Module["_iswblank"] = _iswblank = wasmExports2["iswblank"];
|
|
2496
2535
|
Module["_iswdigit"] = _iswdigit = wasmExports2["iswdigit"];
|
|
2497
2536
|
Module["_iswlower"] = _iswlower = wasmExports2["iswlower"];
|
|
2537
|
+
Module["_iswpunct"] = _iswpunct = wasmExports2["iswpunct"];
|
|
2498
2538
|
Module["_iswupper"] = _iswupper = wasmExports2["iswupper"];
|
|
2499
2539
|
Module["_iswxdigit"] = _iswxdigit = wasmExports2["iswxdigit"];
|
|
2500
2540
|
Module["_memchr"] = _memchr = wasmExports2["memchr"];
|
|
@@ -2614,6 +2654,10 @@ __name(checkModule, "checkModule");
|
|
|
2614
2654
|
var TRANSFER_BUFFER;
|
|
2615
2655
|
var LANGUAGE_VERSION;
|
|
2616
2656
|
var MIN_COMPATIBLE_VERSION;
|
|
2657
|
+
var finalizer4 = newFinalizer((addresses) => {
|
|
2658
|
+
C._ts_parser_delete(addresses[0]);
|
|
2659
|
+
C._free(addresses[1]);
|
|
2660
|
+
});
|
|
2617
2661
|
var Parser = class {
|
|
2618
2662
|
static {
|
|
2619
2663
|
__name(this, "Parser");
|
|
@@ -2630,6 +2674,7 @@ var Parser = class {
|
|
|
2630
2674
|
}
|
|
2631
2675
|
constructor() {
|
|
2632
2676
|
this.initialize();
|
|
2677
|
+
finalizer4?.register(this, [this[0], this[1]], this);
|
|
2633
2678
|
}
|
|
2634
2679
|
initialize() {
|
|
2635
2680
|
if (!checkModule()) {
|
|
@@ -2640,6 +2685,7 @@ var Parser = class {
|
|
|
2640
2685
|
this[1] = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
2641
2686
|
}
|
|
2642
2687
|
delete() {
|
|
2688
|
+
finalizer4?.unregister(this);
|
|
2643
2689
|
C._ts_parser_delete(this[0]);
|
|
2644
2690
|
C._free(this[1]);
|
|
2645
2691
|
this[0] = 0;
|
|
@@ -2770,6 +2816,10 @@ var QueryError = class _QueryError extends Error {
|
|
|
2770
2816
|
this.length = length;
|
|
2771
2817
|
this.name = "QueryError";
|
|
2772
2818
|
}
|
|
2819
|
+
kind;
|
|
2820
|
+
info;
|
|
2821
|
+
index;
|
|
2822
|
+
length;
|
|
2773
2823
|
static {
|
|
2774
2824
|
__name(this, "QueryError");
|
|
2775
2825
|
}
|
|
@@ -2953,6 +3003,9 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
|
|
|
2953
3003
|
}
|
|
2954
3004
|
}
|
|
2955
3005
|
__name(parsePattern, "parsePattern");
|
|
3006
|
+
var finalizer5 = newFinalizer((address) => {
|
|
3007
|
+
C._ts_query_delete(address);
|
|
3008
|
+
});
|
|
2956
3009
|
var Query = class {
|
|
2957
3010
|
static {
|
|
2958
3011
|
__name(this, "Query");
|
|
@@ -3052,8 +3105,10 @@ var Query = class {
|
|
|
3052
3105
|
this.assertedProperties = assertedProperties;
|
|
3053
3106
|
this.refutedProperties = refutedProperties;
|
|
3054
3107
|
this.exceededMatchLimit = false;
|
|
3108
|
+
finalizer5?.register(this, address, this);
|
|
3055
3109
|
}
|
|
3056
3110
|
delete() {
|
|
3111
|
+
finalizer5?.unregister(this);
|
|
3057
3112
|
C._ts_query_delete(this[0]);
|
|
3058
3113
|
this[0] = 0;
|
|
3059
3114
|
}
|
|
@@ -8583,7 +8638,7 @@ function buildBashCFG(tree, startId, cache) {
|
|
|
8583
8638
|
allEdges.push({ from: entryBlock.id, to: firstBlockId, type: "sequential" });
|
|
8584
8639
|
}
|
|
8585
8640
|
const exitBlock = {
|
|
8586
|
-
id: blockIdCounter
|
|
8641
|
+
id: blockIdCounter,
|
|
8587
8642
|
type: "exit",
|
|
8588
8643
|
start_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1,
|
|
8589
8644
|
end_line: topLevelStatements[topLevelStatements.length - 1].endPosition.row + 1
|
|
@@ -8701,7 +8756,7 @@ function buildGoCFG(tree, blockIdCounter, cache) {
|
|
|
8701
8756
|
const hasTopLevelDecls = tree.rootNode.children.some((c) => c !== null && isGoStatement(c));
|
|
8702
8757
|
if (hasTopLevelDecls) {
|
|
8703
8758
|
const block = {
|
|
8704
|
-
id: blockIdCounter
|
|
8759
|
+
id: blockIdCounter,
|
|
8705
8760
|
type: "normal",
|
|
8706
8761
|
start_line: 1,
|
|
8707
8762
|
end_line: tree.rootNode.endPosition.row + 1
|
|
@@ -9746,7 +9801,7 @@ function buildRustDFG(tree, cache) {
|
|
|
9746
9801
|
const defs = [];
|
|
9747
9802
|
const uses = [];
|
|
9748
9803
|
let defIdCounter = 1;
|
|
9749
|
-
|
|
9804
|
+
const useIdCounter = 1;
|
|
9750
9805
|
const scopeStack = [new Map];
|
|
9751
9806
|
const functions = findNodes(tree.rootNode, "function_item");
|
|
9752
9807
|
for (const func2 of functions) {
|
|
@@ -10663,7 +10718,7 @@ function parsePythonDecorator(dec) {
|
|
|
10663
10718
|
if (!fnNode)
|
|
10664
10719
|
return null;
|
|
10665
10720
|
let receiver = "";
|
|
10666
|
-
let method
|
|
10721
|
+
let method;
|
|
10667
10722
|
if (fnNode.type === "identifier") {
|
|
10668
10723
|
method = getNodeText(fnNode);
|
|
10669
10724
|
} else if (fnNode.type === "attribute") {
|
|
@@ -10733,7 +10788,7 @@ function classifyPythonDecorator(receiver, method, imp) {
|
|
|
10733
10788
|
if (receiver && PY_HTTP_ROUTE_METHODS.has(method)) {
|
|
10734
10789
|
const isRoutey = isPyRouterReceiver(receiver);
|
|
10735
10790
|
if (isRoutey) {
|
|
10736
|
-
let framework
|
|
10791
|
+
let framework;
|
|
10737
10792
|
if (imp.hasFlask)
|
|
10738
10793
|
framework = "flask";
|
|
10739
10794
|
else if (imp.hasFastApi)
|
|
@@ -19859,7 +19914,7 @@ class ConstantPropagator {
|
|
|
19859
19914
|
}
|
|
19860
19915
|
}
|
|
19861
19916
|
const startIdx = matchingIdx >= 0 ? matchingIdx : defaultIdx;
|
|
19862
|
-
for (let i2 = 0;i2 < startIdx
|
|
19917
|
+
for (let i2 = 0;i2 < startIdx; i2++) {
|
|
19863
19918
|
this.markUnreachable(caseGroups[i2]);
|
|
19864
19919
|
}
|
|
19865
19920
|
if (startIdx >= 0) {
|
|
@@ -24549,16 +24604,22 @@ class CSharpPlugin extends BaseLanguagePlugin {
|
|
|
24549
24604
|
}
|
|
24550
24605
|
|
|
24551
24606
|
// ../circle-ir/dist/languages/plugins/index.js
|
|
24607
|
+
function createBuiltinPlugins() {
|
|
24608
|
+
return [
|
|
24609
|
+
new JavaPlugin,
|
|
24610
|
+
new JavaScriptPlugin,
|
|
24611
|
+
new PythonPlugin,
|
|
24612
|
+
new RustPlugin,
|
|
24613
|
+
new BashPlugin,
|
|
24614
|
+
new HtmlPlugin,
|
|
24615
|
+
new VuePlugin,
|
|
24616
|
+
new GoPlugin,
|
|
24617
|
+
new CSharpPlugin
|
|
24618
|
+
];
|
|
24619
|
+
}
|
|
24552
24620
|
function registerBuiltinPlugins() {
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
registerLanguage(new PythonPlugin);
|
|
24556
|
-
registerLanguage(new RustPlugin);
|
|
24557
|
-
registerLanguage(new BashPlugin);
|
|
24558
|
-
registerLanguage(new HtmlPlugin);
|
|
24559
|
-
registerLanguage(new VuePlugin);
|
|
24560
|
-
registerLanguage(new GoPlugin);
|
|
24561
|
-
registerLanguage(new CSharpPlugin);
|
|
24621
|
+
for (const plugin of createBuiltinPlugins())
|
|
24622
|
+
registerLanguage(plugin);
|
|
24562
24623
|
}
|
|
24563
24624
|
// ../circle-ir/dist/analysis/passes/cross-file-pass.js
|
|
24564
24625
|
class CrossFilePass {
|
|
@@ -24572,7 +24633,7 @@ class CrossFilePass {
|
|
|
24572
24633
|
const phase1Start = Date.now();
|
|
24573
24634
|
logger.debug("cross-file: phase 1/4 starting (findCrossFileTaintFlows)");
|
|
24574
24635
|
const flows = resolver.findCrossFileTaintFlows(budgetExceeded);
|
|
24575
|
-
|
|
24636
|
+
const phase1Truncated = budgetExceeded();
|
|
24576
24637
|
logger.info("cross-file: phase 1/4 done", {
|
|
24577
24638
|
flows: flows.length,
|
|
24578
24639
|
elapsedMs: Date.now() - phase1Start
|
|
@@ -28180,17 +28241,14 @@ function findPythonRegexAllowlistWrapperSanitizers(code) {
|
|
|
28180
28241
|
const argName = m[3];
|
|
28181
28242
|
let foundGuard = false;
|
|
28182
28243
|
let returnsArg = false;
|
|
28183
|
-
let blockEnd = -1;
|
|
28184
28244
|
const maxScan = Math.min(lines.length, i2 + 40);
|
|
28185
28245
|
for (let j = i2 + 1;j < maxScan; j++) {
|
|
28186
28246
|
const line = lines[j];
|
|
28187
28247
|
if (line.trim() === "")
|
|
28188
28248
|
continue;
|
|
28189
28249
|
const indent = line.length - line.trimStart().length;
|
|
28190
|
-
if (indent <= defIndent)
|
|
28191
|
-
blockEnd = j - 1;
|
|
28250
|
+
if (indent <= defIndent)
|
|
28192
28251
|
break;
|
|
28193
|
-
}
|
|
28194
28252
|
if (!foundGuard) {
|
|
28195
28253
|
const guard = new RegExp(`if\\s+not\\s+re\\.(?:fullmatch|match)\\s*\\(\\s*(${tightRegex.source})\\s*,\\s*${argName}\\s*\\)\\s*:`);
|
|
28196
28254
|
if (guard.test(line)) {
|
|
@@ -28211,8 +28269,6 @@ function findPythonRegexAllowlistWrapperSanitizers(code) {
|
|
|
28211
28269
|
returnsArg = true;
|
|
28212
28270
|
}
|
|
28213
28271
|
}
|
|
28214
|
-
if (blockEnd === -1)
|
|
28215
|
-
blockEnd = Math.min(lines.length - 1, i2 + 39);
|
|
28216
28272
|
if (!foundGuard || !returnsArg)
|
|
28217
28273
|
continue;
|
|
28218
28274
|
wrappers.push({ name: wrapperName, defLine: i2, defIndent });
|
|
@@ -31261,7 +31317,7 @@ function findRustEvalCrateCodeInjectionFindings(code, file) {
|
|
|
31261
31317
|
continue;
|
|
31262
31318
|
if (arg.length === 0)
|
|
31263
31319
|
continue;
|
|
31264
|
-
|
|
31320
|
+
const unwrapped = arg.replace(/^&\s*/, "").trim();
|
|
31265
31321
|
if (/^"[^"]*"$/.test(unwrapped))
|
|
31266
31322
|
continue;
|
|
31267
31323
|
let tainted = false;
|
|
@@ -31948,7 +32004,7 @@ function findJsLdapInjectionFindings(code, file) {
|
|
|
31948
32004
|
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
31949
32005
|
const line = lines[i2];
|
|
31950
32006
|
const fm = line.match(filterPropRe);
|
|
31951
|
-
let expr
|
|
32007
|
+
let expr;
|
|
31952
32008
|
if (fm) {
|
|
31953
32009
|
expr = fm[1].trim();
|
|
31954
32010
|
} else if (filterShorthandRe.test(line)) {
|
|
@@ -34714,7 +34770,7 @@ class SinkFilterPass {
|
|
|
34714
34770
|
if (/^-?\d+$/.test(t) || /^"(?:[^"\\]|\\.)*"$/.test(t) || /^'(?:[^'\\]|\\.)*'$/.test(t)) {
|
|
34715
34771
|
continue;
|
|
34716
34772
|
}
|
|
34717
|
-
let helperName
|
|
34773
|
+
let helperName;
|
|
34718
34774
|
const directCall = t.match(/^([A-Za-z_]\w*)\s*\(/);
|
|
34719
34775
|
if (directCall) {
|
|
34720
34776
|
helperName = directCall[1] ?? null;
|
|
@@ -40847,7 +40903,7 @@ function buildSourceCoveredRanges(codeLines, language) {
|
|
|
40847
40903
|
function buildJsCoveredRanges(codeLines) {
|
|
40848
40904
|
const ranges = [];
|
|
40849
40905
|
const tryStack = [];
|
|
40850
|
-
|
|
40906
|
+
const braceDepthAtTry = [];
|
|
40851
40907
|
let braceDepth = 0;
|
|
40852
40908
|
for (let i2 = 0;i2 < codeLines.length; i2++) {
|
|
40853
40909
|
const line = codeLines[i2];
|
|
@@ -40921,10 +40977,6 @@ class UnhandledExceptionPass {
|
|
|
40921
40977
|
coveredRanges.push(range);
|
|
40922
40978
|
}
|
|
40923
40979
|
}
|
|
40924
|
-
const catchStarts = new Set(exGraph.pairs.map((p) => p.catchBlock.start_line));
|
|
40925
|
-
for (const range of coveredRanges) {
|
|
40926
|
-
catchStarts.add(range.end + 1);
|
|
40927
|
-
}
|
|
40928
40980
|
const throwRe = language === "python" ? PYTHON_RAISE_RE : JS_THROW_RE;
|
|
40929
40981
|
const unhandled = [];
|
|
40930
40982
|
const reportedMethods = new Set;
|
|
@@ -40933,13 +40985,6 @@ class UnhandledExceptionPass {
|
|
|
40933
40985
|
if (!throwRe.test(lineText))
|
|
40934
40986
|
continue;
|
|
40935
40987
|
let inCatch = false;
|
|
40936
|
-
for (const cs of catchStarts) {
|
|
40937
|
-
if (ln >= cs) {
|
|
40938
|
-
inCatch = true;
|
|
40939
|
-
break;
|
|
40940
|
-
}
|
|
40941
|
-
}
|
|
40942
|
-
inCatch = false;
|
|
40943
40988
|
for (const pair of exGraph.pairs) {
|
|
40944
40989
|
if (ln >= pair.catchBlock.start_line) {
|
|
40945
40990
|
const mThrow = graph.methodAtLine(ln);
|
|
@@ -46952,6 +46997,8 @@ var JAVA_XML_OUTPUT_ONLY_RE = /\bnew\s+(?:DOMSource|StreamResult)\s*\(/;
|
|
|
46952
46997
|
var JAVA_XML_PARSE_INPUT_RE = /\bnew\s+(?:StreamSource|SAXSource|InputSource)\s*\(/;
|
|
46953
46998
|
var JAVA_DOC_BUILDER_NEW_DOCUMENT_RE = /\.\s*newDocument\s*\(\s*\)/;
|
|
46954
46999
|
var JAVA_DOC_BUILDER_PARSE_RE = /(?:DocumentBuilder|builder)\s*\.\s*parse\s*\(/;
|
|
47000
|
+
var JAVA_HARDENING_SETTER_RE = /\.\s*(?:setFeature|setAttribute|setProperty|setXIncludeAware|setExpandEntityReferences)\s*\(/;
|
|
47001
|
+
var JAVA_FACTORY_CHAINED_RE = /\bnewInstance\s*\([^()]*\)\s*\.\s*(?:newDocumentBuilder|newSAXParser|newTransformer|newTemplates|newSchema|createXMLStreamReader|createXMLEventReader)\s*\(/;
|
|
46955
47002
|
var PY_LXML_PARSER_INSECURE_DEFAULT_RE = /\bresolve_entities\s*=\s*False\b/;
|
|
46956
47003
|
|
|
46957
47004
|
class XmlEntityExpansionPass {
|
|
@@ -46964,8 +47011,10 @@ class XmlEntityExpansionPass {
|
|
|
46964
47011
|
const code = ctx.code ?? "";
|
|
46965
47012
|
if (language === "java") {
|
|
46966
47013
|
const safeInFile = JAVA_SAFE_EVIDENCE_RE.test(code);
|
|
46967
|
-
|
|
46968
|
-
|
|
47014
|
+
const processWide = safeInFile && /jdk\.xml\./.test(code);
|
|
47015
|
+
const lines = safeInFile ? code.split(`
|
|
47016
|
+
`) : [];
|
|
47017
|
+
const methodRanges = safeInFile ? this.methodRanges(graph.ir.types) : [];
|
|
46969
47018
|
const isXmlOutputOnly = JAVA_XML_OUTPUT_ONLY_RE.test(code) && !JAVA_XML_PARSE_INPUT_RE.test(code);
|
|
46970
47019
|
const isDocumentBuilderEmptyOnly = JAVA_DOC_BUILDER_NEW_DOCUMENT_RE.test(code) && !JAVA_DOC_BUILDER_PARSE_RE.test(code);
|
|
46971
47020
|
for (const call of graph.ir.calls) {
|
|
@@ -46977,6 +47026,8 @@ class XmlEntityExpansionPass {
|
|
|
46977
47026
|
if (det.api === "DocumentBuilderFactory" && isDocumentBuilderEmptyOnly)
|
|
46978
47027
|
continue;
|
|
46979
47028
|
const line = call.location.line;
|
|
47029
|
+
if (safeInFile && (processWide || !this.isProvablyUnhardened(lines, line, methodRanges, det.api)))
|
|
47030
|
+
continue;
|
|
46980
47031
|
findings.push({ line, language, ...det });
|
|
46981
47032
|
ctx.addFinding({
|
|
46982
47033
|
id: `${this.name}-${file}-${line}-${det.api}`,
|
|
@@ -46986,11 +47037,11 @@ class XmlEntityExpansionPass {
|
|
|
46986
47037
|
cwe: det.cwe,
|
|
46987
47038
|
severity: "high",
|
|
46988
47039
|
level: "error",
|
|
46989
|
-
message: `${det.api} created without disabling DTD / external-entity ` + "processing. Vulnerable to
|
|
47040
|
+
message: `${det.api} created without disabling DTD / external-entity ` + "processing. Vulnerable to external-entity disclosure " + "(CWE-611) and billion-laughs / quadratic blow-up DoS " + '(CWE-776). Add `setFeature("http://apache.org/xml/features/' + 'disallow-doctype-decl", true)` (or the equivalent) before ' + "parsing.",
|
|
46990
47041
|
file,
|
|
46991
47042
|
line,
|
|
46992
47043
|
fix: this.fixForJava(det.api),
|
|
46993
|
-
evidence: { ...det, language, safeFeatureInFile:
|
|
47044
|
+
evidence: { ...det, language, safeFeatureInFile: safeInFile }
|
|
46994
47045
|
});
|
|
46995
47046
|
}
|
|
46996
47047
|
return { findings };
|
|
@@ -47013,7 +47064,7 @@ class XmlEntityExpansionPass {
|
|
|
47013
47064
|
cwe: det.cwe,
|
|
47014
47065
|
severity: "high",
|
|
47015
47066
|
level: "error",
|
|
47016
|
-
message: `${det.api} called without an entity-safe parser. Vulnerable ` + "to billion-laughs / quadratic blow-up DoS (CWE-776)
|
|
47067
|
+
message: `${det.api} called without an entity-safe parser. Vulnerable ` + (det.cwe === "CWE-611" ? "to external-entity disclosure (CWE-611) and billion-laughs / " + "quadratic blow-up DoS (CWE-776). " : "to billion-laughs / quadratic blow-up DoS (CWE-776). ") + "Use `defusedxml` or pass " + "an `XMLParser(resolve_entities=False)` to lxml.",
|
|
47017
47068
|
file,
|
|
47018
47069
|
line,
|
|
47019
47070
|
fix: this.fixForPython(det.api),
|
|
@@ -47024,6 +47075,63 @@ class XmlEntityExpansionPass {
|
|
|
47024
47075
|
}
|
|
47025
47076
|
return { findings };
|
|
47026
47077
|
}
|
|
47078
|
+
methodRanges(types) {
|
|
47079
|
+
const out2 = [];
|
|
47080
|
+
for (const t of types ?? []) {
|
|
47081
|
+
for (const m of t.methods ?? []) {
|
|
47082
|
+
if (typeof m.start_line === "number" && typeof m.end_line === "number")
|
|
47083
|
+
out2.push([m.start_line, m.end_line]);
|
|
47084
|
+
}
|
|
47085
|
+
}
|
|
47086
|
+
return out2;
|
|
47087
|
+
}
|
|
47088
|
+
isProvablyUnhardened(lines, line, methodRanges, api) {
|
|
47089
|
+
let range = null;
|
|
47090
|
+
for (const r of methodRanges) {
|
|
47091
|
+
if (line < r[0] || line > r[1])
|
|
47092
|
+
continue;
|
|
47093
|
+
if (!range || r[1] - r[0] < range[1] - range[0])
|
|
47094
|
+
range = r;
|
|
47095
|
+
}
|
|
47096
|
+
if (!range)
|
|
47097
|
+
return false;
|
|
47098
|
+
let decl = "";
|
|
47099
|
+
let declEnd = line;
|
|
47100
|
+
for (;declEnd <= Math.min(line + 3, range[1]); declEnd++) {
|
|
47101
|
+
decl += " " + (lines[declEnd - 1] ?? "").trim();
|
|
47102
|
+
if (decl.includes(";"))
|
|
47103
|
+
break;
|
|
47104
|
+
}
|
|
47105
|
+
const body2 = lines.slice(line - 1, range[1]).join(`
|
|
47106
|
+
`);
|
|
47107
|
+
if (api === "TransformerFactory" && !/\bnew\s+StreamSource\s*\(/.test(body2))
|
|
47108
|
+
return false;
|
|
47109
|
+
if (JAVA_HARDENING_SETTER_RE.test(body2))
|
|
47110
|
+
return false;
|
|
47111
|
+
const chained = JAVA_FACTORY_CHAINED_RE.exec(decl);
|
|
47112
|
+
if (chained) {
|
|
47113
|
+
const prod = /[\w>\]]\s+([A-Za-z_$][\w$]*)\s*=/.exec(decl);
|
|
47114
|
+
if (!prod)
|
|
47115
|
+
return true;
|
|
47116
|
+
const pn = prod[1].replace(/\$/g, "\\$");
|
|
47117
|
+
const after = lines.slice(declEnd, range[1]).join(`
|
|
47118
|
+
`);
|
|
47119
|
+
return !new RegExp(`[(,]\\s*${pn}\\s*[,)]|\\breturn\\s+${pn}\\s*;`).test(after);
|
|
47120
|
+
}
|
|
47121
|
+
const m = /[\w>\]]\s+([A-Za-z_$][\w$]*)\s*=\s*[\w.]*\bnewInstance\s*\([^()]*\)\s*;/.exec(decl);
|
|
47122
|
+
if (!m)
|
|
47123
|
+
return false;
|
|
47124
|
+
const name2 = m[1].replace(/\$/g, "\\$");
|
|
47125
|
+
const rest = lines.slice(declEnd, range[1]).join(`
|
|
47126
|
+
`);
|
|
47127
|
+
const builds = new RegExp(`\\b${name2}\\s*\\.\\s*(?:newDocumentBuilder|newSAXParser|newTransformer|newTemplates|newSchema|createXMLStreamReader|createXMLEventReader)\\s*\\(`);
|
|
47128
|
+
if (!builds.test(rest))
|
|
47129
|
+
return false;
|
|
47130
|
+
const escapes = new RegExp(`[(,]\\s*${name2}\\s*[,)]|\\breturn\\s+${name2}\\s*;`);
|
|
47131
|
+
if (escapes.test(rest))
|
|
47132
|
+
return false;
|
|
47133
|
+
return true;
|
|
47134
|
+
}
|
|
47027
47135
|
detectJavaCall(call) {
|
|
47028
47136
|
if (call.method_name !== "newInstance")
|
|
47029
47137
|
return null;
|
|
@@ -47034,7 +47142,7 @@ class XmlEntityExpansionPass {
|
|
|
47034
47142
|
return {
|
|
47035
47143
|
pattern: `${factory}.newInstance()`,
|
|
47036
47144
|
api: factory,
|
|
47037
|
-
cwe: "CWE-
|
|
47145
|
+
cwe: "CWE-611"
|
|
47038
47146
|
};
|
|
47039
47147
|
}
|
|
47040
47148
|
}
|
|
@@ -47047,7 +47155,7 @@ class XmlEntityExpansionPass {
|
|
|
47047
47155
|
return {
|
|
47048
47156
|
pattern: `etree.${method}`,
|
|
47049
47157
|
api: `lxml.etree.${method}`,
|
|
47050
|
-
cwe: "CWE-
|
|
47158
|
+
cwe: "CWE-611"
|
|
47051
47159
|
};
|
|
47052
47160
|
}
|
|
47053
47161
|
if ((method === "parse" || method === "fromstring") && (recv === "ET" || recv === "ElementTree" || recv.endsWith(".ElementTree"))) {
|
|
@@ -49738,7 +49846,7 @@ var colors = {
|
|
|
49738
49846
|
};
|
|
49739
49847
|
|
|
49740
49848
|
// src/version.ts
|
|
49741
|
-
var version = "4.9.
|
|
49849
|
+
var version = "4.9.22";
|
|
49742
49850
|
|
|
49743
49851
|
// src/formatters.ts
|
|
49744
49852
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
|
@@ -50168,9 +50276,18 @@ function formatJSON(results, crossFileData, profileSummary) {
|
|
|
50168
50276
|
};
|
|
50169
50277
|
return JSON.stringify(output, null, 2);
|
|
50170
50278
|
}
|
|
50279
|
+
function physicalLocation(file, line) {
|
|
50280
|
+
const hasLine = Number.isInteger(line) && line >= 1;
|
|
50281
|
+
return {
|
|
50282
|
+
physicalLocation: {
|
|
50283
|
+
artifactLocation: { uri: file },
|
|
50284
|
+
...hasLine ? { region: { startLine: line } } : {}
|
|
50285
|
+
}
|
|
50286
|
+
};
|
|
50287
|
+
}
|
|
50171
50288
|
function formatSARIF(results, crossFileData, profileSummary) {
|
|
50172
50289
|
const sarif = {
|
|
50173
|
-
$schema: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/
|
|
50290
|
+
$schema: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",
|
|
50174
50291
|
version: "2.1.0",
|
|
50175
50292
|
runs: [
|
|
50176
50293
|
{
|
|
@@ -50235,14 +50352,7 @@ function generateSarifResults(results, crossFileData) {
|
|
|
50235
50352
|
ruleId: vuln.type.replace(/\s+/g, "-").toLowerCase(),
|
|
50236
50353
|
level: vuln.severity === "critical" || vuln.severity === "high" ? "error" : "warning",
|
|
50237
50354
|
message: { text: vuln.message },
|
|
50238
|
-
locations: [
|
|
50239
|
-
{
|
|
50240
|
-
physicalLocation: {
|
|
50241
|
-
artifactLocation: { uri: result.file },
|
|
50242
|
-
region: { startLine: vuln.line }
|
|
50243
|
-
}
|
|
50244
|
-
}
|
|
50245
|
-
],
|
|
50355
|
+
locations: [physicalLocation(result.file, vuln.line)],
|
|
50246
50356
|
properties: {
|
|
50247
50357
|
cwe: vuln.cwe,
|
|
50248
50358
|
severity: vuln.severity,
|
|
@@ -50261,22 +50371,12 @@ function generateSarifResults(results, crossFileData) {
|
|
|
50261
50371
|
message: {
|
|
50262
50372
|
text: `Cross-file taint flow from ${p.source.file}:${p.source.line} to ${p.sink.file}:${p.sink.line}`
|
|
50263
50373
|
},
|
|
50264
|
-
locations: [
|
|
50265
|
-
{
|
|
50266
|
-
physicalLocation: {
|
|
50267
|
-
artifactLocation: { uri: p.sink.file },
|
|
50268
|
-
region: { startLine: p.sink.line }
|
|
50269
|
-
}
|
|
50270
|
-
}
|
|
50271
|
-
],
|
|
50374
|
+
locations: [physicalLocation(p.sink.file, p.sink.line)],
|
|
50272
50375
|
relatedLocations: [
|
|
50273
50376
|
{
|
|
50274
50377
|
id: 0,
|
|
50275
50378
|
message: { text: "taint source" },
|
|
50276
|
-
physicalLocation
|
|
50277
|
-
artifactLocation: { uri: p.source.file },
|
|
50278
|
-
region: { startLine: p.source.line }
|
|
50279
|
-
}
|
|
50379
|
+
...physicalLocation(p.source.file, p.source.line)
|
|
50280
50380
|
}
|
|
50281
50381
|
],
|
|
50282
50382
|
properties: {
|
|
@@ -50291,8 +50391,8 @@ function generateSarifResults(results, crossFileData) {
|
|
|
50291
50391
|
|
|
50292
50392
|
// src/build-info.ts
|
|
50293
50393
|
var buildInfo = {
|
|
50294
|
-
gitSha: "
|
|
50295
|
-
builtAt: "2026-09-
|
|
50394
|
+
gitSha: "54a142d",
|
|
50395
|
+
builtAt: "2026-09-22T01:39:02.544Z"
|
|
50296
50396
|
};
|
|
50297
50397
|
|
|
50298
50398
|
// src/utils/args.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.22",
|
|
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",
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"test": "bun test",
|
|
15
15
|
"clean": "rm -rf dist cognium-dev cognium-dev-* *.bun-build wasm",
|
|
16
16
|
"typecheck": "tsc --noEmit",
|
|
17
|
-
"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
|
|
17
|
+
"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",
|
|
18
18
|
"dogfood": "bun run src/cli.ts scan src/ -q",
|
|
19
|
-
"prepublishOnly": "bun run build"
|
|
19
|
+
"prepublishOnly": "bun run build",
|
|
20
|
+
"test:coverage": "bun test --coverage"
|
|
20
21
|
},
|
|
21
22
|
"keywords": [
|
|
22
23
|
"security",
|
|
@@ -66,11 +67,13 @@
|
|
|
66
67
|
},
|
|
67
68
|
"dependencies": {
|
|
68
69
|
"@cognium/project-profile-detect": "1.1.1",
|
|
69
|
-
"circle-ir": "4.9.
|
|
70
|
+
"circle-ir": "4.9.22"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
|
-
"@types/node": "^
|
|
73
|
-
"
|
|
74
|
-
"
|
|
73
|
+
"@types/node": "^26.6.1",
|
|
74
|
+
"ajv": "^8.17.1",
|
|
75
|
+
"ajv-draft-04": "^1.0.0",
|
|
76
|
+
"bun-types": "^1.4.2",
|
|
77
|
+
"typescript": "^7.0.2"
|
|
75
78
|
}
|
|
76
79
|
}
|