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(proxy): log all Caido SDK errors as warnings
Iand8c00a8f4eba
diff --git a/strix/tools/proxy/tools.py b/strix/tools/proxy/tools.pyindex 0cf3f11f..d6b09e7e 100644--- a/strix/tools/proxy/tools.py+++ b/strix/tools/proxy/tools.py@@ -13,6 +13,7 @@ from datetime import datetimefrom typing import TYPE_CHECKING, Any, Literalfrom agents import RunContextWrapper, function_tool+from caido_sdk_client import BaseErrorfrom strix.runtime.caido_handle import CaidoBootstrapHandlefrom strix.tools.nullish import clean_optional@@ -124,9 +125,9 @@ def _no_client() -> str:def _err(name: str, exc: Exception) -> str:- # The Caido SDK wraps its GraphQL timeout in an error with an empty message.- if isinstance(exc.__cause__, TimeoutError):- logger.warning("%s timed out", name)+ # Caido-side failures (timeouts, bad filters, ...) are returned to the model, not our bugs.+ if isinstance(exc, BaseError):+ logger.warning("%s failed", name, exc_info=True)else:logger.exception("%s failed", name)return json.dumps(diff --git a/tests/test_proxy_client.py b/tests/test_proxy_client.pyindex a9c9660f..fba20787 100644--- a/tests/test_proxy_client.py+++ b/tests/test_proxy_client.py@@ -13,6 +13,7 @@ from types import SimpleNamespacefrom typing import TYPE_CHECKING, Any, castimport pytest+from caido_sdk_client.errors import OperationUserErrorfrom strix.runtime.caido_handle import CaidoBootstrapHandlefrom strix.tools.proxy import caido_api, tools@@ -254,13 +255,9 @@ async def test_existing_request_ids_queries_current_project(assert looked_up == ["1042", "1088"]-def test_err_logs_caido_timeout_as_warning(caplog: pytest.LogCaptureFixture) -> None:- exc = RuntimeError()- exc.__cause__ = TimeoutError()-+def test_err_logs_caido_errors_as_warnings(caplog: pytest.LogCaptureFixture) -> None:with caplog.at_level("WARNING", logger="strix.tools.proxy.tools"):- tools._err("list_requests", exc)+ tools._err("list_requests", OperationUserError(""))[record] = caplog.recordsassert record.levelname == "WARNING"- assert record.exc_info is None