The vulnerability stems from a critical lack of input validation on the meta.knowledge field for workspace models. An authenticated user with permissions to create or edit models can associate an arbitrary file ID with a model, even if they do not own or have access to that file. The application fails to verify this association at the time of creation, update, or import.
This unvalidated metadata is then improperly trusted as an authorization credential in other parts of the system. The has_access_to_file function, which governs access to file read and delete operations, will grant access if a file is referenced in any of the user's models' meta.knowledge. Similarly, the view_file built-in tool contains a bypass that allows file content to be read if the file ID is present in the model's knowledge.
An attacker can therefore perform the following actions on a victim's private file after obtaining its ID:
- Create a model with a forged
meta.knowledge entry pointing to the victim's file ID.
- Use the
view_file tool with this model to read the file's extracted text.
- Call the file content API (
GET /api/v1/files/{id}/content) to read the full file content.
- Call the file deletion API (
DELETE /api/v1/files/{id}) to delete the file.
The fix involves adding strict validation on all model write paths (create, update, import) to ensure the user has legitimate 'read' access to any file ID before it can be added to meta.knowledge.