You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
We might want to just sanitize the filename as a string instead of a path i.e. no weird characters, including /. This will also solve an issue if the filename appears to be a subdirectory
curl http://127.0.0.1:3928/v1/files -X POST -F "data=@libvulkan.so;filename=abc/hello" -F purpose=assistants
{"message":"Failed to open file for writing: <redacted>/cortexcpp/files/abc/hello"}
Cortex version
dev 2e1dfa0
Describe the issue and expected behaviour
Something like this will hang the server
curl http://127.0.0.1:3928/v1/files -X POST -F "data=@libvulkan.so;filename=../hi" -F purpose=assistantsDigging further, I find that this loop never exits in such cases https://github.com/menloresearch/cortex.cpp/blob/2e1dfa02ccdf7816b02223f01d95e658c7296fa8/engine/repositories/file_fs_repository.cc#L20-L25
We might want to just sanitize the filename as a string instead of a path i.e. no weird characters, including
/. This will also solve an issue if the filename appears to be a subdirectory(or we can just store the binary file in a DB 😆)
Steps to Reproduce
No response
Screenshots / Logs
No response
What is your OS?
What engine are you running?
Hardware Specs eg OS version, GPU
No response