circle-ir 3.51.0 → 3.53.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.
Files changed (35) hide show
  1. package/configs/sinks/path.yaml +0 -16
  2. package/configs/sources/file_sources.yaml +32 -0
  3. package/dist/analysis/config-loader.d.ts.map +1 -1
  4. package/dist/analysis/config-loader.js +17 -20
  5. package/dist/analysis/config-loader.js.map +1 -1
  6. package/dist/analysis/passes/insecure-cookie-pass.d.ts +23 -23
  7. package/dist/analysis/passes/insecure-cookie-pass.d.ts.map +1 -1
  8. package/dist/analysis/passes/insecure-cookie-pass.js +169 -79
  9. package/dist/analysis/passes/insecure-cookie-pass.js.map +1 -1
  10. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts +52 -0
  11. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts.map +1 -0
  12. package/dist/analysis/passes/tls-verify-disabled-pass.js +247 -0
  13. package/dist/analysis/passes/tls-verify-disabled-pass.js.map +1 -0
  14. package/dist/analysis/passes/weak-crypto-pass.d.ts +59 -0
  15. package/dist/analysis/passes/weak-crypto-pass.d.ts.map +1 -0
  16. package/dist/analysis/passes/weak-crypto-pass.js +392 -0
  17. package/dist/analysis/passes/weak-crypto-pass.js.map +1 -0
  18. package/dist/analysis/passes/weak-hash-pass.d.ts +45 -0
  19. package/dist/analysis/passes/weak-hash-pass.d.ts.map +1 -0
  20. package/dist/analysis/passes/weak-hash-pass.js +150 -0
  21. package/dist/analysis/passes/weak-hash-pass.js.map +1 -0
  22. package/dist/analysis/passes/weak-random-pass.d.ts +53 -0
  23. package/dist/analysis/passes/weak-random-pass.d.ts.map +1 -0
  24. package/dist/analysis/passes/weak-random-pass.js +181 -0
  25. package/dist/analysis/passes/weak-random-pass.js.map +1 -0
  26. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  27. package/dist/analysis/taint-matcher.js +28 -13
  28. package/dist/analysis/taint-matcher.js.map +1 -1
  29. package/dist/analyzer.d.ts.map +1 -1
  30. package/dist/analyzer.js +12 -0
  31. package/dist/analyzer.js.map +1 -1
  32. package/dist/browser/circle-ir.js +852 -57
  33. package/dist/core/circle-ir-core.cjs +25 -26
  34. package/dist/core/circle-ir-core.js +25 -26
  35. package/package.json +1 -1
