Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(report): raise RuntimeError on non-object run.json (fixes #1109) (#1116)
RAJVARDHAN PATILe152c4c7c037
diff --git a/strix/interface/cli_args.py b/strix/interface/cli_args.pyindex d354106a..42ebf18d 100644--- a/strix/interface/cli_args.py+++ b/strix/interface/cli_args.py@@ -346,7 +346,7 @@ def _load_resume_state(args: argparse.Namespace, parser: argparse.ArgumentParser)try:state = read_run_record(run_dir)- except RuntimeError as exc:+ except (RuntimeError, TypeError) as exc:parser.error(f"--resume {args.resume}: run.json unreadable: {exc}")args.targets_info = state.get("targets_info") or []diff --git a/tests/test_cli_target_list.py b/tests/test_cli_target_list.pyindex 9372ce5e..6ba4ca22 100644--- a/tests/test_cli_target_list.py+++ b/tests/test_cli_target_list.py@@ -227,3 +227,18 @@ def test_resume_still_requires_targets_or_a_workspace(cli_main.parse_arguments()assert "has no targets_info" in capsys.readouterr().err++def test_resume_non_object_run_json_exits(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]) -> None:+ monkeypatch.chdir(tmp_path)+ run_dir = tmp_path / "strix_runs" / "pentest_abcd"+ run_dir.mkdir(parents=True)+ (run_dir / "run.json").write_text("[]", encoding="utf-8")++ monkeypatch.setattr(sys, "argv", ["strix", "--resume", "pentest_abcd"])+ with pytest.raises(SystemExit) as exc_info:+ cli_main.parse_arguments()++ assert exc_info.value.code == 2+ captured = capsys.readouterr()+ assert "run.json unreadable" in captured.err+ assert "not an object" in captured.err