T09 · Insecure Skill Coding Practices
- Location
scripts/monitor.py:108- Finding
Incomplete Command-Line Redaction May Expose Process Secrets
- Content
View full analysis
Vulnerability Details
File Location:
scripts/monitor.py, lines 108–130
Vulnerability Type: Sensitive information exposure through incomplete redaction
Risk Level: Mediumpython def sanitize_cmdline(cmdline: str) -> str: """Redact sensitive patterns from command lines.""" cmdline = re.sub(r'((?:token|key|secret|password|apikey|api_key|access_token)=)\S+', r'\1***', cmdline, flags=re.IGNORECASE) cmdline = re.sub(r'(--(?:token|key|password|secret|api-key))\s+\S+', r'\1 ***', cmdline, flags=re.IGNORECASE) return cmdline def get_top_processes(n=5): try: result = subprocess.run( ["ps", "aux", "--sort=-pcpu"], capture_output=True, text=True, timeout=5 ) procs = [] for line in result.stdout.strip().splitlines()[1:n+1]: parts = line.split(None, 10) if len(parts) >= 11: cmd = sanitize_cmdline(parts[10]) procs.append({ "user": parts[0], "pid": parts[1], "cpu": parts[2], "mem": parts[3], "rss_mb": round(int(parts[5]) / 1024, 1), "command": cmd[:60], }) return procsTechnical Analysis
The monitor obtains system process information through
ps aux, including usernames and complete command-line arguments. It then attempts to redact credentials using a denylist of selected parameter names.This redaction is incomplete because it only recognizes a limited set of exact patterns. Sensitive values can remain visible when supplied through:
- Unrecognized options such as
--client-secret,--auth-token,--credential, or--private-key. - Short options such as
-p secret. - Positional command-line arguments.
- Authorization headers or connection strings.
- Database, HTTP, or other URLs containi ...[truncated 2186 chars]
- Unrecognized options such as
- Remediation
View remediation
Remediation Suggestions
- Do not include complete process command lines in default output. Report only the executable or process name, such as the
commfield. - Make command-line argument reporting an explicit opt-in feature with a clear warning that arguments can contain credentials and personal information.
- Prefer allowlist-based output that exposes only known-safe process attributes instead of attempting to enumerate every possible sensitive parameter name.
- If arguments must be displayed, redact or omit all argument values rather than relying solely on secret-name matching.
- Consider using
pswith a restricted output format, for example requesting PID, CPU, memory, and executable name without the fullargsfield. - Apply data minimization to usernames and process identifiers when reports may be sent to group chats, logs, or external notification systems.
- Add automated tests covering connection URLs, authorization headers, positional secrets, short options, alternative separators, and parameter-name variants.
- Update
SKILL.mdto accurately warn that process metadata may be sensitive. Remove the unconditional claim that reports contain no tokens, paths, or user data unless this is technically enforced. - Run the monitor with the least-privileged account needed so operating-system process-visibility controls limit the available metadata.
- Do not include complete process command lines in default output. Report only the executable or process name, such as the
