fix(v2): scope and redact execution events

This commit is contained in:
2026-07-27 22:26:40 +02:00
parent c97dd8cfb2
commit c729f5db80
3 changed files with 32 additions and 9 deletions
+17 -1
View File
@@ -169,9 +169,25 @@ async def retry(db: AsyncSession, execution_id: str) -> Execution | None:
return execution
def _redact_progress(value: object) -> object:
"""Apply common redaction plus execution-specific path redaction recursively."""
if isinstance(value, Mapping):
safe: dict[str, object] = {}
for key, item in value.items():
normalized = str(key).lower()
if any(marker in normalized for marker in ("path", "secret", "token", "password")):
safe[str(key)] = "[REDACTED]"
else:
safe[str(key)] = _redact_progress(item)
return safe
if isinstance(value, list):
return [_redact_progress(item) for item in value]
return redact(value)
def public_event(execution: Execution) -> dict[str, object]:
"""Return redacted progress suitable for polling or SSE."""
progress = redact(execution.progress)
progress = _redact_progress(execution.progress)
return {
"id": execution.id,
"state": execution.state,