fix: prevent cleanup() from corrupting user preferences#13
Open
playday3008 wants to merge 1 commit intostaturnzz:mainfrom
Open
fix: prevent cleanup() from corrupting user preferences#13playday3008 wants to merge 1 commit intostaturnzz:mainfrom
playday3008 wants to merge 1 commit intostaturnzz:mainfrom
Conversation
cleanup() runs after UID escalation to root. Writing to NSUserDefaults as root causes it to overwrite the app's preference plist, losing keys like "tweaks". This makes the "Load Tweaks" toggle appear enabled in the UI (storyboard default) while the actual preference is nil, so load_daemons() is silently skipped on subsequent boots. Move the restrap flag reset to ViewController before run_jailbreak() is called, where the process still runs as the mobile user and NSUserDefaults operates on the correct plist.
Author
|
Also, on side note, maybe make Socket also add it's own repo (https://socket-jb.app/repo/) in: Lines 82 to 103 in 89026d2 |
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.
cleanup() writes to NSUserDefaults after the process has escalated to root via set_permissions(). At that point, NSUserDefaults no longer operates on the app's sandboxed plist — it overwrites it with only
{restrap: "no"}, losing thetweakskey.On subsequent boots,
stringForKey:@"tweaks"returns nil,[nil isEqual:@"yes"]is NO, andload_daemons()silently gets skipped. No Substrate injection, no LaunchDaemons, no rc.d scripts. The UI toggle still appears ON because the storyboard default is ON andviewDidLoadonly explicitly sets it for@"yes"with no else clause.The
legacybranch avoided this by writing both keys back in cleanup():When this was rewritten for
main, thetweaksre-write was dropped, exposing the bug.This PR moves the
restrapreset to the ViewController, beforerun_jailbreak()— still running as mobile, NSUserDefaults works correctly, and flags have already been read.