Wuhp
Persist structured Arjun parameter evidence with exact-host filtering and configurable review deadlines
cd17fb2 Download tests/test_arjun_structured.py from wuhp/bbscanner: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/wuhp/bbscanner/resolve/main/tests/test_arjun_structured.py
- Command line
-
hf download hf://spaces/wuhp/bbscanner/tests/test_arjun_structured.py
-
curl -L -o test_arjun_structured.py https://huggingface.co/spaces/wuhp/bbscanner/resolve/main/tests/test_arjun_structured.py
1.33 kB
| import asyncio | |
| import json | |
| from pathlib import Path | |
| from unittest.mock import patch | |
| from app import review | |
| def test_arjun_json_result_is_in_scope_and_structured(tmp_path): | |
| path = tmp_path / "parameters.json" | |
| path.write_text(json.dumps({ | |
| "https://example.org/api": { | |
| "method": "GET", | |
| "params": [{"name": "id", "reason": "body differs"}, | |
| {"name": "debug"}]}, | |
| "https://other.example.org/api": { | |
| "params": [{"name": "private"}]}, | |
| })) | |
| output = review.read_arjun_results(str(path), "example.org") | |
| assert [x["name"] for x in output] == ["id", "debug"] | |
| assert all(x["url"] == "https://example.org/api" for x in output) | |
| def test_arjun_review_consumes_json_export(): | |
| async def fake(args, timeout): | |
| assert "-oJ" in args | |
| path = Path(args[args.index("-oJ")+1]) | |
| path.write_text(json.dumps({"https://example.org/path": { | |
| "method": "GET", "params": [{"name": "page"}]}})) | |
| return ["[+] Found parameters"], "completed" | |
| with patch.object(review, "execute", fake): | |
| result = asyncio.run(review.review("arjun", "https://example.org/path", | |
| "example.org")) | |
| assert result["status"] == "completed" | |
| assert result["parameters"][0]["name"] == "page" | |