circle-ir 3.174.0 → 3.175.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/configs/sinks/open_redirect.yaml +21 -0
- package/configs/sinks/trust_boundary.yaml +18 -0
- package/dist/analysis/config-loader.d.ts.map +1 -1
- package/dist/analysis/config-loader.js +100 -1
- package/dist/analysis/config-loader.js.map +1 -1
- package/dist/browser/circle-ir.js +72 -2
- package/dist/core/circle-ir-core.cjs +72 -2
- package/dist/core/circle-ir-core.js +72 -2
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Reference-only. Runtime uses OPEN_REDIRECT_FRAMEWORK_SINKS + classless `redirect` + net/http.Redirect + Java sendRedirect in src/analysis/config-loader.ts. See cognium-dev#240.",
|
|
3
|
+
"sinks": [
|
|
4
|
+
{ "method": "HttpResponseRedirect", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["python"] },
|
|
5
|
+
{ "method": "HttpResponsePermanentRedirect", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["python"] },
|
|
6
|
+
{ "method": "RedirectResponse", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["python"] },
|
|
7
|
+
|
|
8
|
+
{ "method": "redirect", "class": "Context", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["javascript", "typescript"] },
|
|
9
|
+
{ "method": "redirect", "class": "FastifyReply", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["javascript", "typescript"] },
|
|
10
|
+
{ "method": "location", "class": "Response", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["javascript", "typescript"] },
|
|
11
|
+
{ "method": "redirect", "class": "NextResponse", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["javascript", "typescript"] },
|
|
12
|
+
|
|
13
|
+
{ "method": "RedirectView", "class": "RedirectView", "type": "open_redirect", "cwe": "CWE-601", "severity": "high", "arg_positions": [0], "languages": ["java"] },
|
|
14
|
+
{ "method": "setUrl", "class": "RedirectView", "type": "open_redirect", "cwe": "CWE-601", "severity": "high", "arg_positions": [0], "languages": ["java"] },
|
|
15
|
+
{ "method": "seeOther", "class": "Response", "type": "open_redirect", "cwe": "CWE-601", "severity": "high", "arg_positions": [0], "languages": ["java"] },
|
|
16
|
+
{ "method": "temporaryRedirect", "class": "Response", "type": "open_redirect", "cwe": "CWE-601", "severity": "high", "arg_positions": [0], "languages": ["java"] },
|
|
17
|
+
|
|
18
|
+
{ "method": "Redirect", "class": "Context", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [1], "languages": ["go"] },
|
|
19
|
+
{ "method": "Redirect", "class": "Ctx", "type": "open_redirect", "cwe": "CWE-601", "severity": "medium", "arg_positions": [0], "languages": ["go"] }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Reference-only. Runtime uses TRUST_BOUNDARY_FRAMEWORK_SINKS plus existing HttpSession/ServletContext/HttpServletRequest setAttribute entries in src/analysis/config-loader.ts. See cognium-dev#240 (extends #117).",
|
|
3
|
+
"sinks": [
|
|
4
|
+
{ "method": "set", "class": "cache", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["python"] },
|
|
5
|
+
{ "method": "set_many", "class": "cache", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [0], "languages": ["python"] },
|
|
6
|
+
|
|
7
|
+
{ "method": "setItem", "class": "Storage", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["javascript", "typescript"] },
|
|
8
|
+
{ "method": "cookie", "class": "Response", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["javascript", "typescript"] },
|
|
9
|
+
|
|
10
|
+
{ "method": "Cookie", "class": "Cookie", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["java"] },
|
|
11
|
+
{ "method": "setValue", "class": "Cookie", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [0], "languages": ["java"] },
|
|
12
|
+
{ "method": "setAuthentication", "class": "SecurityContext", "type": "trust_boundary", "cwe": "CWE-501", "severity": "high", "arg_positions": [0], "languages": ["java"] },
|
|
13
|
+
{ "method": "setProperty", "class": "System", "type": "trust_boundary", "cwe": "CWE-501", "severity": "high", "arg_positions": [1], "languages": ["java"] },
|
|
14
|
+
|
|
15
|
+
{ "method": "SetCookie", "class": "http", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["go"] },
|
|
16
|
+
{ "method": "SetCookie", "class": "Context", "type": "trust_boundary", "cwe": "CWE-501", "severity": "medium", "arg_positions": [1], "languages": ["go"] }
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,CAiB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG;IACtD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAcA;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,kBAAkB,EAAE,CAQtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,qBAAqB,GAAE,MAAM,EAAO,GACnC,WAAW,CAYb;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EA6hB1C,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,CAiB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG;IACtD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAcA;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,kBAAkB,EAAE,CAQtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,qBAAqB,GAAE,MAAM,EAAO,GACnC,WAAW,CAYb;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EA6hB1C,CAAC;AAmGF,eAAO,MAAM,aAAa,EAAE,WAAW,EAwuDtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAwThD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,EAiDtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAO9C;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,EA8F5C,CAAC"}
|
|
@@ -555,6 +555,95 @@ export const DEFAULT_SOURCES = [
|
|
|
555
555
|
{ method: 'decode', class: 'JWT', type: 'http_header', severity: 'high', return_tainted: true, languages: ['java'] },
|
|
556
556
|
{ method: 'ParseUnverified', class: 'jwt', type: 'http_header', severity: 'high', return_tainted: true, languages: ['go'] },
|
|
557
557
|
];
|
|
558
|
+
// =========================================================================
|
|
559
|
+
// cognium-dev #240 ship 1 — extend open_redirect (CWE-601) framework coverage
|
|
560
|
+
//
|
|
561
|
+
// Extracted from DEFAULT_SINKS to keep the main-array literal within the
|
|
562
|
+
// TypeScript union-type inference complexity limit (TS2590). Spread into
|
|
563
|
+
// DEFAULT_SINKS below.
|
|
564
|
+
//
|
|
565
|
+
// Baseline (variant-coverage.md): 11 probes, 1 fires, 10 FN. Existing
|
|
566
|
+
// coverage: Java HttpServletResponse.sendRedirect, Node classless
|
|
567
|
+
// `redirect`, Go net/http.Redirect, Rust actix Redirect/HttpResponse.
|
|
568
|
+
// Adds Python (django/starlette/fastapi), JS/TS (koa/fastify/express
|
|
569
|
+
// location + next.js), Java (RedirectView + JAX-RS Response), Go
|
|
570
|
+
// (gin/echo/fiber).
|
|
571
|
+
// =========================================================================
|
|
572
|
+
const OPEN_REDIRECT_FRAMEWORK_SINKS = [
|
|
573
|
+
// --- Python: django / starlette / fastapi -------------------------------
|
|
574
|
+
{ method: 'HttpResponseRedirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['python'] },
|
|
575
|
+
{ method: 'HttpResponsePermanentRedirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['python'] },
|
|
576
|
+
{ method: 'RedirectResponse', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['python'] },
|
|
577
|
+
// --- JS/TS: koa / fastify / express / next.js ---------------------------
|
|
578
|
+
{ method: 'redirect', class: 'Context', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['javascript', 'typescript'] },
|
|
579
|
+
{ method: 'redirect', class: 'FastifyReply', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['javascript', 'typescript'] },
|
|
580
|
+
// Express: res.location(url) sets Location header without redirect status,
|
|
581
|
+
// still an open-redirect vector when combined with a downstream redirect.
|
|
582
|
+
{ method: 'location', class: 'Response', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['javascript', 'typescript'] },
|
|
583
|
+
// Next.js App Router: NextResponse.redirect(url) — static method matched
|
|
584
|
+
// by receiver-class name.
|
|
585
|
+
{ method: 'redirect', class: 'NextResponse', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['javascript', 'typescript'] },
|
|
586
|
+
// --- Java: Spring MVC RedirectView + JAX-RS Response --------------------
|
|
587
|
+
{ method: 'RedirectView', class: 'RedirectView', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0], languages: ['java'] },
|
|
588
|
+
{ method: 'setUrl', class: 'RedirectView', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0], languages: ['java'] },
|
|
589
|
+
// JAX-RS Response builder — static factory methods that take a target URI.
|
|
590
|
+
{ method: 'seeOther', class: 'Response', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0], languages: ['java'] },
|
|
591
|
+
{ method: 'temporaryRedirect', class: 'Response', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0], languages: ['java'] },
|
|
592
|
+
// --- Go: gin / echo / fiber ---------------------------------------------
|
|
593
|
+
// gin/echo: c.Redirect(302, url) — status at arg[0], url at arg[1].
|
|
594
|
+
// fiber: c.Redirect(url) — url at arg[0].
|
|
595
|
+
// These entries fire once Go local-receiver type resolution lands
|
|
596
|
+
// (see taint-matcher.ts:2137 receiverMightBeClass — currently returns
|
|
597
|
+
// false for `c` against 'Context'/'Ctx'). Until then, the
|
|
598
|
+
// external_taint_escape fallback preserves recall on these call sites.
|
|
599
|
+
// net/http.Redirect (class 'http') is unaffected — declares class 'http'
|
|
600
|
+
// and matches via package receiver.
|
|
601
|
+
{ method: 'Redirect', class: 'Context', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [1], languages: ['go'] },
|
|
602
|
+
{ method: 'Redirect', class: 'Ctx', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['go'] },
|
|
603
|
+
];
|
|
604
|
+
// =========================================================================
|
|
605
|
+
// cognium-dev #240 ship 1 — extend trust_boundary (CWE-501) framework coverage
|
|
606
|
+
//
|
|
607
|
+
// Extracted from DEFAULT_SINKS (see note above). Spread into DEFAULT_SINKS
|
|
608
|
+
// below.
|
|
609
|
+
//
|
|
610
|
+
// Baseline (variant-coverage.md): 16 probes, 0 fires, 16 FN. Existing
|
|
611
|
+
// coverage: Java HttpSession / ServletContext / HttpServletRequest
|
|
612
|
+
// setAttribute (issue #117), Python session.__setitem__. Adds Django
|
|
613
|
+
// cache, JS Storage.setItem, Express res.cookie, Java Cookie /
|
|
614
|
+
// SecurityContext / System.setProperty, Go http.SetCookie / gin.SetCookie.
|
|
615
|
+
//
|
|
616
|
+
// Severity `medium` unless the sink pollutes a process-wide store
|
|
617
|
+
// (System.setProperty → high).
|
|
618
|
+
// =========================================================================
|
|
619
|
+
const TRUST_BOUNDARY_FRAMEWORK_SINKS = [
|
|
620
|
+
// --- Python: Django cache write -----------------------------------------
|
|
621
|
+
{ method: 'set', class: 'cache', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['python'] },
|
|
622
|
+
{ method: 'set_many', class: 'cache', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [0], languages: ['python'] },
|
|
623
|
+
// --- JS/TS: client-side Storage + Express cookie ------------------------
|
|
624
|
+
// localStorage / sessionStorage — browser Storage.setItem(key, value).
|
|
625
|
+
{ method: 'setItem', class: 'Storage', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['javascript', 'typescript'] },
|
|
626
|
+
// Express: res.cookie(name, value, opts) — cookie-jar write.
|
|
627
|
+
{ method: 'cookie', class: 'Response', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['javascript', 'typescript'] },
|
|
628
|
+
// --- Java: Cookie / SecurityContext / System.setProperty ----------------
|
|
629
|
+
// `new Cookie(name, value)` — constructor with tainted value crosses the
|
|
630
|
+
// client-server trust boundary via Set-Cookie.
|
|
631
|
+
{ method: 'Cookie', class: 'Cookie', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['java'] },
|
|
632
|
+
{ method: 'setValue', class: 'Cookie', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [0], languages: ['java'] },
|
|
633
|
+
// Spring Security: SecurityContext.setAuthentication(userSuppliedAuth) —
|
|
634
|
+
// installs an untrusted principal into the request-scoped security
|
|
635
|
+
// context; downstream authz decisions become attacker-controlled.
|
|
636
|
+
{ method: 'setAuthentication', class: 'SecurityContext', type: 'trust_boundary', cwe: 'CWE-501', severity: 'high', arg_positions: [0], languages: ['java'] },
|
|
637
|
+
// JVM-wide System property write with tainted value pollutes process
|
|
638
|
+
// state observable to every thread.
|
|
639
|
+
{ method: 'setProperty', class: 'System', type: 'trust_boundary', cwe: 'CWE-501', severity: 'high', arg_positions: [1], languages: ['java'] },
|
|
640
|
+
// --- Go: http.SetCookie / gin.SetCookie ---------------------------------
|
|
641
|
+
// Package-level `http.SetCookie(w, &http.Cookie{Value: tainted})` — sink
|
|
642
|
+
// on arg[1] (the *Cookie) catches struct-literal composite tainting.
|
|
643
|
+
{ method: 'SetCookie', class: 'http', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['go'] },
|
|
644
|
+
// gin: c.SetCookie(name, value, maxAge, path, domain, secure, httpOnly).
|
|
645
|
+
{ method: 'SetCookie', class: 'Context', type: 'trust_boundary', cwe: 'CWE-501', severity: 'medium', arg_positions: [1], languages: ['go'] },
|
|
646
|
+
];
|
|
558
647
|
export const DEFAULT_SINKS = [
|
|
559
648
|
// SQL Injection (CWE-89)
|
|
560
649
|
{ method: 'executeQuery', class: 'Statement', type: 'sql_injection', cwe: 'CWE-89', severity: 'critical', arg_positions: [0] },
|
|
@@ -1915,7 +2004,10 @@ export const DEFAULT_SINKS = [
|
|
|
1915
2004
|
{ method: 'parse', class: 'Uri', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0] },
|
|
1916
2005
|
// Rust Open Redirect
|
|
1917
2006
|
{ method: 'redirect', class: 'HttpResponse', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0] },
|
|
1918
|
-
|
|
2007
|
+
// Actix/warp `Redirect::to(url)` — scoped to Rust to avoid collision with
|
|
2008
|
+
// Go's `c.Redirect(status, url)` on gin/echo, which lives further down in
|
|
2009
|
+
// the OPEN_REDIRECT_FRAMEWORK_SINKS block with `arg_positions: [0, 1]`.
|
|
2010
|
+
{ method: 'Redirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'medium', arg_positions: [0], languages: ['rust'] },
|
|
1919
2011
|
{ method: 'see_other', class: 'Redirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0] },
|
|
1920
2012
|
{ method: 'to', class: 'Redirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0] },
|
|
1921
2013
|
{ method: 'temporary', class: 'Redirect', type: 'open_redirect', cwe: 'CWE-601', severity: 'high', arg_positions: [0] },
|
|
@@ -2198,6 +2290,13 @@ export const DEFAULT_SINKS = [
|
|
|
2198
2290
|
{ method: 'Call', class: 'LLM', type: 'prompt_injection', cwe: 'CWE-1427', severity: 'high', arg_positions: [0, 1, 2, 3], languages: ['go'] },
|
|
2199
2291
|
{ method: 'Generate', class: 'LLM', type: 'prompt_injection', cwe: 'CWE-1427', severity: 'high', arg_positions: [0, 1, 2, 3], languages: ['go'] },
|
|
2200
2292
|
{ method: 'GenerateContent', class: 'Model', type: 'prompt_injection', cwe: 'CWE-1427', severity: 'high', arg_positions: [0, 1, 2, 3], languages: ['go'] },
|
|
2293
|
+
// cognium-dev #240 ship 1 — extended framework sinks for open_redirect
|
|
2294
|
+
// (CWE-601) and trust_boundary (CWE-501). Definitions extracted above
|
|
2295
|
+
// as OPEN_REDIRECT_FRAMEWORK_SINKS / TRUST_BOUNDARY_FRAMEWORK_SINKS to
|
|
2296
|
+
// keep the DEFAULT_SINKS literal within TypeScript's union-type
|
|
2297
|
+
// inference complexity limit (TS2590). See ~lines 661-752.
|
|
2298
|
+
...OPEN_REDIRECT_FRAMEWORK_SINKS,
|
|
2299
|
+
...TRUST_BOUNDARY_FRAMEWORK_SINKS,
|
|
2201
2300
|
];
|
|
2202
2301
|
export const DEFAULT_SANITIZERS = [
|
|
2203
2302
|
// SQL Injection - proper parameter binding sanitizes input
|