test(ensemble): upload path guard and view-group index regression coverage#2234
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(ensemble): upload path guard and view-group index regression coverage#2234cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Add edge-case assertions for uploadPathContainsParentSegment, verify UploadUtils.uploadFiles rejects traversal paths before I/O, and cover safeViewGroupPayloadIndex when payload length is non-positive. 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 focused unit tests around recently merged security and navigation hardening: multipart upload path traversal rejection and ViewGroup index clamping.
Related Issue
Regression test coverage (automation).
Type of Change
What Has Changed
modules/ensemble/test/upload_path_security_test.dart: ExtendeduploadPathContainsParentSegmentcases (double-dot in filenames vs segment traversal, backslash normalization). AddedUploadUtils.uploadFilestest proving a..path throwsFormatExceptionbefore any network I/O.modules/ensemble/test/safe_view_group_payload_index_test.dart: AssertsafeViewGroupPayloadIndexreturns 0 whenpayloadLengthis negative (defensive contract alongside empty payloads).Risky behavior now covered
photo..jpg-style names stay allowed while real..segments are blocked, and thatuploadFilesfails fast on malicious paths (no reliance on the helper alone).payloadLength <= 0guard used when menus shrink or payloads are inconsistent.Why this reduces regression risk
uploadFilestest ties the guard to the actual upload entry point.safeViewGroupPayloadIndexis shared across drawer, sidebar, and bottom navigation; explicit edge cases prevent accidental changes to the clamp contract.How to Test
From
modules/ensemble:flutter test test/upload_path_security_test.dart test/safe_view_group_payload_index_test.dartNote: The automation VM did not have the Flutter SDK on
PATH, so the above was not executed here. Please run these targets in CI or locally before merge.Screenshots / Videos
N/A
Checklist
flutter analyzeand addressed any new warningsflutter testand all tests pass