feat: implement MCP red teaming test suite v2 with automated scripts, logging, and comprehensive evidence documentation.

هذا الالتزام موجود في:
ZiadMahmoud2003
2026-08-26 20:49:08 +03:00
الأصل 714c08f3a8
التزام 5ba87ac00a
76 ملفات معدلة مع 3219 إضافات و3092 حذوفات

عرض الملف

@@ -45,6 +45,8 @@ BASE_DIR = Path(__file__).parent.parent
ENV_FILE = BASE_DIR / "config" / ".env"
ACCOUNTS_CSV = BASE_DIR / "data" / "accounts.csv"
TESTCASES_JSON = BASE_DIR / "data" / "redteam_testcases.json"
EVIDENCE_DIR = BASE_DIR / "evidence_screenshots"
EVIDENCE_DIR.mkdir(exist_ok=True)
# ---------------------------------------------------------------------------
@@ -353,6 +355,12 @@ def execute_payload(page, testcase: dict, timeout_sec: int = 120) -> dict:
response_text = _wait_for_response_complete(page, timeout_sec)
elapsed = round(time.time() - t0, 2)
page.wait_for_timeout(1000)
screenshot_name = f"{tc_id}_{testcase['cat']}_evidence.png"
screenshot_path = EVIDENCE_DIR / screenshot_name
page.screenshot(path=str(screenshot_path), full_page=True)
log.info("Captured evidence screenshot: %s", screenshot_path)
log.info("%s completed in %.1fs (%d chars)", tc_id, elapsed, len(response_text))
return {
@@ -363,6 +371,7 @@ def execute_payload(page, testcase: dict, timeout_sec: int = 120) -> dict:
"response": response_text,
"elapsed_sec": elapsed,
"has_file": file_spec is not None,
"screenshot_path": str(screenshot_path),
}