Skip to content

Automate browser based workflows with AI

Add a disabled synthetic auth fixture on the staging API origin (#8810)

Andrew Neilsonaed3c6b69706
diff --git a/skyvern/config.py b/skyvern/config.py
index 2756af265..269f11c9a 100644
--- a/skyvern/config.py
+++ b/skyvern/config.py
@@ -230,6 +230,8 @@ class Settings(BaseSettings):
TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3
ENV: str = "local"
+ # Synthetic browser fixture: never installed outside staging, disabled by default.
+ COPILOT_EVAL_AUTH_FIXTURE_ENABLED: bool = False
BROWSER_STREAMING_MODE: str = "vnc"
EXECUTE_ALL_STEPS: bool = True
JSON_LOGGING: bool = False
diff --git a/skyvern/forge/request_logging.py b/skyvern/forge/request_logging.py
index 5dfe32e20..7c3118b63 100644
--- a/skyvern/forge/request_logging.py
+++ b/skyvern/forge/request_logging.py
@@ -198,10 +198,17 @@ def _client_ip_from_headers(headers: typing.Mapping[str, str]) -> str | None:
return first_hop or None
+def _is_fixture_endpoint(request: Request) -> bool:
+ return request.url.path.rstrip("/") == "/api/v1/eval-fixtures" or request.url.path.startswith(
+ "/api/v1/eval-fixtures/"
+ )
+
+
def _is_sensitive_endpoint(request: Request) -> bool:
endpoint = f"{request.method.upper()} {request.url.path.rstrip('/')}"
return (
- endpoint in _SENSITIVE_ENDPOINTS
+ _is_fixture_endpoint(request)
+ or endpoint in _SENSITIVE_ENDPOINTS
or any(pattern.fullmatch(endpoint) for pattern in _SENSITIVE_ENDPOINT_PATTERNS)
or (request.method.upper() == "POST" and _ACTION_LOG_ENDPOINT_RE.fullmatch(request.url.path) is not None)
)
@@ -361,7 +368,18 @@ async def log_raw_request_middleware(request: Request, call_next: Callable[[Requ
start_time = time.monotonic()
try:
- body_bytes = await request.body()
+ if _is_fixture_endpoint(request):
+ bounded = bytearray()
+ async with asyncio.timeout(2):
+ async for chunk in request.stream():
+ if len(bounded) + len(chunk) > 4096:
+ return Response(status_code=413)
+ bounded.extend(chunk)
+ body_bytes = bytes(bounded)
+ else:
+ body_bytes = await request.body()
+ except TimeoutError:
+ return Response(status_code=408)
except ClientDisconnect:
# The client closed the connection before the body finished streaming, so no
# response will reach it. Short-circuit with a benign 499 instead of letting