@@ -1,30 +1,26 @@
1
1
  /**
2
2
  * Pass: insecure-cookie (CWE-614, category: security)
3
3
  *
4
- * JavaScript / TypeScript pattern pass that flags Express `res.cookie(name,
5
- * value, options)` calls where the options object is missing or does not
6
- * set both `secure: true` and `httpOnly: true`.
4
+ * Pattern pass flags cookie set operations that are missing the `Secure`
5
+ * or `HttpOnly` flags. This is a configuration/absence vulnerability (the
6
+ * cookie value itself does not need to be tainted), so it is detected by
7
+ * inspecting call-site option literals rather than via taint flow.
7
8
  *
8
- * Rationale: the absence of `Secure` / `HttpOnly` flags is a vulnerability
9
- * of *shape*, not of taint. `insecure_cookie` is already modeled as a
10
- * Java sink (`new Cookie(...)`) via the YAML config, but the equivalent
11
- * Express pattern uses a literal options object whose presence/absence
12
- * of flags must be inspected at the call site. The receiver type does
13
- * not propagate cleanly through middleware, so we do a syntactic check
14
- * on the literal source-text of arg 2.
15
- *
16
- * Detection:
17
- * 1. Filter language to javascript/typescript.
18
- * 2. Iterate `graph.ir.calls` for `method_name === 'cookie'` with a
19
- * receiver that looks like an Express response (`res`, `response`,
20
- * `reply`, `ctx.cookies` is intentionally excluded Koa's API has
21
- * different semantics).
22
- * 3. Read the raw expression text of arg 2 (the options object).
23
- * 4. Flag if:
24
- * - arg 2 is absent, OR
25
- * - arg 2 does not contain `secure: true` (regex), OR
26
- * - arg 2 does not contain `httpOnly: true` (regex).
27
- * 5. Emit a single finding per call site listing the missing flags.
9
+ * Detection per language:
10
+ * JavaScript / TypeScript:
11
+ * - Express `res.cookie(name, value, options)` flag if options object
12
+ * (arg 2) is absent OR does not literally contain `secure: true` and
13
+ * `httpOnly: true`.
14
+ * Python:
15
+ * - Flask / Django / Starlette `response.set_cookie(name, value, **kw)`
16
+ * — flag if `secure=True` and `httponly=True` keyword args are not
17
+ * present in the call expression text.
18
+ * Java:
19
+ * - `new javax.servlet.http.Cookie("name", "value")` flag the
20
+ * construction site if no `.setSecure(true)` AND `.setHttpOnly(true)`
21
+ * calls appear in the same source file (text-based heuristic; a
22
+ * full DFG-based version would require tracking the assigned
23
+ * variable through CFG).
28
24
  *
29
25
  * Excluded (intentionally not flagged):
30
26
  * - `res.clearCookie(...)` — clears, not sets.
@@ -49,5 +45,9 @@ export declare class InsecureCookiePass implements AnalysisPass<InsecureCookieRe
49
45
  readonly name = "insecure-cookie";
50
46
  readonly category: "security";
51
47
  run(ctx: PassContext): InsecureCookieResult;
48
+ private detectJs;
49
+ private detectPython;
50
+ private detectJavaCookieCtor;
51
+ private emit;
52
52
  }
53
53
  //# sourceMappingURL=insecure-cookie-pass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecure-cookie-pass.d.ts","sourceRoot":"","sources":["../../../src/analysis/passes/insecure-cookie-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAS9E,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;QACvB,eAAe,EAAE,OAAO,CAAC;QACzB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC,CAAC;CACJ;AAED,qBAAa,kBAAmB,YAAW,YAAY,CAAC,oBAAoB,CAAC;IAC3E,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,QAAQ,EAAG,UAAU,CAAU;IAExC,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,oBAAoB;CAoE5C"}
1
+ {"version":3,"file":"insecure-cookie-pass.d.ts","sourceRoot":"","sources":["../../../src/analysis/passes/insecure-cookie-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAqB9E,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;QACvB,eAAe,EAAE,OAAO,CAAC;QACzB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC,CAAC;CACJ;AAED,qBAAa,kBAAmB,YAAW,YAAY,CAAC,oBAAoB,CAAC;IAC3E,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,QAAQ,EAAG,UAAU,CAAU;IAExC,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,oBAAoB;IAqC3C,OAAO,CAAC,QAAQ;IA2BhB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,IAAI;CAwCb"}
@@ -1,30 +1,26 @@
1
1
  /**
2
2
  * Pass: insecure-cookie (CWE-614, category: security)
3
3
  *
4
- * JavaScript / TypeScript pattern pass that flags Express `res.cookie(name,
5
- * value, options)` calls where the options object is missing or does not
6
- * set both `secure: true` and `httpOnly: true`.
4
+ * Pattern pass flags cookie set operations that are missing the `Secure`
5
+ * or `HttpOnly` flags. This is a configuration/absence vulnerability (the
6
+ * cookie value itself does not need to be tainted), so it is detected by
7
+ * inspecting call-site option literals rather than via taint flow.
7
8
  *
8
- * Rationale: the absence of `Secure` / `HttpOnly` flags is a vulnerability
9
- * of *shape*, not of taint. `insecure_cookie` is already modeled as a
10
- * Java sink (`new Cookie(...)`) via the YAML config, but the equivalent
11
- * Express pattern uses a literal options object whose presence/absence
12
- * of flags must be inspected at the call site. The receiver type does
13
- * not propagate cleanly through middleware, so we do a syntactic check
14
- * on the literal source-text of arg 2.
15
- *
16
- * Detection:
17
- * 1. Filter language to javascript/typescript.
18
- * 2. Iterate `graph.ir.calls` for `method_name === 'cookie'` with a
19
- * receiver that looks like an Express response (`res`, `response`,
20
- * `reply`, `ctx.cookies` is intentionally excluded Koa's API has
21
- * different semantics).
22
- * 3. Read the raw expression text of arg 2 (the options object).
23
- * 4. Flag if:
24
- * - arg 2 is absent, OR
25
- * - arg 2 does not contain `secure: true` (regex), OR
26
- * - arg 2 does not contain `httpOnly: true` (regex).
27
- * 5. Emit a single finding per call site listing the missing flags.
9
+ * Detection per language:
10
+ * JavaScript / TypeScript:
11
+ * - Express `res.cookie(name, value, options)` flag if options object
12
+ * (arg 2) is absent OR does not literally contain `secure: true` and
13
+ * `httpOnly: true`.
14
+ * Python:
15
+ * - Flask / Django / Starlette `response.set_cookie(name, value, **kw)`
16
+ * — flag if `secure=True` and `httponly=True` keyword args are not
17
+ * present in the call expression text.
18
+ * Java:
19
+ * - `new javax.servlet.http.Cookie("name", "value")` flag the
20
+ * construction site if no `.setSecure(true)` AND `.setHttpOnly(true)`
21
+ * calls appear in the same source file (text-based heuristic; a
22
+ * full DFG-based version would require tracking the assigned
23
+ * variable through CFG).
28
24
  *
29
25
  * Excluded (intentionally not flagged):
30
26
  * - `res.clearCookie(...)` — clears, not sets.
@@ -35,75 +31,169 @@
35
31
  * We flag the call (RHS is opaque) unless `secure: true` and
36
32
  * `httpOnly: true` appear literally. Users can suppress via config.
37
33
  */
