Apply ruff fixes

This commit is contained in:
Hugh Brown
2026-03-03 22:46:39 -07:00
committed by Abhimanyu Saharan
parent 0896b0772d
commit a66765a514
3 changed files with 8 additions and 10 deletions

View File

@@ -203,11 +203,13 @@ def _verify_webhook_signature(
) )
_REDACTED_HEADERS = frozenset({ _REDACTED_HEADERS = frozenset(
{
"x-hub-signature-256", "x-hub-signature-256",
"x-webhook-signature", "x-webhook-signature",
"authorization", "authorization",
}) }
)
def _captured_headers(request: Request) -> dict[str, str] | None: def _captured_headers(request: Request) -> dict[str, str] | None:

View File

@@ -687,9 +687,7 @@ def _sanitize_field(value: str) -> str:
Prevents prompt injection via skill name or URL fields that could Prevents prompt injection via skill name or URL fields that could
break out of the structured data section into the instruction section. break out of the structured data section into the instruction section.
""" """
sanitized = "".join( sanitized = "".join(ch if ch.isprintable() and ch not in {"\n", "\r"} else " " for ch in value)
ch if ch.isprintable() and ch not in {"\n", "\r"} else " " for ch in value
)
# Normalize any runs of whitespace (including tabs) down to single spaces. # Normalize any runs of whitespace (including tabs) down to single spaces.
sanitized = re.sub(r"\s+", " ", sanitized) sanitized = re.sub(r"\s+", " ", sanitized)
return sanitized.strip() return sanitized.strip()

View File

@@ -494,5 +494,3 @@ class TestWebhookPayloadSizeLimit:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Task 12: Gateway token redaction # Task 12: Gateway token redaction
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------