Repository navigation
Conversation
- Encrypted special restore piped the decrypted stream into decomp, which reads its file argument and ignores stdin, so tar got no input after the live data was already removed. Add decomp_in (stdin, codec by filename) and use it there and in archive_safe. - archive_safe only checked member paths, so a listing that failed or was empty (wrong passphrase, unreadable archive) passed and the target was wiped before extraction failed. list_safe now also requires tar -t to succeed and list at least one member; the Neo import check uses it too. - cleanup() removed staging files matching *$OPID*, so op-1 also removed op-10/op-11 files of running workers. Match .$OPID and .$OPID.* only. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 534a2f0)
Under mksh printf is an external command, so a large listing passed as one argument hit ARG_MAX, printf failed and scan_members read an empty stdin and returned 0. Read the listing from a here-doc instead, and fail on an empty listing directly. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit a818ee6)
worker.sh and helper.sh each repeated a slightly different case pattern for package names. Replace them with valid_pkg, which accepts only [A-Za-z0-9._] without a leading dot, the same rule Android uses. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 42fff6b)
do_special_restore wiped the target before checking the item's sha256, and accepted any /data path from the manifest. Check the sha256 first, as restore() does, and only restore into a path the category owns (special_candidates, split out of special_paths). Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 2aa52d7)
The staging dir was created with the inherited umask and media_own -R then handed the finished backup to media_rw, so it was not root-only while it waited for upload. Create the staging root 0700 and skip media_own for remote-only backups, which are never listed under /sdcard. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit e3ec8d6)
freeze() killed every process of the uid that owns /data/data/<pkg>. For a system app sharing uid 1000 that includes system_server (soft reboot), and /data/data is always user 0, so a secondary-user op stopped the user-0 instance. Read /data/user/$U and fall back to pidof below 10000. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit 0d143f8)
do_path_restore wipes its target before extracting. Refuse targets that would take a whole user or storage root with it (/sdcard, /data/media/N, /data/user/N, /data/<dir>) and /data/adb. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit b72a4a3)
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> (cherry picked from commit 24aa5b9)
detach() now hands the worker its arguments in a 0600 file under the root-only state dir instead of argv; the worker reads it once and removes it. jget and the age passphrase feed use here-docs instead of printf, which is not a builtin in mksh and would otherwise run as an external command with the data in its arguments. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit a32aabc)
Add age_pass_ok, which decrypts a short prefix of an age file (one scrypt KDF, no full decrypt) to tell whether the passphrase opens it. App, special and path restores run it before the archive check and the wipe, so a wrong passphrase ends with ERR_CRYPTO_PASS and the WebUI asks for the passphrase again. restore-test reports it as pass:<archive>. The adb restore probe uses the same helper instead of a full decrypt. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit a8f6f1a)
…l fails Only restore() checked that the package was installed after the install session. Snapshot and Mirror restores and the Neo-Backup and DataBackup imports ignored a failed install, then restored the data and reported success. - New install_ok: the same pm path --user check as restore(), with ERR_INSTALL on failure; used after each of the four install steps. - Create the install session only when there are APKs to write. - Neo import: a decrypt failure (APK or data archive) now ends with ERR_IMPORT_ENCRYPTED, so the WebUI asks for the password again, instead of skipping the item and reporting success. A session opened for the APKs is abandoned. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit e12faab)
A special backup reported success even when nothing usable was written: there was no crypto check, archive failures were dropped silently, the tar exit status was masked, and the only test was a non-empty manifest. - Check crypto_available up front when a passphrase is set. - Use the same .trc sentinel and read-back check as archive_dir for each archive; a failure removes that archive and fails the backup. - Fail when a selected category produced no item. - A failed special backup removes its incomplete directory. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> (cherry picked from commit ea24deb)
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.
What
Fixes in the restore and archive paths of
worker.sh(plus the shared package-name check inhelper.sh): restores no longer wipe data they then fail to restore, archives are checked (readable, members inside the app's own dir) before anything is deleted, a wrong passphrase is reported up front, failed APK installs fail the restore, and operation secrets stay off process argv.One commit per fix, so any of them can be dropped on its own. Each line links the draft PR on my fork that has the full write-up and repro for that fix.
Checklist
lang/<code>.jsonandREADME.<code>.mdwere updated. (no UI label changes)git commit -s).sh -n,mksh -n,busybox sh -nandshellcheck -s sh(no new warnings), small mksh/busybox repro scripts per fix, and thetools/screenshotsPlaywright mocks (en and ar) for WebUI changes.Notes
list_safereads the tar listing from a here-doc: under mkshprintfis external, and a listing above ARG_MAX (tested with 30,000 members) made the check pass without scanning. The Telegram 2FA password is still passed on argv; moving it needs mtproto-store to read it from a file or env (VictorGabriel7Dev/mtproto-store#1 is related).The five grouped PRs (restore safety, scheduler, destinations, WebUI fixes, performance) merge cleanly together in any order; I checked that combining all of them gives the same tree as my test build.