34
+ // ---------- JS / TS ----------
38
35
  const COOKIE_RESPONSE_RECEIVERS = new Set([
39
36
  'res', 'response', 'reply',
40
37
  ]);
41
38
  const SECURE_TRUE_RE = /\bsecure\s*:\s*true\b/;
42
39
  const HTTPONLY_TRUE_RE = /\bhttpOnly\s*:\s*true\b/i;
40
+ // ---------- Python ----------
41
+ const PY_SET_COOKIE_RECEIVERS = new Set([
42
+ 'response', 'resp', 'res',
43
+ ]);
44
+ const PY_SECURE_TRUE_RE = /\bsecure\s*=\s*True\b/;
45
+ const PY_HTTPONLY_TRUE_RE = /\bhttponly\s*=\s*True\b/i;
46
+ // ---------- Java ----------
47
+ const JAVA_SET_SECURE_TRUE_RE = /\.setSecure\s*\(\s*true\s*\)/;
48
+ const JAVA_SET_HTTPONLY_TRUE_RE = /\.setHttpOnly\s*\(\s*true\s*\)/;
43
49
  export class InsecureCookiePass {
44
50
  name = 'insecure-cookie';
45
51
  category = 'security';
46
52
  run(ctx) {
47
- const { graph, language } = ctx;
48
- if (language !== 'javascript' && language !== 'typescript') {
49
- return { insecureCookies: [] };
50
- }
53
+ const { graph, language, code } = ctx;
51
54
  const file = graph.ir.meta.file;
52
55
  const insecureCookies = [];
53
- for (const call of graph.ir.calls) {
54
- if (call.method_name !== 'cookie')
55
- continue;
56
- const receiver = call.receiver ?? '';
57
- if (!COOKIE_RESPONSE_RECEIVERS.has(receiver))
58
- continue;
59
- // Must look like a setter call: at least (name, value) args.
60
- // `res.cookie('name')` (Express getter form) takes one arg — skip.
61
- if (call.arguments.length < 2)
62
- continue;
63
- const opts = call.arguments.find(a => a.position === 2);
64
- const optsExpr = (opts?.expression ?? '').trim();
65
- const optionsPresent = optsExpr.length > 0;
66
- const missingSecure = !SECURE_TRUE_RE.test(optsExpr);
67
- const missingHttpOnly = !HTTPONLY_TRUE_RE.test(optsExpr);
68
- if (!missingSecure && !missingHttpOnly)
69
- continue;
70
- const line = call.location.line;
71
- insecureCookies.push({
72
- line,
73
- receiver,
74
- missingSecure,
75
- missingHttpOnly,
76
- optionsPresent,
77
- });
78
- const missing = [];
79
- if (missingSecure)
80
- missing.push('`secure: true`');
81
- if (missingHttpOnly)
82
- missing.push('`httpOnly: true`');
83
- ctx.addFinding({
84
- id: `${this.name}-${file}-${line}`,
85
- pass: this.name,
86
- category: this.category,
87
- rule_id: this.name,
88
- cwe: 'CWE-614',
89
- severity: 'medium',
90
- level: 'warning',
91
- message: `Cookie set without ${missing.join(' and ')} — vulnerable to ` +
92
- `cleartext transmission (CWE-614) and client-side JS access ` +
93
- `(CWE-1004).`,
94
- file,
95
- line,
96
- fix: 'Pass `{ secure: true, httpOnly: true, sameSite: "lax" }` as the ' +
97
- 'third argument to `res.cookie()`.',
98
- evidence: {
99
- receiver,
100
- options_present: optionsPresent,
101
- missing_secure: missingSecure,
102
- missing_http_only: missingHttpOnly,
103
- },
104
- });
56
+ if (language === 'javascript' || language === 'typescript') {
57
+ for (const call of graph.ir.calls) {
58
+ const det = this.detectJs(call);
59
+ if (!det)
60
+ continue;
61
+ insecureCookies.push(det);
62
+ this.emit(ctx, file, det, 'js');
63
+ }
64
+ }
65
+ else if (language === 'python') {
66
+ for (const call of graph.ir.calls) {
67
+ const det = this.detectPython(call);
68
+ if (!det)
69
+ continue;
70
+ insecureCookies.push(det);
71
+ this.emit(ctx, file, det, 'python');
72
+ }
73
+ }
74
+ else if (language === 'java') {
75
+ // Java text-based heuristic: detect `new Cookie(...)` constructor calls,
76
+ // then look in the file source for `.setSecure(true)` and `.setHttpOnly(true)`
77
+ // anywhere. Misses only when those setters exist in another file.
78
+ const hasSetSecureTrue = JAVA_SET_SECURE_TRUE_RE.test(code);
79
+ const hasSetHttpOnlyTrue = JAVA_SET_HTTPONLY_TRUE_RE.test(code);
80
+ for (const call of graph.ir.calls) {
81
+ const det = this.detectJavaCookieCtor(call, hasSetSecureTrue, hasSetHttpOnlyTrue);
82
+ if (!det)
83
+ continue;
84
+ insecureCookies.push(det);
85
+ this.emit(ctx, file, det, 'java');
86
+ }
105
87
  }
106
88
  return { insecureCookies };
107
89
  }
90
+ // ---------------- JS / TS ----------------
91
+ detectJs(call) {
92
+ if (call.method_name !== 'cookie')
93
+ return null;
94
+ const receiver = call.receiver ?? '';
95
+ if (!COOKIE_RESPONSE_RECEIVERS.has(receiver))
96
+ return null;
97
+ // Must look like a setter call: at least (name, value) args.
98
+ // `res.cookie('name')` (Express getter form) takes one arg — skip.
99
+ if (call.arguments.length < 2)
100
+ return null;
101
+ const opts = call.arguments.find((a) => a.position === 2);
102
+ const optsExpr = (opts?.expression ?? '').trim();
103
+ const optionsPresent = optsExpr.length > 0;
104
+ const missingSecure = !SECURE_TRUE_RE.test(optsExpr);
105
+ const missingHttpOnly = !HTTPONLY_TRUE_RE.test(optsExpr);
106
+ if (!missingSecure && !missingHttpOnly)
107
+ return null;
108
+ return {
109
+ line: call.location.line,
110
+ receiver,
111
+ missingSecure,
112
+ missingHttpOnly,
113
+ optionsPresent,
114
+ };
115
+ }
116
+ // ---------------- Python ----------------
117
+ detectPython(call) {
118
+ if (call.method_name !== 'set_cookie')
119
+ return null;
120
+ const receiver = call.receiver ?? '';
121
+ if (!PY_SET_COOKIE_RECEIVERS.has(receiver))
122
+ return null;
123
+ // Concatenate all argument expression text — keyword args may appear in
124
+ // any position past the leading positional args.
125
+ const argsBlob = call.arguments.map((a) => a.expression ?? '').join(', ');
126
+ const missingSecure = !PY_SECURE_TRUE_RE.test(argsBlob);
127
+ const missingHttpOnly = !PY_HTTPONLY_TRUE_RE.test(argsBlob);
128
+ if (!missingSecure && !missingHttpOnly)
129
+ return null;
130
+ return {
131
+ line: call.location.line,
132
+ receiver,
133
+ missingSecure,
134
+ missingHttpOnly,
135
+ optionsPresent: call.arguments.length >= 2,
136
+ };
137
+ }
138
+ // ---------------- Java ----------------
139
+ detectJavaCookieCtor(call, hasSetSecureTrue, hasSetHttpOnlyTrue) {
140
+ // Java constructor: method_name === 'Cookie', receiver is null,
141
+ // receiver_type === 'Cookie' (set by the Java plugin). Some plugins
142
+ // also set call.is_constructor — accept any of the indicators.
143
+ if (call.method_name !== 'Cookie')
144
+ return null;
145
+ const looksLikeCtor = call.is_constructor ||
146
+ (!call.receiver && call.receiver_type === 'Cookie') ||
147
+ (call.resolution?.target ?? '').endsWith('.<init>');
148
+ if (!looksLikeCtor)
149
+ return null;
150
+ // Need at least (name, value).
151
+ if (call.arguments.length < 2)
152
+ return null;
153
+ const missingSecure = !hasSetSecureTrue;
154
+ const missingHttpOnly = !hasSetHttpOnlyTrue;
155
+ if (!missingSecure && !missingHttpOnly)
156
+ return null;
157
+ return {
158
+ line: call.location.line,
159
+ receiver: 'new Cookie',
160
+ missingSecure,
161
+ missingHttpOnly,
162
+ optionsPresent: false,
163
+ };
164
+ }
165
+ emit(ctx, file, det, flavor) {
166
+ const missing = [];
167
+ if (det.missingSecure)
168
+ missing.push(flavor === 'js' ? '`secure: true`' : flavor === 'python' ? '`secure=True`' : '`setSecure(true)`');
169
+ if (det.missingHttpOnly)
170
+ missing.push(flavor === 'js' ? '`httpOnly: true`' : flavor === 'python' ? '`httponly=True`' : '`setHttpOnly(true)`');
171
+ const fix = flavor === 'js'
172
+ ? 'Pass `{ secure: true, httpOnly: true, sameSite: "lax" }` as the third argument to `res.cookie()`.'
173
+ : flavor === 'python'
174
+ ? 'Pass `secure=True, httponly=True, samesite="Lax"` to `response.set_cookie(...)`.'
175
+ : 'After constructing the cookie, call `cookie.setSecure(true)` and `cookie.setHttpOnly(true)` before adding it to the response.';
176
+ ctx.addFinding({
177
+ id: `${this.name}-${file}-${det.line}`,
178
+ pass: this.name,
179
+ category: this.category,
180
+ rule_id: this.name,
181
+ cwe: 'CWE-614',
182
+ severity: 'medium',
183
+ level: 'warning',
184
+ message: `Cookie set without ${missing.join(' and ')} — vulnerable to ` +
185
+ `cleartext transmission (CWE-614) and client-side JS access ` +
186
+ `(CWE-1004).`,
187
+ file,
188
+ line: det.line,
189
+ fix,
190
+ evidence: {
191
+ receiver: det.receiver,
192
+ options_present: det.optionsPresent,
193
+ missing_secure: det.missingSecure,
194
+ missing_http_only: det.missingHttpOnly,
195
+ },
196
+ });
197
+ }
108
198
  }
109
199
  //# sourceMappingURL=insecure-cookie-pass.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecure-cookie-pass.js","sourceRoot":"","sources":["../../../src/analysis/passes/insecure-cookie-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,MAAM,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EAAE,GAAG,CAAC,IAAI;YACd,GAAG;YACH,QAAQ,EAAE;gBACR,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,eAAe,EAAE,GAAG,CAAC,cAAc;gBACnC,cAAc,EAAE,GAAG,CAAC,aAAa;gBACjC,iBAAiB,EAAE,GAAG,CAAC,eAAe;aACvC;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Pass: tls-verify-disabled (CWE-295, category: security)
3
+ *
4
+ * Pattern pass — flags places where TLS certificate / hostname verification
5
+ * is explicitly disabled. This is a *configuration* vulnerability (the bad
6
+ * value is hard-coded, no taint flow is involved).
7
+ *
8
+ * Detection per language:
9
+ * Go:
10
+ * - `&tls.Config{InsecureSkipVerify: true}` (composite literal)
11
+ * - Detected via call argument scan: when the receiver is `tls` and
12
+ * call/composite contains literal `InsecureSkipVerify: true`, OR via
13
+ * a syntactic text scan (composite literals are not always emitted
14
+ * as calls in IR).
15
+ * Python:
16
+ * - `requests.get|post|put|delete|patch|head|options|request(..., verify=False)`
17
+ * - `ssl._create_unverified_context()` / `ssl._create_default_https_context = ssl._create_unverified_context`
18
+ * - `urllib3.disable_warnings(InsecureRequestWarning)` — best-effort hint
19
+ * - `httpx.Client(verify=False)` / `httpx.get(..., verify=False)`
20
+ * JavaScript / TypeScript:
21
+ * - `{ rejectUnauthorized: false }` in https.request / fetch options /
22
+ * node-fetch / axios — text scan on arg expressions
23
+ * - `https.Agent({ rejectUnauthorized: false })`
24
+ * - `process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'` (assignment;
25
+ * detected via call to property assignment — best-effort)
26
+ * Java:
27
+ * - Custom `HostnameVerifier` that returns true unconditionally
28
+ * (lambdas `(h, s) -> true` / anonymous classes) — detected via
29
+ * textual scan on setHostnameVerifier arg expression.
30
+ * - `setHostnameVerifier(NoopHostnameVerifier.INSTANCE)` /
31
+ * `setHostnameVerifier(new AllowAllHostnameVerifier())`
32
+ *
33
+ * Aligned with: gosec G402 (Go), Bandit B501/B502/B504/B505 (Python).
34
+ */
35
+ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js';
36
+ export interface TlsVerifyDisabledResult {
37
+ findings: Array<{
38
+ line: number;
39
+ language: string;
40
+ pattern: string;
41
+ api: string;
42
+ }>;
43
+ }
44
+ export declare class TlsVerifyDisabledPass implements AnalysisPass<TlsVerifyDisabledResult> {
45
+ readonly name = "tls-verify-disabled";
46
+ readonly category: "security";
47
+ run(ctx: PassContext): TlsVerifyDisabledResult;
48
+ private detectCall;
49
+ private detectSourceText;
50
+ private fixFor;
51
+ }
52
+ //# sourceMappingURL=tls-verify-disabled-pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-verify-disabled-pass.d.ts","sourceRoot":"","sources":["../../../src/analysis/passes/tls-verify-disabled-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAsB9E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;CACJ;AAED,qBAAa,qBAAsB,YAAW,YAAY,CAAC,uBAAuB,CAAC;IACjF,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,QAAQ,EAAG,UAAU,CAAU;IAExC,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,uBAAuB;IA6D9C,OAAO,CAAC,UAAU;IA4ElB,OAAO,CAAC,gBAAgB;IAiDxB,OAAO,CAAC,MAAM;CA2Bf"}