Path Traversal Vulnerability in Admin Ingestion Exposes Server Files
A critical path traversal vulnerability in the admin panel's ingestion function allows authenticated users to copy and process sensitive system files from anywhere on the server. The flaw resides in the `_run_ingestion()` function within `src/ui/admin.py`, which accepts a `target_path` parameter and copies the specified file into the application's `INBOX_DIR` for processing. The function performs no validation to prevent directory traversal sequences like `../`, meaning a malicious path can escape the intended `ARCHIVE_DIR`.
At line 72, the code converts the user-supplied `target_path` directly into a `Path` object. It only checks if the file exists (line 73) before using `shutil.copy2()` to copy it (line 76). This design allows an attacker to pass a path such as `../../etc/passwd` on Unix-like systems or `C:\Windows\System32\config\SAM` on Windows. The server will then copy that sensitive file into the inbox, where it is subsequently processed by the application's ingestion pipeline.
The vulnerability represents a significant server-side security failure, as it grants admin-level users—or any attacker who compromises an admin account—the ability to read and exfiltrate arbitrary files. This could lead to the exposure of configuration files, environment variables containing secrets, or critical system data. The lack of path sanitization in a core administrative function points to a broader oversight in the codebase's security review for privileged operations.