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 }}
Repository navigation
Generative image, dataset and component image endpoints read files outside their folders #1067
Several endpoints build file paths from request input without checking that the result stays inside the folder they serve. #1063 fixes this pattern in the static frontend route (front_api.py); the endpoints below still have it.
GET /api/v1/generative-process/file/{filename} (generative_process.py#L421-L427) joins filename onto IMAGES_PATH and serves the result. The path converter blocks /, but on Windows an encoded backslash stays inside one segment, so .. escapes the images folder. Confirmed by reading a file placed outside IMAGES_PATH.
Dataset endpoints take a raw filesystem path query parameter and read <path>/dataset/... without consulting the database: GET /dataset/sample/file (datasets.py#L642-L678), GET /dataset/file/info (L701-L729), GET /dataset/types/file (L886-L912), GET /dataset/file/ (L1555) and GET /dataset/export/csv (L1787-L1836). Any DashAI dataset folder on the machine can be read or exported. Confirmed with a folder outside the data root.
GET /api/v1/component/image/{component_name}/ (components.py#L565-L583) opens image_preview from component metadata relative to the images folder without containment, and fetches it with requests.get when it is a URL. This needs a malicious plugin, so it is low risk.
Impact
File read outside the data folders, with no authentication. These are GET requests, so they also matter for the DNS rebinding gap in the API (#1070).
Suggested fix
One shared helper that resolves the candidate path and refuses anything not inside the allowed root (resolve() then is_relative_to), handling .., backslashes, absolute paths and drive letters. The fix in Harden API request handling and access boundaries #1063 for front_api.py already does this and could be reused.
Look datasets up by id on the server instead of taking a filesystem path from the client; update the frontend callers.
For component images, confine local paths to the images folder and drop or allowlist remote fetching.
Activity