cognium-dev 3.165.0 → 3.166.1
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 +492 -12
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -18902,11 +18902,29 @@ function methodIsSupertypeLifecycleEntryPoint(method, enclosingType) {
|
|
|
18902
18902
|
return false;
|
|
18903
18903
|
}
|
|
18904
18904
|
function classifyEntryPointTier(method, enclosingType, ctx) {
|
|
18905
|
-
const language = (ctx.language ?? "").toLowerCase();
|
|
18906
|
-
if (language !== "java")
|
|
18907
|
-
return "TIER_UNKNOWN";
|
|
18908
18905
|
if (!method)
|
|
18909
18906
|
return "TIER_UNKNOWN";
|
|
18907
|
+
const language = (ctx.language ?? "").toLowerCase();
|
|
18908
|
+
switch (language) {
|
|
18909
|
+
case "java":
|
|
18910
|
+
return classifyJavaEntryPoint(method, enclosingType);
|
|
18911
|
+
case "python":
|
|
18912
|
+
return classifyPythonEntryPoint(method, enclosingType, ctx);
|
|
18913
|
+
case "javascript":
|
|
18914
|
+
case "typescript":
|
|
18915
|
+
case "tsx":
|
|
18916
|
+
case "jsx":
|
|
18917
|
+
return classifyJsTsEntryPoint(method, enclosingType, ctx);
|
|
18918
|
+
case "go":
|
|
18919
|
+
return classifyGoEntryPoint(method, enclosingType, ctx);
|
|
18920
|
+
case "bash":
|
|
18921
|
+
case "shell":
|
|
18922
|
+
return classifyBashEntryPoint(method, enclosingType, ctx);
|
|
18923
|
+
default:
|
|
18924
|
+
return "TIER_UNKNOWN";
|
|
18925
|
+
}
|
|
18926
|
+
}
|
|
18927
|
+
function classifyJavaEntryPoint(method, enclosingType) {
|
|
18910
18928
|
if (classShapeIsLibraryFacade(enclosingType)) {
|
|
18911
18929
|
return "TIER_3_LIBRARY_API";
|
|
18912
18930
|
}
|
|
@@ -18932,6 +18950,419 @@ function shouldGateInterproceduralParam(sourceType, enclosingMethod, enclosingTy
|
|
|
18932
18950
|
const tier = classifyEntryPointTier(enclosingMethod, enclosingType, ctx);
|
|
18933
18951
|
return tier === "TIER_3_LIBRARY_API";
|
|
18934
18952
|
}
|
|
18953
|
+
var POLYGLOT_LIBRARY_PATH_FRAGMENTS = [
|
|
18954
|
+
"/lib/",
|
|
18955
|
+
"/libapi/",
|
|
18956
|
+
"/libs/",
|
|
18957
|
+
"/utils/",
|
|
18958
|
+
"/util/",
|
|
18959
|
+
"/helpers/",
|
|
18960
|
+
"/helper/",
|
|
18961
|
+
"/interop/",
|
|
18962
|
+
"/vendor/",
|
|
18963
|
+
"/vendored/",
|
|
18964
|
+
"/node_modules/",
|
|
18965
|
+
"/dist/",
|
|
18966
|
+
"/build/",
|
|
18967
|
+
"/_internal/",
|
|
18968
|
+
"/__tests__/",
|
|
18969
|
+
"/tests/",
|
|
18970
|
+
"/test/",
|
|
18971
|
+
"/testing/",
|
|
18972
|
+
"/spec/",
|
|
18973
|
+
"/specs/",
|
|
18974
|
+
"/fixtures/",
|
|
18975
|
+
"/mocks/",
|
|
18976
|
+
"/__mocks__/"
|
|
18977
|
+
];
|
|
18978
|
+
var POLYGLOT_TEST_FILE_MARKERS = [
|
|
18979
|
+
".test.",
|
|
18980
|
+
".spec.",
|
|
18981
|
+
"_test.",
|
|
18982
|
+
"_spec.",
|
|
18983
|
+
".tests."
|
|
18984
|
+
];
|
|
18985
|
+
function pathLooksLikeLibraryOrTest(filePath) {
|
|
18986
|
+
if (!filePath)
|
|
18987
|
+
return false;
|
|
18988
|
+
const normalized = filePath.replace(/\\/g, "/").toLowerCase();
|
|
18989
|
+
const padded = `/${normalized}/`;
|
|
18990
|
+
for (const frag of POLYGLOT_LIBRARY_PATH_FRAGMENTS) {
|
|
18991
|
+
if (padded.includes(frag))
|
|
18992
|
+
return true;
|
|
18993
|
+
}
|
|
18994
|
+
const slash = normalized.lastIndexOf("/");
|
|
18995
|
+
const base = slash >= 0 ? normalized.slice(slash + 1) : normalized;
|
|
18996
|
+
for (const marker of POLYGLOT_TEST_FILE_MARKERS) {
|
|
18997
|
+
if (base.includes(marker))
|
|
18998
|
+
return true;
|
|
18999
|
+
}
|
|
19000
|
+
return false;
|
|
19001
|
+
}
|
|
19002
|
+
var PYTHON_TIER_1_DECORATOR_NAMES = new Set([
|
|
19003
|
+
"route",
|
|
19004
|
+
"get",
|
|
19005
|
+
"post",
|
|
19006
|
+
"put",
|
|
19007
|
+
"delete",
|
|
19008
|
+
"patch",
|
|
19009
|
+
"options",
|
|
19010
|
+
"head",
|
|
19011
|
+
"before_request",
|
|
19012
|
+
"after_request",
|
|
19013
|
+
"errorhandler",
|
|
19014
|
+
"teardown_request",
|
|
19015
|
+
"websocket",
|
|
19016
|
+
"websocket_route",
|
|
19017
|
+
"api_route",
|
|
19018
|
+
"middleware",
|
|
19019
|
+
"login_required",
|
|
19020
|
+
"csrf_exempt",
|
|
19021
|
+
"csrf_protect",
|
|
19022
|
+
"require_http_methods",
|
|
19023
|
+
"require_GET",
|
|
19024
|
+
"require_POST",
|
|
19025
|
+
"require_safe",
|
|
19026
|
+
"permission_required",
|
|
19027
|
+
"user_passes_test",
|
|
19028
|
+
"staff_member_required",
|
|
19029
|
+
"api_view",
|
|
19030
|
+
"action",
|
|
19031
|
+
"detail_route",
|
|
19032
|
+
"list_route",
|
|
19033
|
+
"renderer_classes",
|
|
19034
|
+
"authentication_classes",
|
|
19035
|
+
"permission_classes",
|
|
19036
|
+
"command",
|
|
19037
|
+
"group",
|
|
19038
|
+
"task",
|
|
19039
|
+
"shared_task",
|
|
19040
|
+
"periodic_task",
|
|
19041
|
+
"actor",
|
|
19042
|
+
"view",
|
|
19043
|
+
"fixture"
|
|
19044
|
+
]);
|
|
19045
|
+
function classifyPythonEntryPoint(method, enclosingType, ctx) {
|
|
19046
|
+
if (pathLooksLikeLibraryOrTest(ctx.filePath)) {
|
|
19047
|
+
return "TIER_3_LIBRARY_API";
|
|
19048
|
+
}
|
|
19049
|
+
if (pythonDecoratorLooksTier1(method.annotations)) {
|
|
19050
|
+
return "TIER_1_ENTRY_POINT";
|
|
19051
|
+
}
|
|
19052
|
+
if (methodIsRuntimeRegistrationHandler(method, ctx.runtimeRegistrations)) {
|
|
19053
|
+
return "TIER_1_ENTRY_POINT";
|
|
19054
|
+
}
|
|
19055
|
+
if (method.name === "main" && !enclosingType) {
|
|
19056
|
+
return "TIER_1_ENTRY_POINT";
|
|
19057
|
+
}
|
|
19058
|
+
if (method.name === "main" && enclosingType && looksLikeModuleType(enclosingType)) {
|
|
19059
|
+
return "TIER_1_ENTRY_POINT";
|
|
19060
|
+
}
|
|
19061
|
+
if (method.name.startsWith("_") && !method.name.startsWith("__")) {
|
|
19062
|
+
return "TIER_3_LIBRARY_API";
|
|
19063
|
+
}
|
|
19064
|
+
return "TIER_UNKNOWN";
|
|
19065
|
+
}
|
|
19066
|
+
function pythonDecoratorLooksTier1(annotations) {
|
|
19067
|
+
if (!annotations || annotations.length === 0)
|
|
19068
|
+
return false;
|
|
19069
|
+
for (const raw of annotations) {
|
|
19070
|
+
let name2 = raw.replace(/^@/, "").replace(/[<(].*$/, "").trim();
|
|
19071
|
+
if (!name2)
|
|
19072
|
+
continue;
|
|
19073
|
+
const dot = name2.lastIndexOf(".");
|
|
19074
|
+
if (dot >= 0)
|
|
19075
|
+
name2 = name2.slice(dot + 1);
|
|
19076
|
+
if (PYTHON_TIER_1_DECORATOR_NAMES.has(name2))
|
|
19077
|
+
return true;
|
|
19078
|
+
}
|
|
19079
|
+
return false;
|
|
19080
|
+
}
|
|
19081
|
+
function looksLikeModuleType(t) {
|
|
19082
|
+
return !t.extends && (!t.implements || t.implements.length === 0) && (!t.annotations || t.annotations.length === 0);
|
|
19083
|
+
}
|
|
19084
|
+
var JSTS_TIER_1_METHOD_DECORATORS = new Set([
|
|
19085
|
+
"Get",
|
|
19086
|
+
"Post",
|
|
19087
|
+
"Put",
|
|
19088
|
+
"Delete",
|
|
19089
|
+
"Patch",
|
|
19090
|
+
"Head",
|
|
19091
|
+
"Options",
|
|
19092
|
+
"All",
|
|
19093
|
+
"SubscribeMessage",
|
|
19094
|
+
"MessageBody",
|
|
19095
|
+
"ConnectedSocket",
|
|
19096
|
+
"EventPattern",
|
|
19097
|
+
"MessagePattern",
|
|
19098
|
+
"GrpcMethod",
|
|
19099
|
+
"GrpcStreamMethod",
|
|
19100
|
+
"HostListener"
|
|
19101
|
+
]);
|
|
19102
|
+
var JSTS_TIER_1_CLASS_DECORATORS = new Set([
|
|
19103
|
+
"Controller",
|
|
19104
|
+
"RestController",
|
|
19105
|
+
"Resolver",
|
|
19106
|
+
"WebSocketGateway",
|
|
19107
|
+
"Gateway"
|
|
19108
|
+
]);
|
|
19109
|
+
var JSTS_TIER_1_MODULE_EXPORTS = new Set([
|
|
19110
|
+
"handler",
|
|
19111
|
+
"GET",
|
|
19112
|
+
"POST",
|
|
19113
|
+
"PUT",
|
|
19114
|
+
"DELETE",
|
|
19115
|
+
"PATCH",
|
|
19116
|
+
"HEAD",
|
|
19117
|
+
"OPTIONS",
|
|
19118
|
+
"load",
|
|
19119
|
+
"action",
|
|
19120
|
+
"middleware"
|
|
19121
|
+
]);
|
|
19122
|
+
function classifyJsTsEntryPoint(method, enclosingType, ctx) {
|
|
19123
|
+
if (pathLooksLikeLibraryOrTest(ctx.filePath)) {
|
|
19124
|
+
return "TIER_3_LIBRARY_API";
|
|
19125
|
+
}
|
|
19126
|
+
if (annotationsInclude(method.annotations, JSTS_TIER_1_METHOD_DECORATORS)) {
|
|
19127
|
+
return "TIER_1_ENTRY_POINT";
|
|
19128
|
+
}
|
|
19129
|
+
if (enclosingType && annotationsInclude(enclosingType.annotations, JSTS_TIER_1_CLASS_DECORATORS)) {
|
|
19130
|
+
return "TIER_1_ENTRY_POINT";
|
|
19131
|
+
}
|
|
19132
|
+
if (methodIsRuntimeRegistrationHandler(method, ctx.runtimeRegistrations)) {
|
|
19133
|
+
return "TIER_1_ENTRY_POINT";
|
|
19134
|
+
}
|
|
19135
|
+
if (JSTS_TIER_1_MODULE_EXPORTS.has(method.name) && (!enclosingType || looksLikeModuleType(enclosingType))) {
|
|
19136
|
+
return "TIER_1_ENTRY_POINT";
|
|
19137
|
+
}
|
|
19138
|
+
if (method.name === "main" && (!enclosingType || looksLikeModuleType(enclosingType))) {
|
|
19139
|
+
return "TIER_1_ENTRY_POINT";
|
|
19140
|
+
}
|
|
19141
|
+
return "TIER_UNKNOWN";
|
|
19142
|
+
}
|
|
19143
|
+
var GO_HTTP_REGISTRAR_METHODS = new Set([
|
|
19144
|
+
"HandleFunc",
|
|
19145
|
+
"Handle",
|
|
19146
|
+
"GET",
|
|
19147
|
+
"POST",
|
|
19148
|
+
"PUT",
|
|
19149
|
+
"DELETE",
|
|
19150
|
+
"PATCH",
|
|
19151
|
+
"HEAD",
|
|
19152
|
+
"OPTIONS",
|
|
19153
|
+
"Any",
|
|
19154
|
+
"Get",
|
|
19155
|
+
"Post",
|
|
19156
|
+
"Put",
|
|
19157
|
+
"Delete",
|
|
19158
|
+
"Patch",
|
|
19159
|
+
"Head",
|
|
19160
|
+
"Options",
|
|
19161
|
+
"Route",
|
|
19162
|
+
"Mount",
|
|
19163
|
+
"Method"
|
|
19164
|
+
]);
|
|
19165
|
+
var GO_HTTP_REGISTRAR_RECEIVERS = [
|
|
19166
|
+
"http",
|
|
19167
|
+
"mux",
|
|
19168
|
+
"router",
|
|
19169
|
+
"r",
|
|
19170
|
+
"e",
|
|
19171
|
+
"g",
|
|
19172
|
+
"app",
|
|
19173
|
+
"engine",
|
|
19174
|
+
"srv",
|
|
19175
|
+
"server"
|
|
19176
|
+
];
|
|
19177
|
+
function classifyGoEntryPoint(method, enclosingType, ctx) {
|
|
19178
|
+
if (pathLooksLikeLibraryOrTest(ctx.filePath)) {
|
|
19179
|
+
return "TIER_3_LIBRARY_API";
|
|
19180
|
+
}
|
|
19181
|
+
if (ctx.filePath && ctx.filePath.toLowerCase().endsWith("_test.go")) {
|
|
19182
|
+
return "TIER_3_LIBRARY_API";
|
|
19183
|
+
}
|
|
19184
|
+
if (method.name === "main" && enclosingType?.package === "main") {
|
|
19185
|
+
return "TIER_1_ENTRY_POINT";
|
|
19186
|
+
}
|
|
19187
|
+
if (methodHasNetHttpHandlerSignature(method)) {
|
|
19188
|
+
return "TIER_1_ENTRY_POINT";
|
|
19189
|
+
}
|
|
19190
|
+
if (methodLooksLikeGrpcHandler(method, enclosingType)) {
|
|
19191
|
+
return "TIER_1_ENTRY_POINT";
|
|
19192
|
+
}
|
|
19193
|
+
if (methodIsRegisteredByGoHttpFramework(method, ctx.calls)) {
|
|
19194
|
+
return "TIER_1_ENTRY_POINT";
|
|
19195
|
+
}
|
|
19196
|
+
return "TIER_UNKNOWN";
|
|
19197
|
+
}
|
|
19198
|
+
function methodHasNetHttpHandlerSignature(method) {
|
|
19199
|
+
const params = method.parameters ?? [];
|
|
19200
|
+
if (params.length !== 2)
|
|
19201
|
+
return false;
|
|
19202
|
+
const p0 = normalizeGoType(params[0]?.type ?? "");
|
|
19203
|
+
const p1 = normalizeGoType(params[1]?.type ?? "");
|
|
19204
|
+
const p0IsWriter = p0.includes("http.ResponseWriter") || p0.endsWith("ResponseWriter");
|
|
19205
|
+
const p1IsRequest = p1.includes("http.Request") || p1.endsWith("*Request") || p1.endsWith("Request");
|
|
19206
|
+
return p0IsWriter && p1IsRequest;
|
|
19207
|
+
}
|
|
19208
|
+
function methodLooksLikeGrpcHandler(method, enclosingType) {
|
|
19209
|
+
if (!enclosingType)
|
|
19210
|
+
return false;
|
|
19211
|
+
const params = method.parameters ?? [];
|
|
19212
|
+
if (params.length < 2)
|
|
19213
|
+
return false;
|
|
19214
|
+
const p0 = normalizeGoType(params[0]?.type ?? "");
|
|
19215
|
+
if (!p0.includes("context.Context") && !p0.endsWith("Context"))
|
|
19216
|
+
return false;
|
|
19217
|
+
const typeName = enclosingType.name ?? "";
|
|
19218
|
+
if (!/(Server|Service|Handler)$/.test(typeName))
|
|
19219
|
+
return false;
|
|
19220
|
+
return true;
|
|
19221
|
+
}
|
|
19222
|
+
function normalizeGoType(t) {
|
|
19223
|
+
return t.replace(/\s+/g, "").replace(/^\*+/, "");
|
|
19224
|
+
}
|
|
19225
|
+
function methodIsRegisteredByGoHttpFramework(method, calls) {
|
|
19226
|
+
if (!calls || calls.length === 0)
|
|
19227
|
+
return false;
|
|
19228
|
+
for (const call of calls) {
|
|
19229
|
+
if (!GO_HTTP_REGISTRAR_METHODS.has(call.method_name))
|
|
19230
|
+
continue;
|
|
19231
|
+
const receiver = call.receiver ?? "";
|
|
19232
|
+
if (!goRegistrarReceiverMatches(receiver))
|
|
19233
|
+
continue;
|
|
19234
|
+
const args2 = call.arguments ?? [];
|
|
19235
|
+
for (const arg of args2) {
|
|
19236
|
+
const expr = (arg.expression ?? arg.variable ?? arg.value ?? "").trim();
|
|
19237
|
+
if (!expr)
|
|
19238
|
+
continue;
|
|
19239
|
+
const short = expr.slice(expr.lastIndexOf(".") + 1);
|
|
19240
|
+
if (short === method.name)
|
|
19241
|
+
return true;
|
|
19242
|
+
}
|
|
19243
|
+
}
|
|
19244
|
+
return false;
|
|
19245
|
+
}
|
|
19246
|
+
function goRegistrarReceiverMatches(receiver) {
|
|
19247
|
+
const trimmed = receiver.trim();
|
|
19248
|
+
if (!trimmed)
|
|
19249
|
+
return false;
|
|
19250
|
+
for (const target of GO_HTTP_REGISTRAR_RECEIVERS) {
|
|
19251
|
+
if (trimmed === target)
|
|
19252
|
+
return true;
|
|
19253
|
+
if (trimmed.endsWith(`.${target}`))
|
|
19254
|
+
return true;
|
|
19255
|
+
}
|
|
19256
|
+
return false;
|
|
19257
|
+
}
|
|
19258
|
+
var BASH_POSITIONAL_TOKENS = [
|
|
19259
|
+
"$1",
|
|
19260
|
+
"$2",
|
|
19261
|
+
"$3",
|
|
19262
|
+
"$4",
|
|
19263
|
+
"$5",
|
|
19264
|
+
"$6",
|
|
19265
|
+
"$7",
|
|
19266
|
+
"$8",
|
|
19267
|
+
"$9",
|
|
19268
|
+
"$@",
|
|
19269
|
+
"$*",
|
|
19270
|
+
"$#",
|
|
19271
|
+
"${1",
|
|
19272
|
+
"${2",
|
|
19273
|
+
"${3",
|
|
19274
|
+
"${@",
|
|
19275
|
+
"getopts"
|
|
19276
|
+
];
|
|
19277
|
+
var BASH_LIBRARY_FILENAME_PREFIXES = [
|
|
19278
|
+
"benign_",
|
|
19279
|
+
"safe_",
|
|
19280
|
+
"lib_",
|
|
19281
|
+
"common_",
|
|
19282
|
+
"helpers_",
|
|
19283
|
+
"_"
|
|
19284
|
+
];
|
|
19285
|
+
function classifyBashEntryPoint(method, enclosingType, ctx) {
|
|
19286
|
+
if (pathLooksLikeLibraryOrTest(ctx.filePath)) {
|
|
19287
|
+
return "TIER_3_LIBRARY_API";
|
|
19288
|
+
}
|
|
19289
|
+
if (bashFilenameLooksLikeLibrary(ctx.filePath)) {
|
|
19290
|
+
return "TIER_3_LIBRARY_API";
|
|
19291
|
+
}
|
|
19292
|
+
if (method.name === "main") {
|
|
19293
|
+
return "TIER_1_ENTRY_POINT";
|
|
19294
|
+
}
|
|
19295
|
+
if (methodConsumesPositionalArgs(method, ctx.calls)) {
|
|
19296
|
+
return "TIER_1_ENTRY_POINT";
|
|
19297
|
+
}
|
|
19298
|
+
if (enclosingType && looksLikeModuleType(enclosingType) && fileHasPositionalArgUse(ctx.calls)) {
|
|
19299
|
+
return "TIER_1_ENTRY_POINT";
|
|
19300
|
+
}
|
|
19301
|
+
return "TIER_UNKNOWN";
|
|
19302
|
+
}
|
|
19303
|
+
function bashFilenameLooksLikeLibrary(filePath) {
|
|
19304
|
+
if (!filePath)
|
|
19305
|
+
return false;
|
|
19306
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
19307
|
+
const slash = normalized.lastIndexOf("/");
|
|
19308
|
+
const base = (slash >= 0 ? normalized.slice(slash + 1) : normalized).toLowerCase();
|
|
19309
|
+
for (const prefix of BASH_LIBRARY_FILENAME_PREFIXES) {
|
|
19310
|
+
if (base.startsWith(prefix))
|
|
19311
|
+
return true;
|
|
19312
|
+
}
|
|
19313
|
+
if (base.includes(".test.") || base.includes("_test."))
|
|
19314
|
+
return true;
|
|
19315
|
+
return false;
|
|
19316
|
+
}
|
|
19317
|
+
function methodConsumesPositionalArgs(method, calls) {
|
|
19318
|
+
if (!calls || calls.length === 0)
|
|
19319
|
+
return false;
|
|
19320
|
+
for (const call of calls) {
|
|
19321
|
+
if (call.location.line < method.start_line)
|
|
19322
|
+
continue;
|
|
19323
|
+
if (call.location.line > method.end_line)
|
|
19324
|
+
continue;
|
|
19325
|
+
if (callHasPositionalToken(call))
|
|
19326
|
+
return true;
|
|
19327
|
+
}
|
|
19328
|
+
return false;
|
|
19329
|
+
}
|
|
19330
|
+
function fileHasPositionalArgUse(calls) {
|
|
19331
|
+
if (!calls || calls.length === 0)
|
|
19332
|
+
return false;
|
|
19333
|
+
for (const call of calls) {
|
|
19334
|
+
if (callHasPositionalToken(call))
|
|
19335
|
+
return true;
|
|
19336
|
+
}
|
|
19337
|
+
return false;
|
|
19338
|
+
}
|
|
19339
|
+
function callHasPositionalToken(call) {
|
|
19340
|
+
for (const arg of call.arguments ?? []) {
|
|
19341
|
+
const expr = arg.expression ?? arg.variable ?? arg.value ?? "";
|
|
19342
|
+
for (const tok of BASH_POSITIONAL_TOKENS) {
|
|
19343
|
+
if (expr.includes(tok))
|
|
19344
|
+
return true;
|
|
19345
|
+
}
|
|
19346
|
+
}
|
|
19347
|
+
if (call.method_name === "getopts")
|
|
19348
|
+
return true;
|
|
19349
|
+
return false;
|
|
19350
|
+
}
|
|
19351
|
+
function methodIsRuntimeRegistrationHandler(method, regs) {
|
|
19352
|
+
if (!regs || regs.length === 0)
|
|
19353
|
+
return false;
|
|
19354
|
+
for (const reg of regs) {
|
|
19355
|
+
if (reg.kind !== "http_route" && reg.kind !== "decorator" && reg.kind !== "event_listener" && reg.kind !== "middleware") {
|
|
19356
|
+
continue;
|
|
19357
|
+
}
|
|
19358
|
+
const handlerName = reg.handler?.name;
|
|
19359
|
+
if (!handlerName)
|
|
19360
|
+
continue;
|
|
19361
|
+
if (handlerName === method.name)
|
|
19362
|
+
return true;
|
|
19363
|
+
}
|
|
19364
|
+
return false;
|
|
19365
|
+
}
|
|
18935
19366
|
|
|
18936
19367
|
// ../circle-ir/dist/analysis/require-entry-path.js
|
|
18937
19368
|
var RULE_ID_REQUIRE_ENTRY_PATH = "require-entry-path";
|
|
@@ -18958,6 +19389,7 @@ var TAINT_FLOW_RULE_IDS = new Set([
|
|
|
18958
19389
|
"mybatis_mapper_call",
|
|
18959
19390
|
"external_taint_escape",
|
|
18960
19391
|
"template_injection",
|
|
19392
|
+
"xml_entity_expansion",
|
|
18961
19393
|
"sql-injection",
|
|
18962
19394
|
"nosql-injection",
|
|
18963
19395
|
"command-injection",
|
|
@@ -18970,7 +19402,8 @@ var TAINT_FLOW_RULE_IDS = new Set([
|
|
|
18970
19402
|
"format-string",
|
|
18971
19403
|
"mass-assignment",
|
|
18972
19404
|
"template-injection",
|
|
18973
|
-
"insecure-deserialization"
|
|
19405
|
+
"insecure-deserialization",
|
|
19406
|
+
"xml-entity-expansion"
|
|
18974
19407
|
]);
|
|
18975
19408
|
function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
18976
19409
|
const disabledSet = normalizeDisabled(options.disabledPasses);
|
|
@@ -18979,7 +19412,9 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
|
18979
19412
|
const graph = buildProjectMethodGraph(fileAnalyses);
|
|
18980
19413
|
if (graph.methodsByKey.size === 0)
|
|
18981
19414
|
return;
|
|
18982
|
-
const
|
|
19415
|
+
const fileContext = buildFileContext(fileAnalyses);
|
|
19416
|
+
const entryPointKeys = collectEntryPointKeys(graph, fileContext);
|
|
19417
|
+
const entryPointKeysByLanguage = countEntryPointKeysByLanguage(graph, entryPointKeys);
|
|
18983
19418
|
const profileResolver = makeProfileResolver(options.projectProfile);
|
|
18984
19419
|
for (const fa of fileAnalyses) {
|
|
18985
19420
|
const findings = fa.analysis.findings;
|
|
@@ -18987,7 +19422,7 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
|
18987
19422
|
continue;
|
|
18988
19423
|
const kept = [];
|
|
18989
19424
|
for (const finding of findings) {
|
|
18990
|
-
const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, profileResolver(fa.file));
|
|
19425
|
+
const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, entryPointKeysByLanguage, profileResolver(fa.file));
|
|
18991
19426
|
switch (decision.action) {
|
|
18992
19427
|
case "keep":
|
|
18993
19428
|
kept.push(finding);
|
|
@@ -19092,27 +19527,66 @@ function resolveCalleeKeys(call, methodsByKey, methodsByName) {
|
|
|
19092
19527
|
}
|
|
19093
19528
|
return candidates;
|
|
19094
19529
|
}
|
|
19095
|
-
function collectEntryPointKeys(graph) {
|
|
19530
|
+
function collectEntryPointKeys(graph, fileContext) {
|
|
19096
19531
|
const entryPoints = new Set;
|
|
19097
19532
|
for (const rec of graph.methodsByKey.values()) {
|
|
19533
|
+
const fileCtx = fileContext.get(rec.file);
|
|
19098
19534
|
const tier = classifyEntryPointTier(rec.method, rec.enclosingType, {
|
|
19099
19535
|
types: [rec.enclosingType],
|
|
19100
|
-
language: rec.language
|
|
19536
|
+
language: rec.language,
|
|
19537
|
+
filePath: rec.file,
|
|
19538
|
+
calls: fileCtx?.calls ?? null,
|
|
19539
|
+
runtimeRegistrations: fileCtx?.runtimeRegistrations ?? null
|
|
19101
19540
|
});
|
|
19102
19541
|
if (tier === "TIER_1_ENTRY_POINT")
|
|
19103
19542
|
entryPoints.add(rec.key);
|
|
19104
19543
|
}
|
|
19105
19544
|
return entryPoints;
|
|
19106
19545
|
}
|
|
19107
|
-
function
|
|
19546
|
+
function buildFileContext(fileAnalyses) {
|
|
19547
|
+
const out2 = new Map;
|
|
19548
|
+
for (const fa of fileAnalyses) {
|
|
19549
|
+
out2.set(fa.file, {
|
|
19550
|
+
language: (fa.analysis.meta.language ?? "").toLowerCase(),
|
|
19551
|
+
calls: fa.analysis.calls ?? null,
|
|
19552
|
+
runtimeRegistrations: fa.analysis.runtime_registrations ?? null
|
|
19553
|
+
});
|
|
19554
|
+
}
|
|
19555
|
+
return out2;
|
|
19556
|
+
}
|
|
19557
|
+
function countEntryPointKeysByLanguage(graph, entryPointKeys) {
|
|
19558
|
+
const out2 = new Map;
|
|
19559
|
+
for (const key of entryPointKeys) {
|
|
19560
|
+
const rec = graph.methodsByKey.get(key);
|
|
19561
|
+
if (!rec)
|
|
19562
|
+
continue;
|
|
19563
|
+
out2.set(rec.language, (out2.get(rec.language) ?? 0) + 1);
|
|
19564
|
+
}
|
|
19565
|
+
return out2;
|
|
19566
|
+
}
|
|
19567
|
+
var SUPPORTED_LANGUAGES = new Set([
|
|
19568
|
+
"java",
|
|
19569
|
+
"python",
|
|
19570
|
+
"javascript",
|
|
19571
|
+
"typescript",
|
|
19572
|
+
"tsx",
|
|
19573
|
+
"jsx",
|
|
19574
|
+
"go",
|
|
19575
|
+
"bash",
|
|
19576
|
+
"shell"
|
|
19577
|
+
]);
|
|
19578
|
+
function classifyFinding(finding, ir, graph, entryPointKeys, entryPointKeysByLanguage, profile) {
|
|
19108
19579
|
if (finding.category !== "security")
|
|
19109
19580
|
return { action: "keep" };
|
|
19110
19581
|
if (!TAINT_FLOW_RULE_IDS.has(finding.rule_id))
|
|
19111
19582
|
return { action: "keep" };
|
|
19112
19583
|
const isHighOrCritical = finding.severity === "high" || finding.severity === "critical";
|
|
19113
19584
|
const language = (ir.meta.language ?? "").toLowerCase();
|
|
19114
|
-
if (language
|
|
19585
|
+
if (!SUPPORTED_LANGUAGES.has(language))
|
|
19586
|
+
return { action: "keep" };
|
|
19587
|
+
if ((entryPointKeysByLanguage.get(language) ?? 0) === 0) {
|
|
19115
19588
|
return { action: "keep" };
|
|
19589
|
+
}
|
|
19116
19590
|
const containing = findContainingMethod(finding, ir, graph);
|
|
19117
19591
|
if (!containing) {
|
|
19118
19592
|
return { action: "keep" };
|
|
@@ -33524,7 +33998,13 @@ class InterproceduralPass {
|
|
|
33524
33998
|
continue;
|
|
33525
33999
|
if (this.enableEntryPointGate && source.type === "interprocedural_param" && source.in_method) {
|
|
33526
34000
|
const enclosing = methodNameIndex.get(source.in_method);
|
|
33527
|
-
if (shouldGateInterproceduralParam(source.type, enclosing?.method, enclosing?.type, {
|
|
34001
|
+
if (shouldGateInterproceduralParam(source.type, enclosing?.method, enclosing?.type, {
|
|
34002
|
+
language,
|
|
34003
|
+
types: graph.ir.types,
|
|
34004
|
+
filePath: graph.ir.meta.file,
|
|
34005
|
+
calls: graph.ir.calls,
|
|
34006
|
+
runtimeRegistrations: graph.ir.runtime_registrations ?? null
|
|
34007
|
+
})) {
|
|
33528
34008
|
continue;
|
|
33529
34009
|
}
|
|
33530
34010
|
}
|
|
@@ -43984,7 +44464,7 @@ var colors = {
|
|
|
43984
44464
|
};
|
|
43985
44465
|
|
|
43986
44466
|
// src/version.ts
|
|
43987
|
-
var version = "3.
|
|
44467
|
+
var version = "3.166.1";
|
|
43988
44468
|
|
|
43989
44469
|
// src/formatters.ts
|
|
43990
44470
|
var LIBRARY_API_SURFACE_TAG2 = "library-api-surface:caller-responsibility";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognium-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.166.1",
|
|
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.
|
|
69
|
+
"circle-ir": "^3.166.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|