fix(v2): scope and redact execution events
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user