Repository navigation
Keep upload file names and readable bytes for file inputs - #64
Merged
Merged
Conversation
Stage each upload as <uuid>/<source name> so pages see the real file name and MIME type, and keep delivered uploads on disk for 10 minutes because Chrome reads file input bytes only when the page uses them. A starting host sweeps per-upload directories older than 15 minutes.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Windows opens a directory handle only with backup semantics and needs the write-attributes right to change its timestamps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
upload_filefailed on sites that check uploads, such as GitHub's avatar upload:<uuid>.upload, so the page saw a file with no extension or MIME type and rejected it ("Only images, please").Fileand reads the bytes only when the page uses it, so the upload request then failed.Change
upload-staging/<uuid>/<source file name>(directory0700, file0600). Cleanup removes the file and its per-upload directory.docs/security.mdand the changelog.Verification
cargo test -p agenttab-host: all pass. New tests cover the kept file name, cleanup of the per-upload directory, and the stale sweep. The commit test now asserts the staged bytes stay readable.is-bad-file(from the name fix) and thenis-failed(from early deletion).cargo clippy -D warningsreports only the twotoo_many_argumentserrors already onmain(journal.rs,runtime.rs).