Fix secret exposure in function and agent trace spans - #6000
Fix secret exposure in function and agent trace spans#6000BillLeoutsakosvl346 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cursor review |
PR SummaryHigh Risk Overview A new Function blocks keep unresolved env refs in display code (resolver no longer inlines env vars there). Streaming estimates token usage from resolved input before sanitization and stops overwriting sanitized log content with raw stream text. HITL resume rebuilds log output from sanitized sources via Reviewed by Cursor Bugbot for commit e73afbe. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR stops environment-resolved secrets from being persisted in observability surfaces while leaving runtime execution values intact.
Confidence Score: 5/5The PR appears safe to merge; no blocking failures remain from prior Greptile threads or eligible follow-up findings. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/executor/utils/environment-secret-sanitizer.ts | New recursive env-reference sanitizer for observability copies only, with longest-first and URL-encoded replacements. |
| apps/sim/executor/execution/block-executor.ts | Sanitizes log inputs/outputs/errors/child spans and estimates streaming cost from resolved input before sanitization. |
| apps/sim/lib/logs/execution/logging-session.ts | Session-level sanitizer on completion paths; cost still computed from raw spans. |
| apps/sim/lib/workflows/streaming/streaming.ts | No longer writes raw streamed content back into already-sanitized block logs. |
| apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts | Resume updates runtime state from raw pause output and logs from the sanitized log copy via shared builder. |
| apps/sim/executor/variables/resolver.ts | Function display code no longer inlines environment variable values. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Config["Block config + env vars"] --> Sanitizer["createEnvironmentSecretSanitizer"]
Resolve["Resolve inputs for handlers"] --> Runtime["Runtime state / API / retries"]
Resolve --> Logs["blockLogs + onBlockComplete"]
Runtime --> Logs
Sanitizer --> Logs
Logs --> Session["LoggingSession.safeComplete*"]
Sanitizer --> Session
Session --> Persist["Persisted finalOutput + traceSpans"]
Runtime -.->|not mutated| Downstream["Downstream blocks / resume state"]
Reviews (4): Last reviewed commit: "preserve streaming usage estimates" | Re-trigger Greptile
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 95d4fd1. Configure here.
|
@cursor review |
|
@greptile please review the latest commit, including the workflow-overview sanitization follow-up and the streaming token-accounting correction. |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e73afbe. Configure here.
|
Demo: Screen.Recording.2026-07-28.at.12.00.01.AM.mov |
What changed
{{ENV_VAR}}references in trace/display values, including nested tool calls, timing segments, errors, object keys, and URL-encoded values.Root cause
Block inputs and provider/tool outputs were logged after environment references had been resolved. Function display code also resolved environment values, and post-executor paths could overwrite sanitized logs with raw streaming, pause-state, or workflow final-output data immediately before persistence.
Impact
New trace spans and Overview workflow output show configured references such as
{{AWS_SECRET_ACCESS_KEY}}instead of plaintext values. Runtime tool/function execution, API responses, downstream block behavior, billing, retries, pause/resume, and persisted runtime state remain unchanged. Existing historical logs are not rewritten.Validation
git diff --check