Skip to content

worker: refuse path restores onto whole storage roots - #12

Draft
ash-iir wants to merge 1 commit into
mainfrom
fix-path-restore-guard
Draft

ash-iir wants to merge 1 commit into
mainfrom
fix-path-restore-guard

Conversation

@ash-iir

@ash-iir ash-iir commented Nov 19, 2026

Copy link
Copy Markdown
Owner

do_path_restore runs rm -rf on its target before extracting. Adds path_restore_ok, which refuses:

  • a whole user or storage root: /sdcard, /storage/emulated/N, /data/media/N, /data/user/N, /data/user_de/N
  • a top-level /data/<dir> (e.g. /data/system) or /data itself
  • /data/adb and anything under it (the root manager's own tree)

Anything deeper still restores as before (/sdcard/DCIM, /data/user/0/<pkg>, /data/local/tmp, …). A path backup taken of one of the refused roots can no longer be restored in place; it fails with ERR_BAD_PATH.

Testing

  • sh -n on worker.sh.
  • path_restore_ok under mksh and busybox sh on 14 paths (the roots above refused, the deeper ones allowed, trailing / handled).
  • Not tested on a rooted device.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant