Summary
CodeWhale versions before 0.8.64 do not adequately validate file paths supplied through project configuration instructions. A malicious repository configuration may cause files outside the intended workspace to be read and inserted into an AI system prompt, potentially exposing sensitive data to an attacker.
Affected context
The vulnerability occurs when CodeWhale processes a cloned repository containing a malicious .codewhale/config.toml file. Risk increases when configuration-controlled instruction paths are resolved without being restricted to the project workspace, allowing references to accessible files elsewhere on the victim's system.
Exploit preconditions
- Attack surface: Repository configuration processing in the CodeWhale client
- Required access: The victim must clone or open a repository containing attacker-controlled project configuration
- Trigger point: Evaluation of file paths specified in the configuration instructions field
- Why exploitation is possible: Path validation does not sufficiently constrain resolved files to the intended workspace, and their contents are injected into the AI system prompt
Why this happens
The underlying bug is insufficient canonical path validation for configuration-controlled file references. A path supplied by an untrusted repository is treated as eligible for reading without reliably enforcing a workspace boundary, which maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The resulting file contents are then incorporated into an AI prompt, creating an additional data-exposure path.
Potential impact
- Sensitive local files may be disclosed
- Credentials, tokens, or private configuration data could be exposed
- Confidential source code or user documents may be injected into the AI context
- An attacker could use exposed prompt content for follow-on social engineering or account compromise
- Organizational data-handling and privacy policies could be violated
General mitigation guidance
Mitigation generally focuses on reducing trust in repository-provided configuration and enforcing a strict file access boundary.
Common defensive patterns include:
- Resolve and canonicalize paths before access, then require them to remain within an approved workspace
- Reject absolute paths, traversal segments, symlink escapes, and other boundary-bypassing forms
- Use an allowlist of permitted files or workspace-relative resources by default
- Require explicit user consent before accessing files outside the project directory
- Minimize the data inserted into AI prompts and redact sensitive content where practical
- Run file-reading components with least-privilege operating-system permissions
- Treat cloned repository instructions as untrusted input and preserve secure defaults
How teams detect issues like this
Organizations can detect similar issues through:
- Static analysis for path joins and file reads driven by repository-controlled configuration
- Code review checks for missing canonicalization, boundary checks, or symlink handling
- Tests covering absolute paths, parent-directory traversal, symlink escapes, and platform-specific path formats
- Runtime logging and policy enforcement for file reads outside an approved workspace
- Automated security review tools that flag untrusted path input reaching filesystem APIs

