Summary
The trace event redaction in trace.rs only handles specific well-known patterns for secret passing (e.g., -H Authorization:, --user, KEY=value with known suffixes). Secrets passed via non-standard patterns are not redacted in trace output when TraceMode::Redacted is enabled.
Threat category: TM-LOG (Logging Security) — extends TM-LOG-001
Severity: Low
Component: crates/bashkit/src/trace.rs, redact_argv() function
Root Cause
The redact_argv() function uses a hardcoded list of patterns:
-H/--header flags (standalone or concatenated)
--user/-u flags
- Headers matching
SECRET_HEADERS list
KEY=value with known SECRET_SUFFIXES (_KEY, _TOKEN, _SECRET, _PASSWORD, _CREDENTIAL)
- URLs with
user:pass@host pattern
These miss common secret-passing patterns:
--token VALUE (many CLI tools)
--api-key VALUE
--password VALUE
-p PASSWORD (mysql, ssh, etc.)
--secret VALUE
- Base64-encoded credentials as positional args
- Secrets in JSON body arguments (
-d '{"password":"..."}')
Steps to Reproduce
# These secrets are NOT redacted in Redacted trace mode:
curl https://api.example.com --token sk-secret-123
http POST https://api.com token==secret123
echo '{"password":"s3cr3t"}' | curl -d @- https://api.com
Impact
- Secret exposure in logs: When trace mode is Redacted, users expect secrets to be scrubbed. Non-standard patterns leak through.
- False sense of security: The Redacted mode name implies comprehensive redaction.
- AI agent context: Tool output containing trace events could expose credentials to LLMs.
Acceptance Criteria
Summary
The trace event redaction in
trace.rsonly handles specific well-known patterns for secret passing (e.g.,-H Authorization:,--user,KEY=valuewith known suffixes). Secrets passed via non-standard patterns are not redacted in trace output whenTraceMode::Redactedis enabled.Threat category: TM-LOG (Logging Security) — extends TM-LOG-001
Severity: Low
Component:
crates/bashkit/src/trace.rs,redact_argv()functionRoot Cause
The
redact_argv()function uses a hardcoded list of patterns:-H/--headerflags (standalone or concatenated)--user/-uflagsSECRET_HEADERSlistKEY=valuewith knownSECRET_SUFFIXES(_KEY,_TOKEN,_SECRET,_PASSWORD,_CREDENTIAL)user:pass@hostpatternThese miss common secret-passing patterns:
--token VALUE(many CLI tools)--api-key VALUE--password VALUE-p PASSWORD(mysql, ssh, etc.)--secret VALUE-d '{"password":"..."}')Steps to Reproduce
Impact
Acceptance Criteria
--token,--api-key,--password,--secret,-pto the redacted flag patternssk-*,ghp_*, base64-like strings)