fusiontest 0.2.47__tar.gz → 0.2.49__tar.gz
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.
- {fusiontest-0.2.47 → fusiontest-0.2.49}/PKG-INFO +2 -1
- {fusiontest-0.2.47 → fusiontest-0.2.49}/README.md +1 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/security.py +163 -10
- fusiontest-0.2.49/fusiontest/bench/suites/billing-security-spa.yaml +89 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/cli.py +131 -6
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/action_model.py +4 -1
- fusiontest-0.2.49/fusiontest/core/evidence.py +147 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/runner.py +33 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/secrets.py +6 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/desktop/playwright_adapter.py +166 -3
- fusiontest-0.2.49/fusiontest/security/browser_auth.py +452 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/security/checks.py +326 -57
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/security/config.py +10 -1
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/PKG-INFO +2 -1
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/SOURCES.txt +3 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/pyproject.toml +1 -1
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/agent/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/agent/mcp_server.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/agent/verify.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/sites/shop/bugs.js +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/sites/shop/help.html +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/sites/shop/index.html +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/billing-security.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/diffs/order-retry.diff +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/diffs/sale-banner.diff +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/diffs/stock-check.diff +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/shop-bugs.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/shop-hard.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/shop-intent.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/shop.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/bench/suites/todomvc.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/app_errors.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/bugs.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/goal_verifier.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/netguard.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/promise_checker.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/replay.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/reproduce.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/screen_parser.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/shared_traces.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/core/tokens.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/fusiontest_dashboard.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/github.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/hacker_news.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/httpbin.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/todomvc.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/demos/wikipedia.yaml +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/desktop/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/desktop/macos_adapter.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/desktop/windows_adapter.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/discovery/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/discovery/goal_generator.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/discovery/intent.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/guardrails/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/guardrails/engine.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/mobile/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/mobile/android_adapter.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/mobile/ios_adapter.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/reporting/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/reporting/reporter.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/security/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/security/engine.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/security/findings.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/training/__init__.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/training/data_collector.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/training/dataset_builder.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest/training/trainer.py +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/dependency_links.txt +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/entry_points.txt +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/not-zip-safe +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/requires.txt +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/fusiontest.egg-info/top_level.txt +0 -0
- {fusiontest-0.2.47 → fusiontest-0.2.49}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fusiontest
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.49
|
|
4
4
|
Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
|
|
5
5
|
Author-email: FusionLeap <hello@fusionleap.io>
|
|
6
6
|
License: MIT
|
|
@@ -108,6 +108,7 @@ what passes as regression goals. See [docs/coding-agents.md](docs/coding-agents.
|
|
|
108
108
|
| Multi-provider LLMs | Groq, Claude, Gemini, OpenAI or local Ollama, with automatic fallback |
|
|
109
109
|
| Safe secrets | `{{PASSWORD}}` placeholders — the AI never sees values, which are only typed on allowed sites |
|
|
110
110
|
| Guardrails | Invalid-action checks, loop detection, backtracking, no-progress detection |
|
|
111
|
+
| Run evidence | Web & Electron: a video of the run, a Playwright trace per failed goal, and console and network errors, in the report and the dashboard |
|
|
111
112
|
| Reporting | JSON reports, dashboard uploads, failure screenshots, Slack, GitHub Actions annotations, webhooks |
|
|
112
113
|
| Platforms | Web (Playwright), Electron, Android & iOS (Appium), Windows, macOS |
|
|
113
114
|
|
|
@@ -27,6 +27,7 @@ what passes as regression goals. See [docs/coding-agents.md](docs/coding-agents.
|
|
|
27
27
|
| Multi-provider LLMs | Groq, Claude, Gemini, OpenAI or local Ollama, with automatic fallback |
|
|
28
28
|
| Safe secrets | `{{PASSWORD}}` placeholders — the AI never sees values, which are only typed on allowed sites |
|
|
29
29
|
| Guardrails | Invalid-action checks, loop detection, backtracking, no-progress detection |
|
|
30
|
+
| Run evidence | Web & Electron: a video of the run, a Playwright trace per failed goal, and console and network errors, in the report and the dashboard |
|
|
30
31
|
| Reporting | JSON reports, dashboard uploads, failure screenshots, Slack, GitHub Actions annotations, webhooks |
|
|
31
32
|
| Platforms | Web (Playwright), Electron, Android & iOS (Appium), Windows, macOS |
|
|
32
33
|
|
|
@@ -23,6 +23,7 @@ planted vulnerability found, no decoy reported, on two models.
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import base64
|
|
26
27
|
import functools
|
|
27
28
|
import html
|
|
28
29
|
import http.cookies
|
|
@@ -67,6 +68,8 @@ class SecurityAccount:
|
|
|
67
68
|
name: str
|
|
68
69
|
role: str
|
|
69
70
|
login: str # a sign-in goal, as in `security.accounts` (ADR-011 §3)
|
|
71
|
+
auth: str = "auto"
|
|
72
|
+
logout: str = ""
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
@dataclass
|
|
@@ -81,6 +84,7 @@ class SecuritySuite:
|
|
|
81
84
|
description: str = ""
|
|
82
85
|
platform: str = "playwright"
|
|
83
86
|
kind: str = "security"
|
|
87
|
+
path: str = "" # extra path on the fixture URL, e.g. /spa/
|
|
84
88
|
|
|
85
89
|
|
|
86
90
|
SITES = ("billing",)
|
|
@@ -100,8 +104,10 @@ def load_security_suite(data: dict, source: str) -> SecuritySuite:
|
|
|
100
104
|
raw = raw or {}
|
|
101
105
|
if not raw.get("role") or not raw.get("login"):
|
|
102
106
|
raise bad(f"account {acct_name!r} needs a role and a login goal")
|
|
103
|
-
accounts.append(SecurityAccount(
|
|
104
|
-
|
|
107
|
+
accounts.append(SecurityAccount(
|
|
108
|
+
name=str(acct_name), role=str(raw["role"]), login=str(raw["login"]),
|
|
109
|
+
auth=str(raw.get("auth") or "auto"), logout=str(raw.get("logout") or ""),
|
|
110
|
+
))
|
|
105
111
|
if len(accounts) < 2 or len({a.role for a in accounts}) < 2:
|
|
106
112
|
raise bad("needs at least two accounts and two roles, or access and roles checks can't run")
|
|
107
113
|
|
|
@@ -141,7 +147,8 @@ def load_security_suite(data: dict, source: str) -> SecuritySuite:
|
|
|
141
147
|
raise bad(f"vulnerabilities never planted in a variant: {sorted(unplanted)}")
|
|
142
148
|
return SecuritySuite(name=name, site=site, accounts=accounts, vulns=vulns, variants=variants,
|
|
143
149
|
decoys=decoys, version=int(data.get("version", 1)),
|
|
144
|
-
description=str(data.get("description", ""))
|
|
150
|
+
description=str(data.get("description", "")),
|
|
151
|
+
path=str(data.get("path") or ""))
|
|
145
152
|
|
|
146
153
|
|
|
147
154
|
def _ambiguous(specs: list[PlantedVuln]) -> tuple[str, str] | None:
|
|
@@ -310,8 +317,11 @@ def engine_checker(engine, backend: str, judge: str = "", headless: bool = True)
|
|
|
310
317
|
from fusiontest.security.engine import SecurityTarget
|
|
311
318
|
|
|
312
319
|
def check(url: str, suite: SecuritySuite) -> SecurityReport:
|
|
320
|
+
target_url = urllib.parse.urljoin(url, suite.path) if suite.path else url
|
|
313
321
|
return engine(SecurityTarget(
|
|
314
|
-
url=
|
|
322
|
+
url=target_url,
|
|
323
|
+
accounts=[Account(name=a.name, role=a.role, login=a.login,
|
|
324
|
+
auth=a.auth, logout=a.logout) for a in suite.accounts],
|
|
315
325
|
checks=list(CHECKS), allowed_hosts=["127.0.0.1"], read_only=True,
|
|
316
326
|
backend=backend, judge=judge, headless=headless))
|
|
317
327
|
return check
|
|
@@ -398,6 +408,10 @@ class _BillingHandler(http.server.BaseHTTPRequestHandler):
|
|
|
398
408
|
path, query = parsed.path, urllib.parse.parse_qs(parsed.query)
|
|
399
409
|
if path == "/app.js":
|
|
400
410
|
return self._send(200, "text/javascript", self._bundle())
|
|
411
|
+
if path in ("/spa", "/spa/"):
|
|
412
|
+
return self._send(200, "text/html; charset=utf-8", self._spa_html())
|
|
413
|
+
if path == "/spa/app.js":
|
|
414
|
+
return self._send(200, "text/javascript", self._spa_bundle())
|
|
401
415
|
if path == "/login":
|
|
402
416
|
return self._page("Sign in", self._login_form(), user=None)
|
|
403
417
|
user = self._user()
|
|
@@ -430,8 +444,24 @@ class _BillingHandler(http.server.BaseHTTPRequestHandler):
|
|
|
430
444
|
|
|
431
445
|
def do_POST(self) -> None: # noqa: N802
|
|
432
446
|
length = int(self.headers.get("Content-Length") or 0)
|
|
433
|
-
|
|
447
|
+
raw = self.rfile.read(length).decode()
|
|
434
448
|
path = urllib.parse.urlsplit(self.path).path
|
|
449
|
+
if path == "/api/token":
|
|
450
|
+
try:
|
|
451
|
+
payload = json.loads(raw) if raw else {}
|
|
452
|
+
except json.JSONDecodeError:
|
|
453
|
+
payload = {}
|
|
454
|
+
email = str(payload.get("email") or "").strip().lower()
|
|
455
|
+
password = str(payload.get("password") or "")
|
|
456
|
+
user = USERS.get(email)
|
|
457
|
+
if not user or user.password != password:
|
|
458
|
+
return self._json(401, {"error": "Wrong email or password."})
|
|
459
|
+
sid = secrets.token_urlsafe(24)
|
|
460
|
+
self.sessions[sid] = user.email
|
|
461
|
+
token = _bearer_token(sid)
|
|
462
|
+
self.sessions[token] = user.email
|
|
463
|
+
return self._json(200, {"access_token": token}, cookie=self._cookie(sid))
|
|
464
|
+
form = urllib.parse.parse_qs(raw)
|
|
435
465
|
if path == "/login":
|
|
436
466
|
email = (form.get("email") or [""])[0].strip().lower()
|
|
437
467
|
password = (form.get("password") or [""])[0]
|
|
@@ -444,8 +474,15 @@ class _BillingHandler(http.server.BaseHTTPRequestHandler):
|
|
|
444
474
|
return self._redirect("/invoices", cookie=self._cookie(sid))
|
|
445
475
|
if path == "/logout":
|
|
446
476
|
sid = self._sid()
|
|
447
|
-
|
|
448
|
-
|
|
477
|
+
token = self._bearer()
|
|
478
|
+
if "session-after-logout" not in self.vulns:
|
|
479
|
+
if sid:
|
|
480
|
+
self.sessions.pop(sid, None)
|
|
481
|
+
if token:
|
|
482
|
+
self.sessions.pop(token, None)
|
|
483
|
+
sid_from_token = _sid_from_token(token)
|
|
484
|
+
if sid_from_token:
|
|
485
|
+
self.sessions.pop(sid_from_token, None)
|
|
449
486
|
return self._redirect("/login", cookie=self._cookie("", expire=True))
|
|
450
487
|
self._page("Not found", "<p>That page doesn't exist.</p>", self._user(), status=404)
|
|
451
488
|
|
|
@@ -577,8 +614,9 @@ if (rows) {
|
|
|
577
614
|
f"<script src='/app.js'></script></body></html>")
|
|
578
615
|
self._send(status, "text/html; charset=utf-8", doc)
|
|
579
616
|
|
|
580
|
-
def _json(self, status: int, payload) -> None:
|
|
581
|
-
|
|
617
|
+
def _json(self, status: int, payload, cookie: str = "") -> None:
|
|
618
|
+
extra = {"Set-Cookie": cookie} if cookie else None
|
|
619
|
+
self._send(status, "application/json", json.dumps(payload), extra=extra)
|
|
582
620
|
|
|
583
621
|
def _redirect(self, location: str, cookie: str = "") -> None:
|
|
584
622
|
self.send_response(303)
|
|
@@ -589,12 +627,16 @@ if (rows) {
|
|
|
589
627
|
self.send_header("Content-Length", "0")
|
|
590
628
|
self.end_headers()
|
|
591
629
|
|
|
592
|
-
def _send(self, status: int, content_type: str, body: str) -> None:
|
|
630
|
+
def _send(self, status: int, content_type: str, body: str, extra: dict | None = None) -> None:
|
|
593
631
|
data = body.encode()
|
|
594
632
|
self.send_response(status)
|
|
595
633
|
self.send_header("Content-Type", content_type)
|
|
596
634
|
self.send_header("Content-Length", str(len(data)))
|
|
597
635
|
self.send_header("Cache-Control", "no-store")
|
|
636
|
+
if extra:
|
|
637
|
+
for key, value in extra.items():
|
|
638
|
+
if value:
|
|
639
|
+
self.send_header(key, value)
|
|
598
640
|
self._security_headers()
|
|
599
641
|
self.end_headers()
|
|
600
642
|
self.wfile.write(data)
|
|
@@ -622,14 +664,125 @@ if (rows) {
|
|
|
622
664
|
jar = http.cookies.SimpleCookie(self.headers.get("Cookie") or "")
|
|
623
665
|
return jar["sid"].value if "sid" in jar else ""
|
|
624
666
|
|
|
667
|
+
def _bearer(self) -> str:
|
|
668
|
+
header = self.headers.get("Authorization") or ""
|
|
669
|
+
if header.lower().startswith("bearer "):
|
|
670
|
+
return header.split(" ", 1)[1].strip()
|
|
671
|
+
return ""
|
|
672
|
+
|
|
625
673
|
def _user(self) -> _User | None:
|
|
626
674
|
email = self.sessions.get(self._sid())
|
|
675
|
+
if not email:
|
|
676
|
+
token = self._bearer()
|
|
677
|
+
email = self.sessions.get(token) if token else None
|
|
678
|
+
if not email and token:
|
|
679
|
+
email = self.sessions.get(_sid_from_token(token) or "")
|
|
627
680
|
return USERS.get(email) if email else None
|
|
628
681
|
|
|
682
|
+
def _spa_html(self) -> str:
|
|
683
|
+
return (
|
|
684
|
+
"<!doctype html><html lang='en'><head><meta charset='utf-8'>"
|
|
685
|
+
f"<title>Acme Billing</title><style>{_STYLE}</style></head>"
|
|
686
|
+
"<body><div id='root'></div><script src='/spa/app.js'></script></body></html>"
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
def _spa_bundle(self) -> str:
|
|
690
|
+
keys = [f'const STRIPE_PUBLISHABLE = "{_PUBLISHABLE}";',
|
|
691
|
+
f'const STRIPE_TEST_SECRET = "{_TEST_SECRET}"; // local dev only']
|
|
692
|
+
if "leaked-key" in self.vulns:
|
|
693
|
+
keys.append(f'const STRIPE_SECRET = "{_LIVE_SECRET}";')
|
|
694
|
+
return "\n".join(keys) + r"""
|
|
695
|
+
const root = document.getElementById("root");
|
|
696
|
+
const token = localStorage.getItem("access_token");
|
|
697
|
+
const auth = token ? {Authorization: "Bearer " + token} : {};
|
|
698
|
+
|
|
699
|
+
function renderLogin() {
|
|
700
|
+
root.innerHTML = "<h1>Sign in</h1>" +
|
|
701
|
+
"<p><label>Email <input id='email' type='email' autocomplete='username'></label></p>" +
|
|
702
|
+
"<p><label>Password <input id='password' type='password'></label></p>" +
|
|
703
|
+
"<p><button type='button' id='signin'>Sign in</button></p>";
|
|
704
|
+
document.getElementById("signin").onclick = async () => {
|
|
705
|
+
const r = await fetch("/api/token", {
|
|
706
|
+
method: "POST",
|
|
707
|
+
headers: {"Content-Type": "application/json"},
|
|
708
|
+
body: JSON.stringify({
|
|
709
|
+
email: document.getElementById("email").value,
|
|
710
|
+
password: document.getElementById("password").value
|
|
711
|
+
})
|
|
712
|
+
});
|
|
713
|
+
const data = await r.json();
|
|
714
|
+
if (data.access_token) {
|
|
715
|
+
localStorage.setItem("access_token", data.access_token);
|
|
716
|
+
location.hash = "";
|
|
717
|
+
location.reload();
|
|
718
|
+
} else {
|
|
719
|
+
root.insertAdjacentHTML("afterbegin", "<p role='alert'>Wrong email or password.</p>");
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function nav(email, role) {
|
|
725
|
+
const admin = role === "admin" ? "<a href='/admin'>Admin</a>" : "";
|
|
726
|
+
return "<nav><a href='/invoices'>Invoices</a><a href='/account'>Account</a>" +
|
|
727
|
+
"<a href='/handbook'>Handbook</a>" + admin +
|
|
728
|
+
"<button type='button' id='signout'>Sign out</button>" +
|
|
729
|
+
"<span>Signed in as " + email + "</span></nav>";
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (!token) {
|
|
733
|
+
renderLogin();
|
|
734
|
+
} else {
|
|
735
|
+
fetch("/api/invoices", {headers: auth}).then(r => r.json()).then(list => {
|
|
736
|
+
if (!Array.isArray(list)) { renderLogin(); return; }
|
|
737
|
+
const rows = list.map(i =>
|
|
738
|
+
"<tr><td><a href='/invoices/" + i.id + "'>#" + i.id + "</a></td><td>" +
|
|
739
|
+
i.description + "</td><td>$" + i.amount + "</td></tr>").join("") ||
|
|
740
|
+
"<tr><td>No invoices yet</td></tr>";
|
|
741
|
+
root.innerHTML = nav("", "") + "<h1>Your invoices</h1>" +
|
|
742
|
+
"<table><thead><tr><th>Invoice</th><th>Description</th><th>Amount</th></tr></thead>" +
|
|
743
|
+
"<tbody id='invoice-rows'>" + rows + "</tbody></table>" +
|
|
744
|
+
"<form action='/search'><label>Search invoices <input name='q'></label> " +
|
|
745
|
+
"<button>Search</button></form>";
|
|
746
|
+
fetch("/api/admin/users", {headers: auth}).catch(() => {});
|
|
747
|
+
fetch("/account", {headers: auth}).then(r => r.text()).then(html => {
|
|
748
|
+
const m = html.match(/Signed in as ([^<]+)/);
|
|
749
|
+
if (m) {
|
|
750
|
+
const span = root.querySelector("nav span");
|
|
751
|
+
if (span) span.textContent = "Signed in as " + m[1];
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
const out = document.getElementById("signout");
|
|
755
|
+
if (out) out.onclick = async () => {
|
|
756
|
+
await fetch("/logout", {method: "POST", headers: auth});
|
|
757
|
+
localStorage.removeItem("access_token");
|
|
758
|
+
location.reload();
|
|
759
|
+
};
|
|
760
|
+
}).catch(() => renderLogin());
|
|
761
|
+
}
|
|
762
|
+
"""
|
|
763
|
+
|
|
629
764
|
def log_message(self, *args) -> None: # keep benchmark output clean
|
|
630
765
|
pass
|
|
631
766
|
|
|
632
767
|
|
|
768
|
+
def _bearer_token(sid: str) -> str:
|
|
769
|
+
payload = json.dumps({"sid": sid}, separators=(",", ":")).encode()
|
|
770
|
+
middle = base64.urlsafe_b64encode(payload).decode().rstrip("=")
|
|
771
|
+
return "eyJhbGciOiJub25lIn0." + middle + ".sig"
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
def _sid_from_token(token: str) -> str:
|
|
775
|
+
parts = token.split(".")
|
|
776
|
+
if len(parts) != 3:
|
|
777
|
+
return ""
|
|
778
|
+
pad = "=" * (-len(parts[1]) % 4)
|
|
779
|
+
try:
|
|
780
|
+
data = json.loads(base64.urlsafe_b64decode(parts[1] + pad))
|
|
781
|
+
except Exception: # noqa: BLE001
|
|
782
|
+
return ""
|
|
783
|
+
return str(data.get("sid") or "")
|
|
784
|
+
|
|
785
|
+
|
|
633
786
|
@contextmanager
|
|
634
787
|
def serve_billing(vulns: tuple[str, ...] | list[str] = ()) -> Iterator[str]:
|
|
635
788
|
"""Serve Acme Billing on 127.0.0.1 with `vulns` planted; yields its base URL."""
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Same planted vulnerabilities as billing-security, against the JavaScript
|
|
2
|
+
# front end at /spa/ (empty HTML, token in localStorage, JSON login).
|
|
3
|
+
name: billing-security-spa
|
|
4
|
+
kind: security
|
|
5
|
+
version: 1
|
|
6
|
+
description: Security checks on the Acme Billing SPA (browser sign-in, ADR-011)
|
|
7
|
+
platform: playwright
|
|
8
|
+
site: billing
|
|
9
|
+
path: /spa/
|
|
10
|
+
|
|
11
|
+
accounts:
|
|
12
|
+
admin:
|
|
13
|
+
role: admin
|
|
14
|
+
auth: browser
|
|
15
|
+
login: "Sign in with email admin@acme.test and password admin-pass"
|
|
16
|
+
alice:
|
|
17
|
+
role: member
|
|
18
|
+
auth: browser
|
|
19
|
+
login: "Sign in with email alice@acme.test and password alice-pass"
|
|
20
|
+
bob:
|
|
21
|
+
role: member
|
|
22
|
+
auth: browser
|
|
23
|
+
login: "Sign in with email bob@acme.test and password bob-pass"
|
|
24
|
+
|
|
25
|
+
vulnerabilities:
|
|
26
|
+
idor-page:
|
|
27
|
+
check: access
|
|
28
|
+
paths: [/invoices]
|
|
29
|
+
description: "Any member can open another member's invoice page at /invoices/<id>"
|
|
30
|
+
idor-api:
|
|
31
|
+
check: access
|
|
32
|
+
paths: [/api/invoices]
|
|
33
|
+
description: "Any member can read another member's invoice from /api/invoices/<id>"
|
|
34
|
+
admin-route:
|
|
35
|
+
check: roles
|
|
36
|
+
paths: [/admin, /api/admin]
|
|
37
|
+
description: "Members can open /admin and /api/admin/users; only the nav link is hidden"
|
|
38
|
+
session-after-logout:
|
|
39
|
+
check: session
|
|
40
|
+
rule: session-after-logout
|
|
41
|
+
description: "Sign out clears the cookie but the server keeps the session, so the old cookie still works"
|
|
42
|
+
weak-cookie:
|
|
43
|
+
check: session
|
|
44
|
+
rule: cookie-flags
|
|
45
|
+
description: "The sid session cookie has no HttpOnly or SameSite"
|
|
46
|
+
no-csp:
|
|
47
|
+
check: exposure
|
|
48
|
+
rule: missing-csp
|
|
49
|
+
description: "No Content-Security-Policy header (framing is still blocked by X-Frame-Options)"
|
|
50
|
+
leaked-key:
|
|
51
|
+
check: exposure
|
|
52
|
+
rule: secret-in-js
|
|
53
|
+
match: [sk_live_]
|
|
54
|
+
description: "A live Stripe secret key is shipped in /spa/app.js"
|
|
55
|
+
stack-trace:
|
|
56
|
+
check: exposure
|
|
57
|
+
rule: stack-trace
|
|
58
|
+
description: "An empty search returns a 500 page with a Python traceback"
|
|
59
|
+
|
|
60
|
+
decoys:
|
|
61
|
+
shared-handbook:
|
|
62
|
+
check: access
|
|
63
|
+
paths: [/handbook]
|
|
64
|
+
description: "The team handbook is the same page for every member, by design"
|
|
65
|
+
public-profile:
|
|
66
|
+
check: access
|
|
67
|
+
paths: [/u]
|
|
68
|
+
description: "Public profiles show a display name to every signed-in member, and say so"
|
|
69
|
+
protected-audit:
|
|
70
|
+
check: roles
|
|
71
|
+
paths: [/admin/audit]
|
|
72
|
+
description: "The audit log link is hidden from members and the server also refuses them"
|
|
73
|
+
framing-via-csp:
|
|
74
|
+
check: exposure
|
|
75
|
+
rule: missing-frame-protection
|
|
76
|
+
description: "No X-Frame-Options, because CSP frame-ancestors 'none' covers framing"
|
|
77
|
+
publishable-key:
|
|
78
|
+
check: exposure
|
|
79
|
+
rule: secret-in-js
|
|
80
|
+
match: [pk_live_, sk_test_]
|
|
81
|
+
description: "A publishable pk_live key and a test-mode sk_test key in /spa/app.js belong there"
|
|
82
|
+
|
|
83
|
+
variants:
|
|
84
|
+
- name: clean
|
|
85
|
+
vulnerabilities: []
|
|
86
|
+
- name: pages
|
|
87
|
+
vulnerabilities: [idor-page, admin-route, weak-cookie, no-csp]
|
|
88
|
+
- name: api
|
|
89
|
+
vulnerabilities: [idor-api, session-after-logout, leaked-key, stack-trace]
|
|
@@ -13,6 +13,7 @@ Commands:
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
15
|
import json
|
|
16
|
+
import shutil
|
|
16
17
|
import sys
|
|
17
18
|
import time
|
|
18
19
|
from pathlib import Path
|
|
@@ -26,6 +27,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
|
26
27
|
from rich.table import Table
|
|
27
28
|
|
|
28
29
|
from fusiontest import __version__
|
|
30
|
+
from fusiontest.core import evidence as _evidence
|
|
29
31
|
|
|
30
32
|
console = Console()
|
|
31
33
|
|
|
@@ -33,6 +35,7 @@ console = Console()
|
|
|
33
35
|
# safe to commit or cache in CI so later runs can replay.
|
|
34
36
|
DEFAULT_TRACE_DIR = ".fusiontest/traces"
|
|
35
37
|
DEFAULT_SCREENSHOT_DIR = ".fusiontest/screenshots"
|
|
38
|
+
DEFAULT_EVIDENCE_DIR = ".fusiontest/evidence"
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
@click.group()
|
|
@@ -86,8 +89,11 @@ def _judge_note(backend: str, judge: str) -> str:
|
|
|
86
89
|
@click.option("--judge", type=click.Choice(["gpt4o", "claude", "gemini", "groq", "ollama"]),
|
|
87
90
|
default=None, help="Model that judges pass/fail (default: FUSIONTEST_JUDGE, else "
|
|
88
91
|
"Claude or OpenAI when its key is set, else --backend)")
|
|
92
|
+
@click.option("--evidence", "evidence_mode", type=click.Choice(["failures", "all", "off"]), default=None,
|
|
93
|
+
help="Web and Electron: record a video of the run, a trace per goal, and console and "
|
|
94
|
+
"network errors. 'failures' (default) keeps the video and traces only for what failed")
|
|
89
95
|
def run(goal, goal_file, platform, app, url, locale, backend, headless, output, config_file,
|
|
90
|
-
replay, trace_dir, reverify_every, deploy, judge):
|
|
96
|
+
replay, trace_dir, reverify_every, deploy, judge, evidence_mode):
|
|
91
97
|
"""Run a FusionTest test — provide goals via --goal or --file."""
|
|
92
98
|
|
|
93
99
|
_load_env()
|
|
@@ -142,8 +148,20 @@ def run(goal, goal_file, platform, app, url, locale, backend, headless, output,
|
|
|
142
148
|
+ _judge_note(backend, judge) + f" · Locale: [cyan]{locale}[/cyan]",
|
|
143
149
|
border_style="blue",
|
|
144
150
|
))
|
|
151
|
+
# Run evidence (video, traces, console and network errors): web and Electron.
|
|
152
|
+
evidence_cfg = cfg.get("evidence") or {}
|
|
153
|
+
evidence_mode = evidence_mode or evidence_cfg.get("mode") or _evidence.DEFAULT_MODE
|
|
154
|
+
if evidence_mode not in _evidence.MODES:
|
|
155
|
+
console.print(f"[red]evidence.mode must be one of: {', '.join(_evidence.MODES)}[/red]")
|
|
156
|
+
sys.exit(1)
|
|
157
|
+
evidence_dir = None
|
|
158
|
+
if evidence_mode != "off" and platform in ("playwright", "electron"):
|
|
159
|
+
from datetime import datetime, timezone
|
|
160
|
+
evidence_dir = (Path(evidence_cfg.get("dir", DEFAULT_EVIDENCE_DIR))
|
|
161
|
+
/ datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ"))
|
|
162
|
+
|
|
145
163
|
# Build adapter
|
|
146
|
-
adapter = _build_adapter(platform, app, url, headless)
|
|
164
|
+
adapter = _build_adapter(platform, app, url, headless, evidence_dir=evidence_dir)
|
|
147
165
|
|
|
148
166
|
# Build runner — enable step logging when an API key is present so every
|
|
149
167
|
# (goal, screen, action, outcome) tuple is captured for training-data.
|
|
@@ -198,6 +216,7 @@ def run(goal, goal_file, platform, app, url, locale, backend, headless, output,
|
|
|
198
216
|
# retried in a fresh browser before it's reported as a regression.
|
|
199
217
|
deploy=deploy or _deploy_from_env(),
|
|
200
218
|
fresh_adapter=(lambda: _build_adapter(platform, app, url, True)) if platform == "playwright" else None,
|
|
219
|
+
evidence_mode=evidence_mode,
|
|
201
220
|
)
|
|
202
221
|
runner = FusionTestRunner(adapter, runner_cfg)
|
|
203
222
|
|
|
@@ -249,6 +268,8 @@ def run(goal, goal_file, platform, app, url, locale, backend, headless, output,
|
|
|
249
268
|
finally:
|
|
250
269
|
progress.stop()
|
|
251
270
|
|
|
271
|
+
_finish_evidence(adapter, result, evidence_mode, evidence_dir)
|
|
272
|
+
|
|
252
273
|
# Failure screenshots: saved next to the project, shown in the results.
|
|
253
274
|
shot_dir = Path(cfg.get("screenshots", {}).get("dir", DEFAULT_SCREENSHOT_DIR))
|
|
254
275
|
shots = _save_screenshots(result, shot_dir)
|
|
@@ -256,6 +277,7 @@ def run(goal, goal_file, platform, app, url, locale, backend, headless, output,
|
|
|
256
277
|
|
|
257
278
|
# Print results table, then Slack / GitHub annotations if configured
|
|
258
279
|
_print_results(result, shots, bug_shots)
|
|
280
|
+
_print_evidence(result, evidence_dir)
|
|
259
281
|
_notify(result)
|
|
260
282
|
|
|
261
283
|
# Save JSON report locally
|
|
@@ -270,6 +292,8 @@ def run(goal, goal_file, platform, app, url, locale, backend, headless, output,
|
|
|
270
292
|
_upload_screenshots(uploaded_run_id, shots)
|
|
271
293
|
if bug_shots:
|
|
272
294
|
_upload_screenshots(uploaded_run_id, bug_shots, kind="bug")
|
|
295
|
+
if uploaded_run_id and result.video and evidence_cfg.get("upload", True):
|
|
296
|
+
_upload_video(uploaded_run_id, Path(result.video))
|
|
273
297
|
|
|
274
298
|
# Upload step telemetry (best-effort, non-blocking)
|
|
275
299
|
if _api_key and _step_log_tmp:
|
|
@@ -842,6 +866,92 @@ def _upload_screenshots(run_id: str, shots: dict[int, Path], kind: str = "goal")
|
|
|
842
866
|
console.print(f"[dim]{stored} {what} screenshot(s) attached to the run (kept 30 days).[/dim]")
|
|
843
867
|
|
|
844
868
|
|
|
869
|
+
def _finish_evidence(adapter, result, mode: str, evidence_dir: Path | None) -> None:
|
|
870
|
+
"""Close the browser so the video is written, then keep or delete it."""
|
|
871
|
+
finish = getattr(adapter, "finish_evidence", None)
|
|
872
|
+
if finish is None or evidence_dir is None:
|
|
873
|
+
return
|
|
874
|
+
try:
|
|
875
|
+
video = finish()
|
|
876
|
+
except Exception as e: # noqa: BLE001 — never fail a run over evidence
|
|
877
|
+
console.print(f"[yellow]Warning:[/yellow] Could not save the run's video: {e}")
|
|
878
|
+
return
|
|
879
|
+
if video is None:
|
|
880
|
+
return
|
|
881
|
+
if _evidence.keeps_video(mode, result.success):
|
|
882
|
+
target = evidence_dir / "run.webm"
|
|
883
|
+
try:
|
|
884
|
+
video.replace(target)
|
|
885
|
+
except OSError:
|
|
886
|
+
target = video
|
|
887
|
+
result.video = str(target)
|
|
888
|
+
else:
|
|
889
|
+
video.unlink(missing_ok=True)
|
|
890
|
+
shutil.rmtree(evidence_dir / "video", ignore_errors=True)
|
|
891
|
+
if evidence_dir.exists() and not any(evidence_dir.iterdir()):
|
|
892
|
+
evidence_dir.rmdir()
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
def _print_evidence(result, evidence_dir: Path | None) -> None:
|
|
896
|
+
traces = [(i, s.evidence.trace) for i, s in enumerate(result.steps) if s.evidence and s.evidence.trace]
|
|
897
|
+
problems = sum(len(s.evidence.console) + len(s.evidence.network)
|
|
898
|
+
for s in result.steps if s.evidence and not s.success)
|
|
899
|
+
if not traces and not result.video and not problems:
|
|
900
|
+
return
|
|
901
|
+
console.print("\n[bold]Evidence[/bold]")
|
|
902
|
+
if result.video:
|
|
903
|
+
console.print(f" video: {escape(result.video)}", soft_wrap=True)
|
|
904
|
+
for i, trace in traces:
|
|
905
|
+
console.print(f" {i + 1}. trace: {escape(trace)}", soft_wrap=True)
|
|
906
|
+
if traces:
|
|
907
|
+
console.print(" [dim]Open a trace with: playwright show-trace <file>[/dim]")
|
|
908
|
+
for i, step in enumerate(result.steps):
|
|
909
|
+
if step.success or step.evidence is None:
|
|
910
|
+
continue
|
|
911
|
+
for e in step.evidence.console[:5]:
|
|
912
|
+
console.print(f" {i + 1}. [dim]console {e.level}:[/dim] {escape(e.text)}", soft_wrap=True)
|
|
913
|
+
for e in step.evidence.network[:5]:
|
|
914
|
+
what = str(e.status) if e.status else e.failure
|
|
915
|
+
console.print(f" {i + 1}. [dim]network:[/dim] {escape(e.method)} {escape(e.url)} → {escape(what)}",
|
|
916
|
+
soft_wrap=True)
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
def _without_trace(step: dict) -> dict:
|
|
920
|
+
ev = step.get("evidence")
|
|
921
|
+
if not ev or "trace" not in ev:
|
|
922
|
+
return step
|
|
923
|
+
return {**step, "evidence": {k: v for k, v in ev.items() if k != "trace"}}
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
def _upload_video(run_id: str, path: Path) -> None:
|
|
927
|
+
"""Attach the run's video to the uploaded run (best effort; kept 30 days,
|
|
928
|
+
and the org's screenshot setting covers it too)."""
|
|
929
|
+
import os
|
|
930
|
+
|
|
931
|
+
import httpx
|
|
932
|
+
|
|
933
|
+
size = path.stat().st_size if path.exists() else 0
|
|
934
|
+
if not size:
|
|
935
|
+
return
|
|
936
|
+
if size > _VIDEO_MAX_BYTES:
|
|
937
|
+
console.print(f"[dim]Video not uploaded: {size // (1024 * 1024)} MB is over the "
|
|
938
|
+
f"{_VIDEO_MAX_BYTES // (1024 * 1024)} MB limit (it's kept locally).[/dim]")
|
|
939
|
+
return
|
|
940
|
+
api_url = os.getenv("FUSIONTEST_API_URL", "https://api.fusiontest.fusionleap.io")
|
|
941
|
+
headers = {"Authorization": f"Bearer {os.getenv('FUSIONTEST_API_KEY', '')}", "Content-Type": "video/webm"}
|
|
942
|
+
try:
|
|
943
|
+
resp = httpx.post(f"{api_url}/api/runs/{run_id}/video", content=path.read_bytes(),
|
|
944
|
+
headers=headers, timeout=120)
|
|
945
|
+
resp.raise_for_status()
|
|
946
|
+
if resp.json().get("stored"):
|
|
947
|
+
console.print("[dim]Video attached to the run (kept 30 days).[/dim]")
|
|
948
|
+
except Exception as e: # noqa: BLE001 — never fail a run over a video
|
|
949
|
+
console.print(f"[yellow]Warning:[/yellow] Could not upload the video: {e}")
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
_VIDEO_MAX_BYTES = 50 * 1024 * 1024
|
|
953
|
+
|
|
954
|
+
|
|
845
955
|
def _load_env() -> None:
|
|
846
956
|
"""Load .env from the directory the command runs in (or a parent).
|
|
847
957
|
|
|
@@ -1339,6 +1449,17 @@ def bench(suites, backends, repeat, headless, out_dir, min_accuracy, max_cost, m
|
|
|
1339
1449
|
Path(summary_md).write_text(
|
|
1340
1450
|
_bench_markdown(summaries, runs, spend_line, bug_summaries, bug_runs), encoding="utf-8")
|
|
1341
1451
|
|
|
1452
|
+
# A suite × backend where every case errored measured nothing (a rejected API
|
|
1453
|
+
# key, no credits, an outage). Results are still written and uploaded so the
|
|
1454
|
+
# dashboard shows the gap, but the run fails so it doesn't go unnoticed.
|
|
1455
|
+
unmeasured = ([f"{sm.suite} × {sm.backend}" for sm in summaries if sm.cases and not sm.evaluated]
|
|
1456
|
+
+ [f"{sm.suite} × {sm.backend}" for sm in bug_summaries
|
|
1457
|
+
if sm.errors and not sm.variants])
|
|
1458
|
+
if unmeasured:
|
|
1459
|
+
console.print(f"[red]✗ Nothing measured for {', '.join(unmeasured)}: every case errored. "
|
|
1460
|
+
"Check the errors above (API key, credits, provider outage).[/red]")
|
|
1461
|
+
sys.exit(1)
|
|
1462
|
+
|
|
1342
1463
|
if min_accuracy is not None:
|
|
1343
1464
|
below = [sm for sm in summaries if sm.accuracy < min_accuracy or sm.false_pass]
|
|
1344
1465
|
if below:
|
|
@@ -1778,10 +1899,11 @@ def _is_ollama_running() -> bool:
|
|
|
1778
1899
|
return False
|
|
1779
1900
|
|
|
1780
1901
|
|
|
1781
|
-
def _build_adapter(platform: str, app: str | None, url: str | None, headless: bool
|
|
1902
|
+
def _build_adapter(platform: str, app: str | None, url: str | None, headless: bool,
|
|
1903
|
+
evidence_dir: Path | None = None):
|
|
1782
1904
|
if platform == "playwright":
|
|
1783
1905
|
from fusiontest.desktop.playwright_adapter import PlaywrightAdapter
|
|
1784
|
-
adapter = PlaywrightAdapter(browser_type="chromium", headless=headless)
|
|
1906
|
+
adapter = PlaywrightAdapter(browser_type="chromium", headless=headless, evidence_dir=evidence_dir)
|
|
1785
1907
|
adapter.start(url=url)
|
|
1786
1908
|
return adapter
|
|
1787
1909
|
|
|
@@ -1790,7 +1912,7 @@ def _build_adapter(platform: str, app: str | None, url: str | None, headless: bo
|
|
|
1790
1912
|
console.print("[red]--app is required for electron platform[/red]")
|
|
1791
1913
|
sys.exit(1)
|
|
1792
1914
|
from fusiontest.desktop.playwright_adapter import PlaywrightAdapter
|
|
1793
|
-
adapter = PlaywrightAdapter(electron_app_path=app, headless=headless)
|
|
1915
|
+
adapter = PlaywrightAdapter(electron_app_path=app, headless=headless, evidence_dir=evidence_dir)
|
|
1794
1916
|
adapter.start()
|
|
1795
1917
|
return adapter
|
|
1796
1918
|
|
|
@@ -1958,6 +2080,7 @@ def _save_report(result, path: str) -> None:
|
|
|
1958
2080
|
"total_duration_seconds": result.total_duration_seconds,
|
|
1959
2081
|
"steps": [s.to_dict() for s in result.steps],
|
|
1960
2082
|
"bugs_detected": [b.to_dict() for b in result.bugs_detected],
|
|
2083
|
+
**({"video": result.video} if result.video else {}),
|
|
1961
2084
|
}
|
|
1962
2085
|
with open(path, "w") as f:
|
|
1963
2086
|
json.dump(data, f, indent=2)
|
|
@@ -1989,7 +2112,9 @@ def _upload_report(result) -> str | None:
|
|
|
1989
2112
|
"status": result.status,
|
|
1990
2113
|
"stability_score": result.stability_score,
|
|
1991
2114
|
"total_duration_seconds": result.total_duration_seconds,
|
|
1992
|
-
|
|
2115
|
+
# Traces stay on this machine (they hold cookies and headers), and so
|
|
2116
|
+
# do local paths.
|
|
2117
|
+
"steps": [_without_trace(s.to_dict()) for s in result.steps],
|
|
1993
2118
|
"bugs_detected": [b.to_dict() for b in result.bugs_detected],
|
|
1994
2119
|
}
|
|
1995
2120
|
|
|
@@ -700,7 +700,10 @@ class LLMCaller:
|
|
|
700
700
|
from google.genai import types as genai_types
|
|
701
701
|
client = genai.Client(
|
|
702
702
|
api_key=api_key,
|
|
703
|
-
|
|
703
|
+
# v1beta: google-genai 3.x defaults to v1, where some models
|
|
704
|
+
# (gemini-2.5-flash) reject system instructions.
|
|
705
|
+
http_options=genai_types.HttpOptions(
|
|
706
|
+
api_version="v1beta", timeout=LLM_REQUEST_TIMEOUT_SECONDS * 1000), # ms
|
|
704
707
|
)
|
|
705
708
|
|
|
706
709
|
else:
|