Repository navigation
Conversation
App archives are extracted into a shared parent directory (the user's data dir, Android/data, the profiles dir). Validate that every member of such an archive stays under the app's own top-level entry before it is extracted: <pkg> for data, data_de, external, obb and media archives, ref/<pkg> and cur/<user>/<pkg> for ART profiles. The same check is used by restore-test and the DataBackup import. Archives without a base keep the existing absolute-path and '..' check. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com>
This was referenced Nov 19, 2026
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.
App archives are extracted into a shared parent directory (
/data/user/<u>,/data/user_de/<u>,Android/data|obb|media,/data/misc/profiles). This tightens the pre-extraction member check so every member must stay under the app's own top-level entry.scan_members [<base>...]: besides the existing absolute-path and..check, when bases are given each member must be<base>or<base>/...(a leading./is accepted).archive_safe <archive> <enc> [<base>...]passes the bases through.$PKGfor data, data_de, external, obb and media;ref/$PKGandcur/$U/$PKGfor profiles. These match howarchive_dir(-C "$(dirname src)" -c "$PKG") andarchive_profiles(-C /data/misc/profiles -c ref/$PKG cur/$U/$PKG) create them.db_item):$PKG, matching its<pkg>/...layout../-relative), DataBackup apk archive (temp dir), special, path and adb restores (their own guards).Overlaps the
archive_safe/list_safechange in #2; whichever merges second needs a small rebase.Testing
sh -n,mksh -n,busybox sh -non worker.sh;shellcheck -s sh: no new warnings (96 before and after).scan_members/archive_safeextracted and run under mksh R59, busybox 1.37 ash and dash, with GNU tar 1.35 and busybox tar listings, on 12 hand-built archives (own app only, extra sibling app dir, name-prefix sibling,./-relative,./<pkg>, profile members for another package, wholeref/, plain and gzip). All expected results with GNU tar; with busybox tar one pre-existing no-base case differs because busybox normalises names intar -t(the base check still rejects that archive).