mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-05 20:52:22 +01:00
fix(security): confine teardown paths and avoid interpolating exception data in logs
- routes/gallery/gallery_routes.py: use stable diagnostic log message without interpolating raw exception, resolver details, tokens, or destination strings. - tests/e2e/teardown.js: remove environment-variable path overrides from production code, strictly confine test options and temp directories, and prevent arbitrary directory cleanup. - Add regression tests covering non-leakage of synthetic tokens/queries/exceptions into logs and responses, and path confinement during teardown.
This commit is contained in:
@@ -2195,10 +2195,9 @@ def setup_gallery_routes() -> APIRouter:
|
||||
ok, reason = check_outbound_url(base, block_private=block_private)
|
||||
if not ok:
|
||||
# CodeQL #1203: Never expose internal addresses, resolver errors or raw
|
||||
# exception details to clients. Log useful diagnostic server-side without
|
||||
# printing credentials or raw destination URLs, and return a stable generic response.
|
||||
safe_reason = re.sub(r"://([^:@\s]+):([^@\s]+)@", r"://\1:[REDACTED]@", str(reason))
|
||||
logger.warning("edit-progress endpoint rejected: %s", safe_reason)
|
||||
# exception details to clients or logs. Use a stable diagnostic message
|
||||
# without interpolating untrusted exception content or destination strings.
|
||||
logger.warning("edit-progress endpoint rejected: outbound URL policy check failed")
|
||||
return {"available": False, "reason": "endpoint URL rejected"}
|
||||
|
||||
if not base.endswith("/v1"):
|
||||
|
||||
Reference in New Issue
Block a user