T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/vault.py:374
- Finding
- Workspace audit silently reads credential-bearing files from the user's home directory<![CDATA[ ## Vulnerability Details **File Location**: `scripts/vault.py:374-381`, `scripts/vault.py:414-417`, and `scripts/vault.py:627-636` **Vulnerability Type**: Least-privilege boundary violation and excessive credential access **Risk Level**: Medium ### Vulnerable Code ```python def check_shell_history(workspace): """Check shell history files for leaked credentials.""" findings = [] home = Path.home() history_files = [] for hname in SHELL_HISTORY_FILES: hpath = home / hname if hpath.is_file(): history_files.append(hpath) ``` ```python def check_git_config(workspace): """Check git config files for embedded credentials.""" findings = [] config_paths = [] ws_gitconfig = workspace / ".git" / "config" if ws_gitconfig.is_file(): config_paths.append(ws_gitconfig) global_gitconfig = Path.home() / ".gitconfig" if global_gitconfig.is_file(): config_paths.append(global_gitconfig) ``` ```python def check_shell_aliases(workspace): """Check shell RC files for aliases or functions containing credentials.""" findings = [] home = Path.home() rc_files = [ home / ".bashrc", home / ".zshrc", home / ".profile", home / ".bashfile", home / ".zprofile", ] for rcpath in rc_files: if not rcpath.is_file(): continue content = read_text_safe(rcpath) ``` ### Technical Analysis The `--workspace` option creates a reasonable expectation that inspection will remain within the selected workspace. However, the audit and exposure checks unconditionally inspect files in `Path.home()`. The affected sources include complete shell-history files, global Git configuration, and shell startup files. These can contain plaintext passwords, API tokens, authenticated repository URLs, private hostnames, command arguments, and aliases unrelated to the audited project. This behavior is broader than the minimum access necessary for a workspace ...[truncated 1554 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make workspace-only inspection the default for every command. 2. Add an explicit option such as `--include-user-files` before reading home-directory histories, global Git configuration, or shell startup files. 3. Display the exact external paths that will be inspected and obtain clear user approval before opening them. 4. Keep host-level and workspace-level findings in separate report sections. 5. Avoid returning even masked fragments unless explicitly requested; report the pattern type and location by default. 6. Document the expanded host-level scan scope in `SKILL.md` and `README.md`. 7. Add tests verifying that supplying `--workspace` causes no reads outside the resolved workspace unless the explicit opt-in option is present. ]]>
