test(ensemble): cover multipart upload path traversal rejection#2232
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): cover multipart upload path traversal rejection#2232cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Cover UploadUtils.uploadFiles so paths with `..` fail with FormatException before any HTTP I/O, matching the upload security hardening. Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
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.
Description
Adds a regression test so
UploadUtils.uploadFilescontinues to reject file paths containing..segments withFormatExceptionbefore any multipart or network work runs. This locks in the recent upload security fix (security(upload): reject file paths with .. segments in multipart uploads).Related Issue
N/A (scheduled regression coverage automation)
Type of Change
What Has Changed
modules/ensemble/test/upload_path_security_test.dartwith an async test that drivesUploadUtils.uploadFilesusing anensembleFilewhosepathcontains parent-directory segments.How to Test
modules/ensemble:flutter test test/upload_path_security_test.dartScreenshots / Videos
N/A
Checklist
flutter analyzeand addressed any new warnings (Flutter SDK not available in this automation environment; CI should run analyze.)flutter testand all tests pass (not run locally here; please run the test file above in CI or locally.)Risky behavior now covered
Multipart uploads previously accepted disk paths from partially trusted inputs; rejecting
..segments prevents reading files outside the intended directory when building multipart requests.Test files added/updated
modules/ensemble/test/upload_path_security_test.dartWhy this reduces regression risk
The helper
uploadPathContainsParentSegmentwas already unit-tested, but a future refactor could remove or bypass the guard insideUploadUtils.uploadFileswhile leaving the helper intact. This test asserts the upload pipeline still fails fast on traversal paths, with no dependency on network timing or a real HTTP server.