cognium-dev 3.165.0 → 3.166.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +489 -11
- 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";
|
|
@@ -18979,7 +19410,9 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
|
18979
19410
|
const graph = buildProjectMethodGraph(fileAnalyses);
|
|
18980
19411
|
if (graph.methodsByKey.size === 0)
|
|
18981
19412
|
return;
|
|
18982
|
-
const
|
|
19413
|
+
const fileContext = buildFileContext(fileAnalyses);
|
|
19414
|
+
const entryPointKeys = collectEntryPointKeys(graph, fileContext);
|
|
19415
|
+
const entryPointKeysByLanguage = countEntryPointKeysByLanguage(graph, entryPointKeys);
|
|
18983
19416
|
const profileResolver = makeProfileResolver(options.projectProfile);
|
|
18984
19417
|
for (const fa of fileAnalyses) {
|
|
18985
19418
|
const findings = fa.analysis.findings;
|
|
@@ -18987,7 +19420,7 @@ function applyRequireEntryPath(fileAnalyses, options = {}) {
|
|
|
18987
19420
|
continue;
|
|
18988
19421
|
const kept = [];
|
|
18989
19422
|
for (const finding of findings) {
|
|
18990
|
-
const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, profileResolver(fa.file));
|
|
19423
|
+
const decision = classifyFinding(finding, fa.analysis, graph, entryPointKeys, entryPointKeysByLanguage, profileResolver(fa.file));
|
|
18991
19424
|
switch (decision.action) {
|
|
18992
19425
|
case "keep":
|
|
18993
19426
|
kept.push(finding);
|
|
@@ -19092,27 +19525,66 @@ function resolveCalleeKeys(call, methodsByKey, methodsByName) {
|
|
|
19092
19525
|
}
|
|
19093
19526
|
return candidates;
|
|
19094
19527
|
}
|
|
19095
|
-
function collectEntryPointKeys(graph) {
|
|
19528
|
+
function collectEntryPointKeys(graph, fileContext) {
|
|
19096
19529
|
const entryPoints = new Set;
|
|
19097
19530
|
for (const rec of graph.methodsByKey.values()) {
|
|
19531
|
+
const fileCtx = fileContext.get(rec.file);
|
|
19098
19532
|
const tier = classifyEntryPointTier(rec.method, rec.enclosingType, {
|
|
19099
19533
|
types: [rec.enclosingType],
|
|
19100
|
-
language: rec.language
|
|
19534
|
+
language: rec.language,
|
|
19535
|
+
filePath: rec.file,
|
|
19536
|
+
calls: fileCtx?.calls ?? null,
|
|
19537
|
+
runtimeRegistrations: fileCtx?.runtimeRegistrations ?? null
|
|
19101
19538
|
});
|
|
19102
19539
|
if (tier === "TIER_1_ENTRY_POINT")
|
|
19103
19540
|
entryPoints.add(rec.key);
|
|
19104
19541
|
}
|
|
19105
19542
|
return entryPoints;
|
|
19106
19543
|
}
|
|
19107
|
-
function
|
|
19544
|
+
function buildFileContext(fileAnalyses) {
|
|
19545
|
+
const out2 = new Map;
|
|
19546
|
+
for (const fa of fileAnalyses) {
|
|
19547
|
+
out2.set(fa.file, {
|
|
19548
|
+
language: (fa.analysis.meta.language ?? "").toLowerCase(),
|
|
19549
|
+
calls: fa.analysis.calls ?? null,
|
|
19550
|
+
runtimeRegistrations: fa.analysis.runtime_registrations ?? null
|
|
19551
|
+
});
|
|
19552
|
+
}
|
|
19553
|
+
return out2;
|
|
19554
|
+
}
|
|
19555
|
+
function countEntryPointKeysByLanguage(graph, entryPointKeys) {
|
|
19556
|
+
const out2 = new Map;
|
|
19557
|
+
for (const key of entryPointKeys) {
|
|
19558
|
+
const rec = graph.methodsByKey.get(key);
|
|
19559
|
+
if (!rec)
|
|
19560
|
+
continue;
|
|
19561
|
+
out2.set(rec.language, (out2.get(rec.language) ?? 0) + 1);
|
|
19562
|
+
}
|
|
19563
|
+
return out2;
|
|
19564
|
+
}
|
|
19565
|
+
var SUPPORTED_LANGUAGES = new Set([
|
|
19566
|
+
"java",
|
|
19567
|
+
"python",
|
|
19568
|
+
"javascript",
|
|
19569
|
+
"typescript",
|
|
19570
|
+
"tsx",
|
|
19571
|
+
"jsx",
|
|
19572
|
+
"go",
|
|
19573
|
+
"bash",
|
|
19574
|
+
"shell"
|
|
19575
|
+
]);
|
|
19576
|
+
function classifyFinding(finding, ir, graph, entryPointKeys, entryPointKeysByLanguage, profile) {
|
|
19108
19577
|
if (finding.category !== "security")
|
|
19109
19578
|
return { action: "keep" };
|
|
19110
19579
|
if (!TAINT_FLOW_RULE_IDS.has(finding.rule_id))
|
|
19111
19580
|
return { action: "keep" };
|
|
19112
19581
|
const isHighOrCritical = finding.severity === "high" || finding.severity === "critical";
|
|
19113
19582
|
const language = (ir.meta.language ?? "").toLowerCase();
|
|
19114
|
-
if (language
|
|
19583
|
+
if (!SUPPORTED_LANGUAGES.has(language))
|
|
19584
|
+
return { action: "keep" };
|
|
19585
|
+
if ((entryPointKeysByLanguage.get(language) ?? 0) === 0) {
|
|
19115
19586
|
return { action: "keep" };
|
|
19587
|
+
}
|
|
19116
19588
|
const containing = findContainingMethod(finding, ir, graph);
|
|
19117
19589
|
if (!containing) {
|
|
19118
19590
|
return { action: "keep" };
|
|
@@ -33524,7 +33996,13 @@ class InterproceduralPass {
|
|
|
33524
33996
|
continue;
|
|
33525
33997
|
if (this.enableEntryPointGate && source.type === "interprocedural_param" && source.in_method) {
|
|
33526
33998
|
const enclosing = methodNameIndex.get(source.in_method);
|
|
33527
|
-
if (shouldGateInterproceduralParam(source.type, enclosing?.method, enclosing?.type, {
|
|
33999
|
+
if (shouldGateInterproceduralParam(source.type, enclosing?.method, enclosing?.type, {
|
|
34000
|
+
language,
|
|
34001
|
+
types: graph.ir.types,
|
|
34002
|
+
filePath: graph.ir.meta.file,
|
|
34003
|
+
calls: graph.ir.calls,
|
|
34004
|
+
runtimeRegistrations: graph.ir.runtime_registrations ?? null
|
|
34005
|
+
})) {
|
|
33528
34006
|
continue;
|
|
33529
34007
|
}
|
|
33530
34008
|
}
|
|
@@ -43984,7 +44462,7 @@ var colors = {
|
|
|
43984
44462
|
};
|
|
43985
44463
|
|
|
43986
44464
|
// src/version.ts
|
|
43987
|
-
var version = "3.
|
|
44465
|
+
var version = "3.166.0";
|
|
43988
44466
|
|
|
43989
44467
|
// src/formatters.ts
|
|
43990
44468
|
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.0",
|
|
4
4
|
"description": "Static Application Security Testing CLI for detecting security vulnerabilities via taint tracking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@cognium/project-profile-detect": "^1.1.0",
|
|
69
|
-
"circle-ir": "^3.
|
|
69
|
+
"circle-ir": "^3.166.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.5.0",
|