T09 · Insecure Skill Coding Practices
- Location
scripts/env_manager.py:107- Finding
Plaintext Secret Disclosure Through CLI Output
- Content
View full analysis
1 else ".env" env = load_env(path) for k, v in env.items(): print(f"{k}={v}") elif cmd == "switch": env_name = args[1] if len(args) > 1 else "development" env = switch_env(env_name) print(f"Switched to {env_name}") for k, v in env.items(): print(f"{k}={v}") elif cmd == "get": key = args[1] print(os.getenv(key, "")) elif cmd == "set": key, value = args[1], args[2] set_var(key, value) print(f"Set {key}={value}") ``` ```python elif cmd == "diff": f1, f2 = args[1], args[2] env1 = load_env(f1) env2 = load_env(f2) diff = diff_env(env1, env2) for k, v in diff.items(): print(f"{k}: {v['old']} -> {v['new']}") ``` ### Technical Analysis The `load`, `switch`, `get`, `set`, and `diff` commands write complete environment-variable values to standard output. Environment files routinely hold API tokens, database passwords, private endpoints, session secrets, and cloud credentials. Standard output may be retained in shell scrollback, CI/CD logs, centralized logging systems, terminal recordings, support bundles, or AI-agent transcripts. The `set` command additionally echoes a secret immediately after it is supplied. The `diff` command can disclose both the old and replacement value. No sensitivity detection, masking, confirmation prompt, or explicit secret-display option is applied. ### Attack Path 1. A user, automation system, or AI agent invokes a documented command such as `load`, `switch`, `get`, `set`, or `diff`. 2. The selected environment file or process environment contains credentials or other confidential values. 3. The command prints those values in plaintext. 4. The ...[truncated 696 chars]- Remediation
View remediation
