feat: implement MCP red teaming test suite v2 with automated scripts, logging, and comprehensive evidence documentation.
هذا الالتزام موجود في:
39
scripts/run_v2_h01h02.py
Normal file
39
scripts/run_v2_h01h02.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Re-run H01 and H02 only, with fixes for overlay and PDF timeout."""
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
||||
from client_v2 import load_env, load_accounts, load_testcases_v2, run_full_suite_v2
|
||||
|
||||
def main():
|
||||
env = load_env()
|
||||
accounts = load_accounts()
|
||||
testcases = load_testcases_v2()
|
||||
|
||||
# Filter to H01 and H02 only
|
||||
target_ids = {"H01", "H02"}
|
||||
testcases = [tc for tc in testcases if tc["id"] in target_ids]
|
||||
|
||||
sys.stderr.write(f"Re-running {len(testcases)} tests (H01 + H02)...\n")
|
||||
|
||||
results = run_full_suite_v2(
|
||||
accounts=accounts,
|
||||
testcases=testcases,
|
||||
env=env,
|
||||
headless=True,
|
||||
timeout_per_test=180,
|
||||
)
|
||||
|
||||
# Save results separately
|
||||
out_path = Path(__file__).parent / "reports" / "suite_results_v2_h01h02.json"
|
||||
out_path.write_text(json.dumps(results, indent=2, ensure_ascii=False), encoding="utf-8")
|
||||
sys.stderr.write(f"Results saved to {out_path}\n")
|
||||
|
||||
for r in results:
|
||||
status = "OK" if not r.get("error") else "ERR"
|
||||
resp_preview = r.get("response", "")[:100].replace("\n", " ")
|
||||
sys.stderr.write(f" [{status}] {r['id']}: {resp_preview}...\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
المرجع في مشكلة جديدة
حظر مستخدم