Commit 6139e2d
fix: redact sensitive credentials from command logs
Use the existing redact_text_secrets utility to redact sensitive environment
variables and credentials (API keys, tokens, etc.) from logged command
output. This prevents credentials from appearing in logs when passed to
subprocesses via environment variables or command-line arguments.
Changes:
- Import redact_text_secrets from openhands.sdk.utils.redact
- Apply redaction to all logged commands in execute_command()
- Leverages existing comprehensive secret detection patterns:
- API keys from major providers (OpenAI, Anthropic, HuggingFace, etc.)
- Bearer tokens and session tokens
- Database and service credentials
- URL query parameters with sensitive values
Security Impact:
- Credentials (LMNR_PROJECT_API_KEY, API keys, tokens) no longer appear
in logger output for commands like "docker run", "python", etc.
- Prevents leaks to Datadog, CloudWatch, and other log aggregators
- Maintains command structure for debugging (shows "KEY=<redacted>")
Example:
Before: "$ docker run -e LMNR_PROJECT_API_KEY=sk-... -e RUNTIME_API_KEY=..."
After: "$ docker run -e LMNR_PROJECT_API_KEY=<redacted> -e RUNTIME_API_KEY=<redacted>"
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>1 parent 3e0a3a0 commit 6139e2d
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
0 commit comments