fix(api): redact error replies, lock segment url lookups, refuse unresolvable proxy hosts and recheck job proxies at start

This commit is contained in:
imSp4rky
2026-11-28 21:33:00 -07:00
parent 7713f8df3f
commit 0a791ad6e8
15 changed files with 348 additions and 20 deletions
+20
View File
@@ -293,3 +293,23 @@ def test_a_system_exit_stays_a_service_error_whatever_its_cause_names() -> None:
raise SystemExit(1) from e
except SystemExit as exit_:
assert categorize_exception(exit_).error_code == APIErrorCode.SERVICE_ERROR
@pytest.mark.parametrize(
"error",
[
APIError(
APIErrorCode.SERVICE_ERROR,
"Licence request failed: 403 Client Error: Forbidden for url: https://lic.example.com/wv?token=s3cr3t&kid=1",
),
RuntimeError("Failed to initialize service: 403 for url: https://lic.example.com/wv?token=s3cr3t&kid=1"),
],
ids=["api-error", "exception"],
)
def test_the_reply_masks_a_secret_in_the_error_text(error: Exception) -> None:
"""A service exception names the URL it failed on, and a server-account login puts the operator's token there."""
resp = build_error_response(error)
body = _body(resp)
assert "s3cr3t" not in body["message"]
assert "s3cr3t" not in resp["error"]["message"]
assert "https://lic.example.com/wv?token=***&kid=1" in body["message"]