Summary
A path traversal vulnerability in the file-handling APIs of engineer-your-data (up to version 0.1.3) allows attackers to manipulate the WORKSPACE_PATH argument to access arbitrary filesystem locations.
When exposed remotely, this can enable reading, writing, or enumerating files outside the intended workspace, depending on how the affected functions are used by the application.
Affected context
The issue occurs in deployments that expose the read_file, write_file, list_files, or file_inf functionality from src/server.py over a network interface or API and pass client-controlled values into WORKSPACE_PATH.
It is most relevant when the server is running on a host with access to sensitive files or shared resources, and when directory boundaries are expected to constrain file operations but are not strictly enforced.
Exploit preconditions
- Attack surface: Remote, via HTTP or similar API endpoints that wrap read_file/write_file/list_files/file_inf.
- Required access: Ability to send requests that influence the WORKSPACE_PATH or related path parameters (typically unauthenticated or low-privilege API access, depending on deployment).
- Trigger point: Any call to the vulnerable functions where user input is combined with WORKSPACE_PATH and used in filesystem operations without canonicalization and validation.
- Why exploitation is possible: The implementation does not adequately normalize and validate paths to ensure they remain under an intended base directory; sequences such as "../" or equivalent constructs can escape the workspace boundary.
Why this happens
This vulnerability stems from insufficient validation and normalization of user-influenced file paths before performing filesystem operations.
The server code appears to treat the WORKSPACE_PATH argument as trusted, concatenating it with user input or directly using it to construct paths for read, write, and listing operations.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where applications fail to enforce directory restrictions, allowing attackers to navigate outside the intended root.
Potential impact
- Read access to files outside the intended workspace, which may include configuration files, credentials, or source code.
- Overwriting or creating files in unexpected locations if write operations are exposed through the same path handling.
- Discovery of filesystem structure and metadata via directory listing or file information queries.
- Potential pivot to further compromise, such as modifying application configuration or scripts that are later executed by other components.
- Exposure of other tenants' data in multi-tenant environments that share the same underlying filesystem.
General mitigation guidance
Effective mitigation focuses on strictly enforcing filesystem boundaries and treating all file path inputs as untrusted:
- Constrain all file operations to a fixed, server-side base directory, and reject any request that resolves outside this root.
- Canonicalize paths (e.g., using realpath/resolve) before checks, then validate that the resolved path starts with the expected base directory.
- Avoid directly concatenating user input into filesystem paths; instead, map user-supplied identifiers to server-side paths via whitelists or lookups.
- Implement an allowlist for permissible file names or subdirectories, rather than attempting to block known-bad patterns like "../".
- Run the service under a dedicated, least-privileged OS account with minimal filesystem permissions to reduce blast radius if traversal occurs.
How teams detect issues like this
Detection typically combines code-centric and operational approaches:
- Static analysis rules targeting unvalidated use of path parameters in open/read/write/list operations, especially where "../" sequences are not explicitly handled or canonicalization checks are missing.
- Code review checklists that require reviewers to verify base-directory enforcement and path normalization for any file-access APIs.
- Runtime monitoring or WAF rules looking for suspicious path patterns (e.g., "../", URL-encoded traversal sequences) in file-related endpoints.
- File integrity and access logging on the host to detect unexpected reads/writes outside the intended workspace directory, correlated with API requests.

