@dataparade/cli 0.0.8 → 0.0.10
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/README.md +10 -10
- package/dist/package.json +1 -1
- package/dist/src/ai-enrichment/lambda-init-error.d.ts +5 -0
- package/dist/src/ai-enrichment/lambda-init-error.js +38 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.js +27 -1
- package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +73 -0
- package/dist/src/analyzers/cpp/cpp-detection-config.js +137 -0
- package/dist/src/analyzers/cpp/dependency-manifests.d.ts +8 -0
- package/dist/src/analyzers/cpp/dependency-manifests.js +130 -0
- package/dist/src/analyzers/cpp/detector.d.ts +3 -0
- package/dist/src/analyzers/cpp/detector.js +21 -0
- package/dist/src/analyzers/cpp/index.d.ts +2 -0
- package/dist/src/analyzers/cpp/index.js +11 -0
- package/dist/src/analyzers/cpp/manifest-parsers.d.ts +13 -0
- package/dist/src/analyzers/cpp/manifest-parsers.js +104 -0
- package/dist/src/analyzers/cpp/parser.d.ts +35 -0
- package/dist/src/analyzers/cpp/parser.js +206 -0
- package/dist/src/analyzers/cpp/patterns.d.ts +3 -0
- package/dist/src/analyzers/cpp/patterns.js +37 -0
- package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +100 -0
- package/dist/src/analyzers/csharp/csharp-detection-config.js +160 -0
- package/dist/src/analyzers/csharp/dependency-manifests.d.ts +13 -0
- package/dist/src/analyzers/csharp/dependency-manifests.js +184 -0
- package/dist/src/analyzers/csharp/detector.d.ts +3 -0
- package/dist/src/analyzers/csharp/detector.js +21 -0
- package/dist/src/analyzers/csharp/index.d.ts +2 -0
- package/dist/src/analyzers/csharp/index.js +11 -0
- package/dist/src/analyzers/csharp/manifest-parsers.d.ts +34 -0
- package/dist/src/analyzers/csharp/manifest-parsers.js +130 -0
- package/dist/src/analyzers/csharp/parser.d.ts +48 -0
- package/dist/src/analyzers/csharp/parser.js +277 -0
- package/dist/src/analyzers/csharp/patterns.d.ts +3 -0
- package/dist/src/analyzers/csharp/patterns.js +57 -0
- package/dist/src/analyzers/go/dependency-manifests.d.ts +10 -0
- package/dist/src/analyzers/go/dependency-manifests.js +117 -0
- package/dist/src/analyzers/go/detector.d.ts +3 -0
- package/dist/src/analyzers/go/detector.js +21 -0
- package/dist/src/analyzers/go/go-detection-config.d.ts +97 -0
- package/dist/src/analyzers/go/go-detection-config.js +164 -0
- package/dist/src/analyzers/go/index.d.ts +2 -0
- package/dist/src/analyzers/go/index.js +11 -0
- package/dist/src/analyzers/go/manifest-parsers.d.ts +20 -0
- package/dist/src/analyzers/go/manifest-parsers.js +104 -0
- package/dist/src/analyzers/go/parser.d.ts +40 -0
- package/dist/src/analyzers/go/parser.js +186 -0
- package/dist/src/analyzers/go/patterns.d.ts +3 -0
- package/dist/src/analyzers/go/patterns.js +50 -0
- package/dist/src/analyzers/jvm/dependency-manifests.d.ts +16 -0
- package/dist/src/analyzers/jvm/dependency-manifests.js +205 -0
- package/dist/src/analyzers/jvm/detector.d.ts +3 -0
- package/dist/src/analyzers/jvm/detector.js +21 -0
- package/dist/src/analyzers/jvm/index.d.ts +9 -0
- package/dist/src/analyzers/jvm/index.js +18 -0
- package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +136 -0
- package/dist/src/analyzers/jvm/jvm-detection-config.js +195 -0
- package/dist/src/analyzers/jvm/manifest-parsers.d.ts +61 -0
- package/dist/src/analyzers/jvm/manifest-parsers.js +246 -0
- package/dist/src/analyzers/jvm/parser.d.ts +54 -0
- package/dist/src/analyzers/jvm/parser.js +419 -0
- package/dist/src/analyzers/jvm/patterns.d.ts +3 -0
- package/dist/src/analyzers/jvm/patterns.js +64 -0
- package/dist/src/analyzers/python/detector.js +1 -1
- package/dist/src/analyzers/python/parser.d.ts +1 -0
- package/dist/src/analyzers/python/parser.js +7 -0
- package/dist/src/analyzers/python/patterns.d.ts +1 -0
- package/dist/src/analyzers/python/patterns.js +22 -77
- package/dist/src/analyzers/python/python-detection-config.d.ts +18 -0
- package/dist/src/analyzers/python/python-detection-config.js +20 -0
- package/dist/src/analyzers/registry.js +15 -0
- package/dist/src/analyzers/shared/c-family-calls.d.ts +26 -0
- package/dist/src/analyzers/shared/c-family-calls.js +118 -0
- package/dist/src/analyzers/shared/strip-comments.d.ts +32 -0
- package/dist/src/analyzers/shared/strip-comments.js +167 -0
- package/dist/src/analyzers/typescript/detector.js +1 -1
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +37 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.js +48 -0
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +1 -0
- package/dist/src/analyzers/typescript/typescript-detection.js +27 -29
- package/dist/src/cli.js +1 -1
- package/dist/src/config/file.js +5 -0
- package/dist/src/config/resolve.js +5 -0
- package/dist/src/core/pipeline/graph-mapping.js +3 -0
- package/dist/src/core/pipeline/structural-scan.js +154 -31
- package/dist/src/core/schema/scan-config.schema.d.ts +5 -0
- package/dist/src/core/schema/scan-config.schema.js +5 -0
- package/dist/src/core/schema/scan-result.schema.d.ts +5 -0
- package/dist/src/core/schema/scan-result.schema.js +5 -0
- package/dist/src/core/sectioning/discover-service-sections.js +27 -1
- package/dist/src/core/types/file.d.ts +1 -1
- package/dist/src/ingest/file-system.js +27 -0
- package/dist/src/patterns/config.d.ts +8 -0
- package/dist/src/patterns/config.js +136 -0
- package/dist/src/patterns/detectors/cpp.d.ts +8 -0
- package/dist/src/patterns/detectors/cpp.js +243 -0
- package/dist/src/patterns/detectors/csharp.d.ts +9 -0
- package/dist/src/patterns/detectors/csharp.js +385 -0
- package/dist/src/patterns/detectors/go.d.ts +9 -0
- package/dist/src/patterns/detectors/go.js +298 -0
- package/dist/src/patterns/detectors/helpers.d.ts +3 -0
- package/dist/src/patterns/detectors/helpers.js +5 -0
- package/dist/src/patterns/detectors/jvm.d.ts +15 -0
- package/dist/src/patterns/detectors/jvm.js +537 -0
- package/dist/src/patterns/detectors/python.d.ts +1 -0
- package/dist/src/patterns/detectors/python.js +92 -5
- package/dist/src/patterns/detectors/typescript.d.ts +2 -0
- package/dist/src/patterns/detectors/typescript.js +156 -4
- package/dist/src/patterns/engine.d.ts +18 -0
- package/dist/src/patterns/engine.js +30 -0
- package/dist/src/patterns/scan-exclusions.js +20 -0
- package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.js +11 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.js +80 -0
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +66 -0
- package/dist/tests/unit/analyzers/cpp/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/parser.spec.js +80 -0
- package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/patterns.spec.js +141 -0
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +75 -0
- package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/parser.spec.js +118 -0
- package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/patterns.spec.js +210 -0
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +96 -0
- package/dist/tests/unit/analyzers/go/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/parser.spec.js +110 -0
- package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/patterns.spec.js +239 -0
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +179 -0
- package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/parser.spec.js +195 -0
- package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/patterns.spec.js +284 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.js +169 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +188 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +67 -0
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +46 -0
- package/dist/tests/unit/core/go-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/go-scan.spec.js +78 -0
- package/dist/tests/unit/core/graph-mapping.spec.js +75 -0
- package/dist/tests/unit/core/jvm-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/jvm-scan.spec.js +94 -0
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +56 -0
- package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/jvm-languages.spec.js +47 -0
- package/package.json +1 -1
- package/patterns/cpp.md +176 -0
- package/patterns/cpp.patterns.yaml +314 -0
- package/patterns/csharp.md +211 -0
- package/patterns/csharp.patterns.yaml +375 -0
- package/patterns/go.md +211 -0
- package/patterns/go.patterns.yaml +429 -0
- package/patterns/jvm.md +160 -0
- package/patterns/jvm.patterns.yaml +884 -0
- package/patterns/python.patterns.yaml +177 -0
- package/patterns/third-party.patterns.yaml +5 -0
- package/patterns/typescript.patterns.yaml +222 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectCppDatabaseConnectionsFromConfig = detectCppDatabaseConnectionsFromConfig;
|
|
4
|
+
exports.detectCppAuthFromConfig = detectCppAuthFromConfig;
|
|
5
|
+
exports.detectCppEnvAndConfigFromConfig = detectCppEnvAndConfigFromConfig;
|
|
6
|
+
exports.detectCppRoutesFromConfig = detectCppRoutesFromConfig;
|
|
7
|
+
exports.detectCppExternalApisFromConfig = detectCppExternalApisFromConfig;
|
|
8
|
+
const external_url_third_party_1 = require("../../classifier/external-url-third-party");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
10
|
+
/**
|
|
11
|
+
* Match an `#include` path against a configured header.
|
|
12
|
+
*
|
|
13
|
+
* A configured value containing "/" is matched as a substring
|
|
14
|
+
* (`curl/curl.h` matches `<curl/curl.h>`); a bare value must match a whole
|
|
15
|
+
* path segment, so `sql.h` does not match `<mysql/mysql.h>`.
|
|
16
|
+
*/
|
|
17
|
+
function includeMatchesHeader(includePath, want) {
|
|
18
|
+
if (!want)
|
|
19
|
+
return false;
|
|
20
|
+
const header = includePath.toLowerCase();
|
|
21
|
+
if (want.includes("/"))
|
|
22
|
+
return header.includes(want);
|
|
23
|
+
return header === want || header.split("/").includes(want);
|
|
24
|
+
}
|
|
25
|
+
function hasAnyHeader(ctx, headers) {
|
|
26
|
+
if (headers.length === 0)
|
|
27
|
+
return false;
|
|
28
|
+
const imports = ctx.imports ?? [];
|
|
29
|
+
return imports.some((imp) => headers.some((want) => includeMatchesHeader(imp.module, want)));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Match dependency-manifest entries (vcpkg/Conan/CMake package names), which
|
|
33
|
+
* are supplied as imports by the manifest scanner. Package names rarely equal
|
|
34
|
+
* header paths, so this is a distinct signal from `includeHeaders`.
|
|
35
|
+
*/
|
|
36
|
+
function hasAnyPackage(ctx, packageNames) {
|
|
37
|
+
if (packageNames.length === 0)
|
|
38
|
+
return false;
|
|
39
|
+
const imports = ctx.imports ?? [];
|
|
40
|
+
return imports.some((imp) => packageNames.includes(imp.module.toLowerCase()));
|
|
41
|
+
}
|
|
42
|
+
function sourceOf(ctx) {
|
|
43
|
+
return ctx.strippedContent ?? ctx.file.content ?? "";
|
|
44
|
+
}
|
|
45
|
+
function callNameRegex(callNames) {
|
|
46
|
+
const escaped = callNames.map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
47
|
+
return new RegExp(`(?:^|[^A-Za-z0-9_])(?:${escaped.join("|")})\\s*[({]`);
|
|
48
|
+
}
|
|
49
|
+
function detectCppDatabaseConnectionsFromConfig(ctx, config) {
|
|
50
|
+
if (ctx.language !== "cpp")
|
|
51
|
+
return [];
|
|
52
|
+
const content = sourceOf(ctx);
|
|
53
|
+
const findings = [];
|
|
54
|
+
for (const db of config.cpp.dbClients) {
|
|
55
|
+
const hasInclude = hasAnyHeader(ctx, db.includeHeaders);
|
|
56
|
+
const hasPackage = hasAnyPackage(ctx, db.packageNames);
|
|
57
|
+
let hasCall = false;
|
|
58
|
+
if (db.callNames.length > 0) {
|
|
59
|
+
hasCall = callNameRegex(db.callNames).test(content);
|
|
60
|
+
}
|
|
61
|
+
if (!hasCall && db.callNamePrefixes.length > 0) {
|
|
62
|
+
hasCall = db.callNamePrefixes.some((prefix) => content.includes(prefix));
|
|
63
|
+
}
|
|
64
|
+
const matchesContent = db.contentRegexes.length > 0 &&
|
|
65
|
+
db.contentRegexes.some((re) => re.test(content));
|
|
66
|
+
if (!hasInclude && !hasPackage && !hasCall && !matchesContent)
|
|
67
|
+
continue;
|
|
68
|
+
findings.push({
|
|
69
|
+
pattern: db.patternId,
|
|
70
|
+
name: db.id,
|
|
71
|
+
confidence: db.confidence,
|
|
72
|
+
location: {
|
|
73
|
+
filePath: ctx.file.path,
|
|
74
|
+
startLine: 1,
|
|
75
|
+
endLine: 1,
|
|
76
|
+
},
|
|
77
|
+
properties: {
|
|
78
|
+
client: db.id,
|
|
79
|
+
databaseType: db.databaseType,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return findings;
|
|
84
|
+
}
|
|
85
|
+
function detectCppAuthFromConfig(ctx, config) {
|
|
86
|
+
if (ctx.language !== "cpp")
|
|
87
|
+
return [];
|
|
88
|
+
const content = sourceOf(ctx);
|
|
89
|
+
const findings = [];
|
|
90
|
+
for (const lib of config.cpp.auth.libraries) {
|
|
91
|
+
const hasInclude = hasAnyHeader(ctx, lib.includeHeaders);
|
|
92
|
+
const hasPackage = hasAnyPackage(ctx, lib.packageNames);
|
|
93
|
+
const hasCall = lib.callNames.length > 0 && callNameRegex(lib.callNames).test(content);
|
|
94
|
+
const matchesContent = lib.contentRegexes.length > 0 &&
|
|
95
|
+
lib.contentRegexes.some((re) => re.test(content));
|
|
96
|
+
if (!hasInclude && !hasPackage && !hasCall && !matchesContent)
|
|
97
|
+
continue;
|
|
98
|
+
findings.push({
|
|
99
|
+
pattern: lib.patternId,
|
|
100
|
+
name: lib.id,
|
|
101
|
+
confidence: lib.confidence,
|
|
102
|
+
location: {
|
|
103
|
+
filePath: ctx.file.path,
|
|
104
|
+
startLine: 1,
|
|
105
|
+
endLine: 1,
|
|
106
|
+
},
|
|
107
|
+
properties: {
|
|
108
|
+
...(lib.strategy ? { strategy: lib.strategy } : {}),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return findings;
|
|
113
|
+
}
|
|
114
|
+
function detectCppEnvAndConfigFromConfig(ctx, config) {
|
|
115
|
+
if (ctx.language !== "cpp")
|
|
116
|
+
return [];
|
|
117
|
+
const envCfg = config.cpp.envConfig;
|
|
118
|
+
const findings = [];
|
|
119
|
+
if (envCfg.envVariable) {
|
|
120
|
+
const lines = sourceOf(ctx).split(/\r?\n/);
|
|
121
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
122
|
+
const line = lines[i];
|
|
123
|
+
const match = envCfg.envVariable.regex.exec(line);
|
|
124
|
+
if (!match)
|
|
125
|
+
continue;
|
|
126
|
+
const key = match[1];
|
|
127
|
+
findings.push({
|
|
128
|
+
pattern: envCfg.envVariable.patternId,
|
|
129
|
+
name: key ? `getenv(${key})` : "env_variable",
|
|
130
|
+
confidence: envCfg.envVariable.confidence,
|
|
131
|
+
location: {
|
|
132
|
+
filePath: ctx.file.path,
|
|
133
|
+
startLine: i + 1,
|
|
134
|
+
endLine: i + 1,
|
|
135
|
+
code: line.trim(),
|
|
136
|
+
},
|
|
137
|
+
properties: key ? { key } : {},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (envCfg.configFile) {
|
|
142
|
+
const normalizedPath = (ctx.normalizedPath ?? ctx.file.path).toLowerCase();
|
|
143
|
+
if (envCfg.configFile.fileNameRegex.test(normalizedPath)) {
|
|
144
|
+
findings.push({
|
|
145
|
+
pattern: envCfg.configFile.patternId,
|
|
146
|
+
name: envCfg.configFile.name,
|
|
147
|
+
confidence: envCfg.configFile.confidence,
|
|
148
|
+
location: {
|
|
149
|
+
filePath: ctx.file.path,
|
|
150
|
+
startLine: 1,
|
|
151
|
+
endLine: 1,
|
|
152
|
+
},
|
|
153
|
+
properties: {},
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return findings;
|
|
158
|
+
}
|
|
159
|
+
function detectCppRoutesFromConfig(ctx, config) {
|
|
160
|
+
if (ctx.language !== "cpp")
|
|
161
|
+
return [];
|
|
162
|
+
const lines = sourceOf(ctx).split(/\r?\n/);
|
|
163
|
+
const findings = [];
|
|
164
|
+
for (const fw of config.cpp.routes.frameworks) {
|
|
165
|
+
const supportsFramework = fw.includeHeaders.length === 0 || hasAnyHeader(ctx, fw.includeHeaders);
|
|
166
|
+
if (!supportsFramework)
|
|
167
|
+
continue;
|
|
168
|
+
for (const routeRegex of fw.routeRegexes) {
|
|
169
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
170
|
+
const text = lines[i].trim();
|
|
171
|
+
if (!text)
|
|
172
|
+
continue;
|
|
173
|
+
const match = routeRegex.regex.exec(text);
|
|
174
|
+
if (!match)
|
|
175
|
+
continue;
|
|
176
|
+
const rawMethod = routeRegex.methodGroup != null
|
|
177
|
+
? match[routeRegex.methodGroup]
|
|
178
|
+
: routeRegex.defaultMethod;
|
|
179
|
+
const method = rawMethod ? rawMethod.toUpperCase() : undefined;
|
|
180
|
+
const routePath = routeRegex.pathGroup != null ? match[routeRegex.pathGroup] : undefined;
|
|
181
|
+
const name = method
|
|
182
|
+
? `${method} ${routePath ?? ""}`.trim()
|
|
183
|
+
: `${fw.id.toUpperCase()}_ROUTE ${routePath ?? ""}`.trim();
|
|
184
|
+
findings.push({
|
|
185
|
+
pattern: fw.patternId,
|
|
186
|
+
name,
|
|
187
|
+
confidence: fw.confidence,
|
|
188
|
+
location: {
|
|
189
|
+
filePath: ctx.file.path,
|
|
190
|
+
startLine: i + 1,
|
|
191
|
+
endLine: i + 1,
|
|
192
|
+
code: text,
|
|
193
|
+
},
|
|
194
|
+
properties: {
|
|
195
|
+
framework: fw.id,
|
|
196
|
+
httpMethods: method ? [method] : [],
|
|
197
|
+
...(routePath ? { path: routePath } : {}),
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return findings;
|
|
204
|
+
}
|
|
205
|
+
function detectCppExternalApisFromConfig(ctx, config) {
|
|
206
|
+
if (ctx.language !== "cpp")
|
|
207
|
+
return [];
|
|
208
|
+
const calls = ctx.moduleLevelCalls ?? [];
|
|
209
|
+
if (calls.length === 0)
|
|
210
|
+
return [];
|
|
211
|
+
const findings = [];
|
|
212
|
+
const urlHostPatterns = (0, helpers_1.buildThirdPartyUrlHostPatterns)(config);
|
|
213
|
+
for (const client of config.cpp.externalApis.httpClients) {
|
|
214
|
+
const supportsClient = client.includeHeaders.length === 0 ||
|
|
215
|
+
hasAnyHeader(ctx, client.includeHeaders);
|
|
216
|
+
if (!supportsClient)
|
|
217
|
+
continue;
|
|
218
|
+
for (const call of calls) {
|
|
219
|
+
const callee = call.callee ?? "";
|
|
220
|
+
const matchesCallName = client.callNames.some((name) => callee === name);
|
|
221
|
+
const matchesPrefix = client.callNamePrefixes.some((prefix) => callee.startsWith(prefix));
|
|
222
|
+
if (!matchesCallName && !matchesPrefix)
|
|
223
|
+
continue;
|
|
224
|
+
const snippet = call.argumentsSnippet ?? "";
|
|
225
|
+
const match = client.urlRegex.exec(snippet);
|
|
226
|
+
const url = match?.[1];
|
|
227
|
+
const serviceName = (0, helpers_1.inferServiceNameFromUrl)(url, urlHostPatterns) ??
|
|
228
|
+
(0, external_url_third_party_1.defaultServiceNameFromLiteralPublicUrl)(url) ??
|
|
229
|
+
client.clientName;
|
|
230
|
+
findings.push({
|
|
231
|
+
pattern: client.patternId,
|
|
232
|
+
name: `${client.clientName}_call`,
|
|
233
|
+
confidence: client.confidence,
|
|
234
|
+
location: call.location,
|
|
235
|
+
properties: {
|
|
236
|
+
...(url ? { url } : {}),
|
|
237
|
+
...(serviceName ? { serviceName } : {}),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return findings;
|
|
243
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PatternContext } from "../engine";
|
|
2
|
+
import type { UnifiedPatternConfig } from "../config";
|
|
3
|
+
import type { RawFinding } from "../../core/types/detection";
|
|
4
|
+
export declare function detectCSharpDatabaseConnectionsFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
5
|
+
export declare function detectCSharpAuthFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
6
|
+
export declare function detectCSharpEnvAndConfigFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
7
|
+
export declare function detectCSharpRoutesFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
8
|
+
export declare function detectCSharpServerlessHandlersFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
9
|
+
export declare function detectCSharpExternalApisFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectCSharpDatabaseConnectionsFromConfig = detectCSharpDatabaseConnectionsFromConfig;
|
|
4
|
+
exports.detectCSharpAuthFromConfig = detectCSharpAuthFromConfig;
|
|
5
|
+
exports.detectCSharpEnvAndConfigFromConfig = detectCSharpEnvAndConfigFromConfig;
|
|
6
|
+
exports.detectCSharpRoutesFromConfig = detectCSharpRoutesFromConfig;
|
|
7
|
+
exports.detectCSharpServerlessHandlersFromConfig = detectCSharpServerlessHandlersFromConfig;
|
|
8
|
+
exports.detectCSharpExternalApisFromConfig = detectCSharpExternalApisFromConfig;
|
|
9
|
+
const external_url_third_party_1 = require("../../classifier/external-url-third-party");
|
|
10
|
+
const helpers_1 = require("./helpers");
|
|
11
|
+
/**
|
|
12
|
+
* Parse an attribute as carried on `decorators`: `HttpGet("users/{id}")`
|
|
13
|
+
* or a bare `Authorize`.
|
|
14
|
+
*/
|
|
15
|
+
function parseAttribute(raw) {
|
|
16
|
+
const match = raw.match(/^([A-Za-z_][\w.]*)\s*(?:\(\s*@?"([^"]*)")?/);
|
|
17
|
+
if (!match)
|
|
18
|
+
return { name: raw };
|
|
19
|
+
return { name: match[1], firstStringArg: match[2] };
|
|
20
|
+
}
|
|
21
|
+
function attributesOf(decorators) {
|
|
22
|
+
return (decorators ?? []).map(parseAttribute);
|
|
23
|
+
}
|
|
24
|
+
/** A `using` matches when the declared namespace is at or below the configured one. */
|
|
25
|
+
function hasUsingNamespace(ctx, namespaces) {
|
|
26
|
+
if (namespaces.length === 0)
|
|
27
|
+
return false;
|
|
28
|
+
const imports = ctx.imports ?? [];
|
|
29
|
+
return imports.some((imp) => namespaces.some((want) => imp.module === want || imp.module.startsWith(`${want}.`)));
|
|
30
|
+
}
|
|
31
|
+
function sourceOf(ctx) {
|
|
32
|
+
return ctx.strippedContent ?? ctx.file.content ?? "";
|
|
33
|
+
}
|
|
34
|
+
function callNameRegex(callNames) {
|
|
35
|
+
const escaped = callNames.map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
36
|
+
return new RegExp(`(?:^|[^A-Za-z0-9_])(?:${escaped.join("|")})\\s*[<({]`);
|
|
37
|
+
}
|
|
38
|
+
function lastSegment(callee) {
|
|
39
|
+
const segments = callee.split(/\.|->|::/);
|
|
40
|
+
return segments[segments.length - 1] ?? callee;
|
|
41
|
+
}
|
|
42
|
+
function detectCSharpDatabaseConnectionsFromConfig(ctx, config) {
|
|
43
|
+
if (ctx.language !== "csharp")
|
|
44
|
+
return [];
|
|
45
|
+
const content = sourceOf(ctx);
|
|
46
|
+
const types = ctx.types ?? [];
|
|
47
|
+
const findings = [];
|
|
48
|
+
for (const db of config.csharp.dbClients) {
|
|
49
|
+
const hasUsing = hasUsingNamespace(ctx, db.usingNamespaces);
|
|
50
|
+
const hasCall = db.callNames.length > 0 && callNameRegex(db.callNames).test(content);
|
|
51
|
+
const derivesFromDbType = db.baseTypes.length > 0 &&
|
|
52
|
+
types.some((type) => (type.baseTypes ?? []).some((base) => db.baseTypes.some((want) => base === want || base.startsWith(want))));
|
|
53
|
+
if (!hasUsing && !hasCall && !derivesFromDbType)
|
|
54
|
+
continue;
|
|
55
|
+
findings.push({
|
|
56
|
+
pattern: db.patternId,
|
|
57
|
+
name: db.id,
|
|
58
|
+
confidence: db.confidence,
|
|
59
|
+
location: {
|
|
60
|
+
filePath: ctx.file.path,
|
|
61
|
+
startLine: 1,
|
|
62
|
+
endLine: 1,
|
|
63
|
+
},
|
|
64
|
+
properties: {
|
|
65
|
+
client: db.id,
|
|
66
|
+
databaseType: db.databaseType,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return findings;
|
|
71
|
+
}
|
|
72
|
+
function detectCSharpAuthFromConfig(ctx, config) {
|
|
73
|
+
if (ctx.language !== "csharp")
|
|
74
|
+
return [];
|
|
75
|
+
const content = sourceOf(ctx);
|
|
76
|
+
const findings = [];
|
|
77
|
+
for (const lib of config.csharp.auth.libraries) {
|
|
78
|
+
const hasUsing = hasUsingNamespace(ctx, lib.usingNamespaces);
|
|
79
|
+
const hasCall = lib.callNames.length > 0 && callNameRegex(lib.callNames).test(content);
|
|
80
|
+
if (!hasUsing && !hasCall)
|
|
81
|
+
continue;
|
|
82
|
+
findings.push({
|
|
83
|
+
pattern: lib.patternId,
|
|
84
|
+
name: lib.id,
|
|
85
|
+
confidence: lib.confidence,
|
|
86
|
+
location: {
|
|
87
|
+
filePath: ctx.file.path,
|
|
88
|
+
startLine: 1,
|
|
89
|
+
endLine: 1,
|
|
90
|
+
},
|
|
91
|
+
properties: {
|
|
92
|
+
...(lib.strategy ? { strategy: lib.strategy } : {}),
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const declaredAttributes = [
|
|
97
|
+
...(ctx.types ?? []).flatMap((type) => attributesOf(type.decorators)),
|
|
98
|
+
...(ctx.functions ?? []).flatMap((fn) => attributesOf(fn.decorators)),
|
|
99
|
+
];
|
|
100
|
+
for (const attrRule of config.csharp.auth.attributes) {
|
|
101
|
+
const match = declaredAttributes.find((attr) => attrRule.attributeNames.includes(attr.name));
|
|
102
|
+
if (!match)
|
|
103
|
+
continue;
|
|
104
|
+
findings.push({
|
|
105
|
+
pattern: attrRule.patternId,
|
|
106
|
+
name: attrRule.id,
|
|
107
|
+
confidence: attrRule.confidence,
|
|
108
|
+
location: {
|
|
109
|
+
filePath: ctx.file.path,
|
|
110
|
+
startLine: 1,
|
|
111
|
+
endLine: 1,
|
|
112
|
+
},
|
|
113
|
+
properties: {
|
|
114
|
+
...(attrRule.strategy ? { strategy: attrRule.strategy } : {}),
|
|
115
|
+
...(match.firstStringArg ? { policy: match.firstStringArg } : {}),
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return findings;
|
|
120
|
+
}
|
|
121
|
+
function detectCSharpEnvAndConfigFromConfig(ctx, config) {
|
|
122
|
+
if (ctx.language !== "csharp")
|
|
123
|
+
return [];
|
|
124
|
+
const envCfg = config.csharp.envConfig;
|
|
125
|
+
const lines = sourceOf(ctx).split(/\r?\n/);
|
|
126
|
+
const findings = [];
|
|
127
|
+
if (envCfg.envVariable) {
|
|
128
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
129
|
+
const line = lines[i];
|
|
130
|
+
const match = envCfg.envVariable.regex.exec(line);
|
|
131
|
+
if (!match)
|
|
132
|
+
continue;
|
|
133
|
+
const key = match[1];
|
|
134
|
+
findings.push({
|
|
135
|
+
pattern: envCfg.envVariable.patternId,
|
|
136
|
+
name: key ? `Environment[${key}]` : "env_variable",
|
|
137
|
+
confidence: envCfg.envVariable.confidence,
|
|
138
|
+
location: {
|
|
139
|
+
filePath: ctx.file.path,
|
|
140
|
+
startLine: i + 1,
|
|
141
|
+
endLine: i + 1,
|
|
142
|
+
code: line.trim(),
|
|
143
|
+
},
|
|
144
|
+
properties: key ? { key } : {},
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (envCfg.configurationKeys) {
|
|
149
|
+
const seenKeys = new Set();
|
|
150
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
151
|
+
const line = lines[i];
|
|
152
|
+
for (const regex of envCfg.configurationKeys.regexes) {
|
|
153
|
+
const match = regex.exec(line);
|
|
154
|
+
if (!match)
|
|
155
|
+
continue;
|
|
156
|
+
const key = match[1];
|
|
157
|
+
if (!key || seenKeys.has(key))
|
|
158
|
+
continue;
|
|
159
|
+
seenKeys.add(key);
|
|
160
|
+
findings.push({
|
|
161
|
+
pattern: envCfg.configurationKeys.patternId,
|
|
162
|
+
name: `Configuration[${key}]`,
|
|
163
|
+
confidence: envCfg.configurationKeys.confidence,
|
|
164
|
+
location: {
|
|
165
|
+
filePath: ctx.file.path,
|
|
166
|
+
startLine: i + 1,
|
|
167
|
+
endLine: i + 1,
|
|
168
|
+
code: line.trim(),
|
|
169
|
+
},
|
|
170
|
+
properties: { key },
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (envCfg.configFile) {
|
|
176
|
+
const normalizedPath = (ctx.normalizedPath ?? ctx.file.path).toLowerCase();
|
|
177
|
+
if (envCfg.configFile.fileNameRegex.test(normalizedPath)) {
|
|
178
|
+
findings.push({
|
|
179
|
+
pattern: envCfg.configFile.patternId,
|
|
180
|
+
name: envCfg.configFile.name,
|
|
181
|
+
confidence: envCfg.configFile.confidence,
|
|
182
|
+
location: {
|
|
183
|
+
filePath: ctx.file.path,
|
|
184
|
+
startLine: 1,
|
|
185
|
+
endLine: 1,
|
|
186
|
+
},
|
|
187
|
+
properties: {},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return findings;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Resolve a controller-level route template, expanding the `[controller]`
|
|
195
|
+
* token the way ASP.NET Core does (class name minus the `Controller` suffix).
|
|
196
|
+
*/
|
|
197
|
+
function controllerRoutePrefix(typeName, template) {
|
|
198
|
+
if (!template)
|
|
199
|
+
return undefined;
|
|
200
|
+
const shortName = typeName.replace(/Controller$/, "");
|
|
201
|
+
return template
|
|
202
|
+
.replace(/\[controller\]/gi, shortName)
|
|
203
|
+
.replace(/\[action\]/gi, "");
|
|
204
|
+
}
|
|
205
|
+
function joinRouteSegments(prefix, suffix) {
|
|
206
|
+
const left = prefix?.replace(/\/+$/, "");
|
|
207
|
+
const right = suffix?.replace(/^\/+/, "");
|
|
208
|
+
if (left && right)
|
|
209
|
+
return `${left}/${right}`;
|
|
210
|
+
if (left)
|
|
211
|
+
return left;
|
|
212
|
+
return right;
|
|
213
|
+
}
|
|
214
|
+
function detectCSharpRoutesFromConfig(ctx, config) {
|
|
215
|
+
if (ctx.language !== "csharp")
|
|
216
|
+
return [];
|
|
217
|
+
const methods = ctx.functions ?? [];
|
|
218
|
+
const types = ctx.types ?? [];
|
|
219
|
+
const lines = sourceOf(ctx).split(/\r?\n/);
|
|
220
|
+
const findings = [];
|
|
221
|
+
for (const fw of config.csharp.routes.frameworks) {
|
|
222
|
+
const gated = fw.usingNamespaces.length > 0;
|
|
223
|
+
const supportsFramework = !gated || hasUsingNamespace(ctx, fw.usingNamespaces);
|
|
224
|
+
if (!supportsFramework)
|
|
225
|
+
continue;
|
|
226
|
+
if (fw.attributeRoutes.length > 0) {
|
|
227
|
+
// Controller-level route template, e.g. [Route("api/[controller]")].
|
|
228
|
+
let routePrefix;
|
|
229
|
+
let controllerName;
|
|
230
|
+
for (const type of types) {
|
|
231
|
+
const typeAttributes = attributesOf(type.decorators);
|
|
232
|
+
const isController = typeAttributes.some((attr) => fw.controllerAttributes.includes(attr.name)) ||
|
|
233
|
+
(type.baseTypes ?? []).some((base) => fw.controllerBaseTypes.some((want) => base === want || base.startsWith(want)));
|
|
234
|
+
if (!isController)
|
|
235
|
+
continue;
|
|
236
|
+
controllerName = type.name;
|
|
237
|
+
const routeAttribute = typeAttributes.find((attr) => fw.controllerRouteAttributes.includes(attr.name));
|
|
238
|
+
routePrefix = controllerRoutePrefix(type.name, routeAttribute?.firstStringArg);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
for (const method of methods) {
|
|
242
|
+
const methodAttributes = attributesOf(method.decorators);
|
|
243
|
+
for (const attributeRoute of fw.attributeRoutes) {
|
|
244
|
+
const match = methodAttributes.find((attr) => attr.name === attributeRoute.attribute);
|
|
245
|
+
if (!match)
|
|
246
|
+
continue;
|
|
247
|
+
const routePath = joinRouteSegments(routePrefix, match.firstStringArg);
|
|
248
|
+
const httpMethod = attributeRoute.method;
|
|
249
|
+
const name = httpMethod
|
|
250
|
+
? `${httpMethod} ${routePath ?? method.name}`
|
|
251
|
+
: `ROUTE ${routePath ?? method.name}`;
|
|
252
|
+
findings.push({
|
|
253
|
+
pattern: fw.patternId,
|
|
254
|
+
name,
|
|
255
|
+
confidence: fw.confidence,
|
|
256
|
+
location: method.location,
|
|
257
|
+
properties: {
|
|
258
|
+
framework: fw.id,
|
|
259
|
+
httpMethods: httpMethod ? [httpMethod] : [],
|
|
260
|
+
...(routePath ? { path: routePath } : {}),
|
|
261
|
+
handler: method.name,
|
|
262
|
+
handlerType: "controller_action",
|
|
263
|
+
...(controllerName ? { controller: controllerName } : {}),
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
for (const routeRegex of fw.routeRegexes) {
|
|
270
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
271
|
+
const text = lines[i].trim();
|
|
272
|
+
if (!text)
|
|
273
|
+
continue;
|
|
274
|
+
const match = routeRegex.regex.exec(text);
|
|
275
|
+
if (!match)
|
|
276
|
+
continue;
|
|
277
|
+
const rawMethod = routeRegex.methodGroup != null
|
|
278
|
+
? match[routeRegex.methodGroup]
|
|
279
|
+
: routeRegex.defaultMethod;
|
|
280
|
+
const method = rawMethod ? rawMethod.toUpperCase() : undefined;
|
|
281
|
+
const routePath = routeRegex.pathGroup != null ? match[routeRegex.pathGroup] : undefined;
|
|
282
|
+
findings.push({
|
|
283
|
+
pattern: fw.patternId,
|
|
284
|
+
name: method
|
|
285
|
+
? `${method} ${routePath ?? ""}`.trim()
|
|
286
|
+
: `ROUTE ${routePath ?? ""}`.trim(),
|
|
287
|
+
confidence: fw.confidence,
|
|
288
|
+
location: {
|
|
289
|
+
filePath: ctx.file.path,
|
|
290
|
+
startLine: i + 1,
|
|
291
|
+
endLine: i + 1,
|
|
292
|
+
code: text,
|
|
293
|
+
},
|
|
294
|
+
properties: {
|
|
295
|
+
framework: fw.id,
|
|
296
|
+
httpMethods: method ? [method] : [],
|
|
297
|
+
...(routePath ? { path: routePath } : {}),
|
|
298
|
+
handlerType: "minimal_api",
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return findings;
|
|
305
|
+
}
|
|
306
|
+
function detectCSharpServerlessHandlersFromConfig(ctx, config) {
|
|
307
|
+
if (ctx.language !== "csharp")
|
|
308
|
+
return [];
|
|
309
|
+
const methods = ctx.functions ?? [];
|
|
310
|
+
const lines = sourceOf(ctx).split(/\r?\n/);
|
|
311
|
+
const findings = [];
|
|
312
|
+
for (const handler of config.csharp.serverless.handlers) {
|
|
313
|
+
const hasUsing = hasUsingNamespace(ctx, handler.usingNamespaces);
|
|
314
|
+
for (const method of methods) {
|
|
315
|
+
const attributes = attributesOf(method.decorators);
|
|
316
|
+
const attributeMatch = attributes.find((attr) => handler.attributeNames.includes(attr.name));
|
|
317
|
+
const declarationLine = lines[method.location.startLine - 1] ?? "";
|
|
318
|
+
const typeMatch = handler.typeNames.length > 0 &&
|
|
319
|
+
handler.typeNames.some((typeName) => declarationLine.includes(typeName));
|
|
320
|
+
if (!attributeMatch && !typeMatch)
|
|
321
|
+
continue;
|
|
322
|
+
// A bare type match (e.g. an `ILambdaContext` parameter) still needs the
|
|
323
|
+
// SDK namespace in scope to count as a handler.
|
|
324
|
+
if (!attributeMatch && !hasUsing)
|
|
325
|
+
continue;
|
|
326
|
+
findings.push({
|
|
327
|
+
pattern: handler.patternId,
|
|
328
|
+
name: attributeMatch?.firstStringArg
|
|
329
|
+
? `${handler.id} ${attributeMatch.firstStringArg}`
|
|
330
|
+
: `${handler.id} ${method.name}`,
|
|
331
|
+
confidence: handler.confidence,
|
|
332
|
+
location: method.location,
|
|
333
|
+
properties: {
|
|
334
|
+
framework: handler.id,
|
|
335
|
+
handler: method.name,
|
|
336
|
+
...(attributeMatch?.firstStringArg
|
|
337
|
+
? { functionName: attributeMatch.firstStringArg }
|
|
338
|
+
: {}),
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return findings;
|
|
344
|
+
}
|
|
345
|
+
function detectCSharpExternalApisFromConfig(ctx, config) {
|
|
346
|
+
if (ctx.language !== "csharp")
|
|
347
|
+
return [];
|
|
348
|
+
const calls = ctx.moduleLevelCalls ?? [];
|
|
349
|
+
if (calls.length === 0)
|
|
350
|
+
return [];
|
|
351
|
+
const content = sourceOf(ctx);
|
|
352
|
+
const findings = [];
|
|
353
|
+
const urlHostPatterns = (0, helpers_1.buildThirdPartyUrlHostPatterns)(config);
|
|
354
|
+
for (const client of config.csharp.externalApis.httpClients) {
|
|
355
|
+
const supportsClient = client.usingNamespaces.length === 0 ||
|
|
356
|
+
hasUsingNamespace(ctx, client.usingNamespaces) ||
|
|
357
|
+
content.includes(client.clientName);
|
|
358
|
+
if (!supportsClient)
|
|
359
|
+
continue;
|
|
360
|
+
for (const call of calls) {
|
|
361
|
+
const callee = call.callee ?? "";
|
|
362
|
+
const matchesCallName = client.callNames.some((name) => callee === name || lastSegment(callee) === name);
|
|
363
|
+
const matchesSuffix = client.callNameSuffixes.some((suffix) => callee.endsWith(suffix));
|
|
364
|
+
if (!matchesCallName && !matchesSuffix)
|
|
365
|
+
continue;
|
|
366
|
+
const snippet = call.argumentsSnippet ?? "";
|
|
367
|
+
const match = client.urlRegex.exec(snippet);
|
|
368
|
+
const url = match?.[1];
|
|
369
|
+
const serviceName = (0, helpers_1.inferServiceNameFromUrl)(url, urlHostPatterns) ??
|
|
370
|
+
(0, external_url_third_party_1.defaultServiceNameFromLiteralPublicUrl)(url) ??
|
|
371
|
+
client.clientName;
|
|
372
|
+
findings.push({
|
|
373
|
+
pattern: client.patternId,
|
|
374
|
+
name: `${client.clientName}_call`,
|
|
375
|
+
confidence: client.confidence,
|
|
376
|
+
location: call.location,
|
|
377
|
+
properties: {
|
|
378
|
+
...(url ? { url } : {}),
|
|
379
|
+
...(serviceName ? { serviceName } : {}),
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return findings;
|
|
385
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PatternContext } from "../engine";
|
|
2
|
+
import type { UnifiedPatternConfig } from "../config";
|
|
3
|
+
import type { RawFinding } from "../../core/types/detection";
|
|
4
|
+
export declare function detectGoDatabaseConnectionsFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
5
|
+
export declare function detectGoAuthFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
6
|
+
export declare function detectGoEnvAndConfigFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
7
|
+
export declare function detectGoRoutesFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
8
|
+
export declare function detectGoServerlessHandlersFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|
|
9
|
+
export declare function detectGoExternalApisFromConfig(ctx: PatternContext, config: UnifiedPatternConfig): RawFinding[];
|