Skip to content

document that the upload folder argument is trusted app input#1306

Merged
lovasoa merged 1 commit into
mainfrom
ophir.lojkine/document-persist-upload-folder-trust
Jun 10, 2026
Merged

document that the upload folder argument is trusted app input#1306
lovasoa merged 1 commit into
mainfrom
ophir.lojkine/document-persist-upload-folder-trust

Conversation

@lovasoa

@lovasoa lovasoa commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

document that the upload folder argument is trusted app input

sqlpage.persist_uploaded_file(field, folder, ...) resolves folder relative to the web root by joining it directly (functions.rs#L515-L517). A folder containing .. or an absolute path therefore writes the uploaded file outside the web root. This is intended behavior: folder is meant to be a constant the app author chooses, not request data.

The docs never said this explicitly, so this PR adds the warning. No code path changes, no CHANGELOG entry (docs only).

Verify the diff is docs/comment only:

git diff main...ophir.lojkine/document-persist-upload-folder-trust

Document that the folder/destination_folder argument of
sqlpage.persist_uploaded_file must be chosen by the app author and never
derived from untrusted request data. It is joined directly to the web
root, so a value containing '..' or an absolute path would write the
uploaded file outside the web root. Docs-only clarification of existing
intended behavior; no logic change.
@lovasoa lovasoa force-pushed the ophir.lojkine/document-persist-upload-folder-trust branch from 6f1e537 to 5d806b4 Compare June 10, 2026 13:59
@lovasoa lovasoa merged commit abd60cd into main Jun 10, 2026
51 checks passed
@lovasoa lovasoa deleted the ophir.lojkine/document-persist-upload-folder-trust branch June 10, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant