Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
6010bb8
Define validated opt-in per-guest privacy policy keys with safe defaults
CORBENDALLAS111 Nov 25, 2026
14832ca
Include optional filtering of explicit UIKit screenshot event subscri…
CORBENDALLAS111 Nov 25, 2026
de3325e
Apply opt-in guest API restrictions for capture, microphone, battery,…
CORBENDALLAS111 Nov 25, 2026
27efcfa
Apply guest privacy preferences before guest code executes, including…
CORBENDALLAS111 Nov 25, 2026
6044eb2
Expose persisted per-guest privacy preferences to SwiftUI
CORBENDALLAS111 Nov 25, 2026
6b8ddf1
Save guest restrictions atomically with rollback on failed write
CORBENDALLAS111 Nov 25, 2026
c2d138c
Add native per-app Privacy & Permissions Form with five persisted gue…
CORBENDALLAS111 Nov 25, 2026
44b40b2
Link guest privacy settings, remove nested list scrolling and allow l…
CORBENDALLAS111 Nov 25, 2026
b94baf8
Localize guest privacy restrictions and clearly describe their API-le…
CORBENDALLAS111 Nov 25, 2026
ab4e399
Remove iPad device-wide Apps toolbar overlay that collides with pushe…
CORBENDALLAS111 Nov 25, 2026
04e0746
Move all iPad/iPhone app actions into the home safe area and clamp sc…
CORBENDALLAS111 Nov 25, 2026
dea6d7c
Adapt grid columns to actual compact window and accessibility text width
CORBENDALLAS111 Nov 25, 2026
17540c9
Test compact iPad windows and accessible grid widths across iPhone an…
CORBENDALLAS111 Nov 25, 2026
45f6c7c
Test per-app policy isolation, malformed values and default-off binar…
CORBENDALLAS111 Nov 25, 2026
7540ad5
Run native Objective-C guest privacy policy regression tests during i…
CORBENDALLAS111 Nov 25, 2026
2a01b10
Document actual guest restriction coverage, unsupported APIs and adap…
CORBENDALLAS111 Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/livecontainer-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
run: |
set -o pipefail
python3 -m unittest discover -s Tests -p 'test_*.py'
xcrun --sdk macosx clang -fobjc-arc -framework Foundation Tests/GuestPrivacyPolicyTests.m -o /tmp/guest-privacy-policy-tests
/tmp/guest-privacy-policy-tests
swift test 2>&1 | tee package-tests.log
- name: Archive using upstream configuration
run: |
Expand Down
39 changes: 39 additions & 0 deletions GUEST_PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Guest Privacy & Permissions

Open a guest app's settings, then Privacy & Permissions. Each preference belongs
to that app's LCAppInfo.plist, not a global user default. Defaults are off.
Completely stop the guest and relaunch it before testing changes. The embedded
SideStore is excluded; guest extension bootstrap reads the supplied guest info.

| Setting | Implemented scope | Limits |
| --- | --- | --- |
| Camera | AVFoundation authorization/request, device input factory, session canAddInput/addInput, UIImagePickerController availability | Other media APIs, direct initializers and system services are not guaranteed |
| Microphone | AVFoundation audio input, permission callbacks, AVAudioRecorder methods | Other engines, audio units and system services are not guaranteed |
| Battery | UIDevice monitoring, level/state and explicit notifications | Other APIs may expose information |
| Proximity | UIDevice monitoring and explicit notifications | Other sensors and APIs unaffected |
| Screenshot notifications | Named UIKit screenshot subscriptions | Does not change OS capture protection, screen recording state or other detection paths |

These are in-process API restrictions, not security boundaries. System location,
photos, contacts, Bluetooth, local network, tracking and other permissions remain
shared with LC+. No invented hardware/profile values, fake system permissions,
or guarantees against hostile guests. For strict hardware permission denial use
the iOS Settings for LC+, affecting all its guests.

## Adaptive UI changes
- Apps actions now belong to the Home safe-area layout rather than a global
iPad overlay, avoiding overlap with pushed settings and narrow windows.
- Home retains a continuous vertical grid and native scroll-edge rendering.
- Columns adapt to available width and accessibility text sizes; scaled icons
are clamped to cell width. Titles use semantic system backgrounds.
- App settings no longer nest a List inside Form. Long identifiers wrap.
- Native Privacy Form, localized in English/Russian, includes errors and reset.

## Verification
Source review and CI are not screenshot verification. On physical devices check
camera and microphone authorization and media input denial; battery/proximity
unknown state; opt-in named screenshot event filtering; disabled-policy behavior;
one guest's settings do not affect another. Check restart and reset; ensure SideStore
still works. Review iPhone SE/standard/Max, iPad mini, 11/13-inch iPad, portrait,
landscape, compact windows, light/dark, accessibility Dynamic Type, VoiceOver,
and Reduce Motion. Open and close app settings to verify the Apps toolbar does
not remain over the child view. A full visual review requires actual screenshots.
3 changes: 3 additions & 0 deletions LiveContainer/LCBootstrap.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdlib.h>
#include "../litehook/src/litehook.h"
#import "Tweaks/Tweaks.h"
#import "Tweaks/LCGuestPrivacyHooks.h"
#include <mach-o/ldsyms.h>

extern char **environ;
Expand Down Expand Up @@ -293,6 +294,7 @@ void overwriteExecPath(const char *newExecPath) {
NUDGuestHooksInit();
NSFMGuestExtensionHooksInit(request[@"parentContainerPath"]);
NSURLSCGuestHooksInit();
LCGuestPrivacyHooksInit(guestAppInfo);
GuestExtensionHooksInit();

if (!LCSharedUtils.certificatePassword && !isSideStore) {
Expand Down Expand Up @@ -603,6 +605,7 @@ void overwriteExecPath(const char *newExecPath) {
SecItemGuestHooksInit();
NSFMGuestHooksInit();
initDead10ccFix();
LCGuestPrivacyHooksInit(guestAppInfo);
}
if(isLiveProcess) {
NSURLSCGuestHooksInit();
Expand Down
196 changes: 196 additions & 0 deletions LiveContainer/Tweaks/LCGuestPrivacyHooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#import "LCGuestPrivacyPolicy.h"
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <objc/runtime.h>

// These are compatibility/privacy controls in a guest process, not a new
// sandbox. Install before guest code runs; never change TCC, system capture
// protections, privacy indicators, or a host-only SideStore process.
static inline BOOL LCPrivacyReplace(Class cls, SEL sel, IMP replacement) {
if (!cls) { imp_removeBlock(replacement); return NO; }
Method method = class_getInstanceMethod(cls, sel);
if (!method) { imp_removeBlock(replacement); return NO; }
// Do not replace an inherited implementation on an unrelated superclass.
if (!class_addMethod(cls, sel, replacement, method_getTypeEncoding(method))) {
class_replaceMethod(cls, sel, replacement, method_getTypeEncoding(method));
}
return YES;
}

static inline BOOL LCPrivacyCaptureTypeBlocked(NSString *type, BOOL camera, BOOL microphone) {
return (camera && [type isEqualToString:AVMediaTypeVideo]) ||
(microphone && [type isEqualToString:AVMediaTypeAudio]);
}

static inline BOOL LCPrivacyCaptureDeviceBlocked(AVCaptureDevice *device, BOOL camera, BOOL microphone) {
return device && ((camera && [device hasMediaType:AVMediaTypeVideo]) ||
(microphone && [device hasMediaType:AVMediaTypeAudio]));
}

static inline NSError *LCPrivacyDeniedError(void) {
return [NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError
userInfo:@{NSLocalizedDescriptionKey: @"Access restricted by LifeContainer+ guest privacy settings."}];
}

static inline void LCPrivacyInstallCapture(BOOL camera, BOOL microphone) {
if (!camera && !microphone) return;
Class meta = object_getClass(AVCaptureDevice.class);
SEL status = @selector(authorizationStatusForMediaType:);
AVAuthorizationStatus (*originalStatus)(id, SEL, AVMediaType) =
(void *)class_getMethodImplementation(meta, status);
LCPrivacyReplace(meta, status, imp_implementationWithBlock(^AVAuthorizationStatus(id self, AVMediaType type) {
if (LCPrivacyCaptureTypeBlocked(type, camera, microphone)) return AVAuthorizationStatusDenied;
return originalStatus(self, status, type);
}));

SEL access = @selector(requestAccessForMediaType:completionHandler:);
void (*originalAccess)(id, SEL, AVMediaType, void (^)(BOOL)) =
(void *)class_getMethodImplementation(meta, access);
LCPrivacyReplace(meta, access, imp_implementationWithBlock(^(id self, AVMediaType type, void (^completion)(BOOL)) {
if (LCPrivacyCaptureTypeBlocked(type, camera, microphone)) {
if (completion) dispatch_async(dispatch_get_main_queue(), ^{ completion(NO); });
return;
}
originalAccess(self, access, type, completion);
}));

Class inputMeta = object_getClass(AVCaptureDeviceInput.class);
SEL factory = @selector(deviceInputWithDevice:error:);
AVCaptureDeviceInput *(*originalFactory)(id, SEL, AVCaptureDevice *, NSError **) =
(void *)class_getMethodImplementation(inputMeta, factory);
LCPrivacyReplace(inputMeta, factory, imp_implementationWithBlock(^AVCaptureDeviceInput *(id self, AVCaptureDevice *device, NSError **error) {
if (LCPrivacyCaptureDeviceBlocked(device, camera, microphone)) {
if (error) *error = LCPrivacyDeniedError();
return nil;
}
return originalFactory(self, factory, device, error);
}));

Class session = AVCaptureSession.class;
SEL canAdd = @selector(canAddInput:);
BOOL (*originalCanAdd)(id, SEL, AVCaptureInput *) =
(void *)class_getMethodImplementation(session, canAdd);
LCPrivacyReplace(session, canAdd, imp_implementationWithBlock(^BOOL(id self, AVCaptureInput *input) {
if ([input isKindOfClass:AVCaptureDeviceInput.class] &&
LCPrivacyCaptureDeviceBlocked(((AVCaptureDeviceInput *)input).device, camera, microphone)) return NO;
return originalCanAdd(self, canAdd, input);
}));
for (NSString *name in @[@"addInput:", @"addInputWithNoConnections:"]) {
SEL selector = NSSelectorFromString(name);
if (!class_getInstanceMethod(session, selector)) continue;
void (*original)(id, SEL, AVCaptureInput *) =
(void *)class_getMethodImplementation(session, selector);
LCPrivacyReplace(session, selector, imp_implementationWithBlock(^(id self, AVCaptureInput *input) {
if ([input isKindOfClass:AVCaptureDeviceInput.class] &&
LCPrivacyCaptureDeviceBlocked(((AVCaptureDeviceInput *)input).device, camera, microphone)) return;
original(self, selector, input);
}));
}

if (camera) {
Class pickerMeta = object_getClass(UIImagePickerController.class);
SEL selector = @selector(isSourceTypeAvailable:);
BOOL (*original)(id, SEL, UIImagePickerControllerSourceType) =
(void *)class_getMethodImplementation(pickerMeta, selector);
LCPrivacyReplace(pickerMeta, selector, imp_implementationWithBlock(^BOOL(id self, UIImagePickerControllerSourceType type) {
return type == UIImagePickerControllerSourceTypeCamera ? NO : original(self, selector, type);
}));
}

if (microphone) {
// Standard permission APIs and AVAudioRecorder recording methods.
// Do not disable playback or pretend to control arbitrary audio units.
Class audioSession = AVAudioSession.class;
LCPrivacyReplace(audioSession, @selector(recordPermission),
imp_implementationWithBlock(^NSUInteger(id self) { return AVAudioSessionRecordPermissionDenied; }));
LCPrivacyReplace(audioSession, @selector(requestRecordPermission:),
imp_implementationWithBlock(^(id self, void (^completion)(BOOL)) {
if (completion) dispatch_async(dispatch_get_main_queue(), ^{ completion(NO); });
}));
Class audioApp = NSClassFromString(@"AVAudioApplication");
if (audioApp) {
LCPrivacyReplace(audioApp, NSSelectorFromString(@"recordPermission"),
imp_implementationWithBlock(^NSUInteger(id self) { return AVAudioSessionRecordPermissionDenied; }));
LCPrivacyReplace(object_getClass(audioApp), NSSelectorFromString(@"requestRecordPermissionWithCompletionHandler:"),
imp_implementationWithBlock(^(id self, void (^completion)(BOOL)) {
if (completion) dispatch_async(dispatch_get_main_queue(), ^{ completion(NO); });
}));
}
Class recorder = AVAudioRecorder.class;
for (NSString *name in @[@"prepareToRecord", @"record"]) {
LCPrivacyReplace(recorder, NSSelectorFromString(name), imp_implementationWithBlock(^BOOL(id self) { return NO; }));
}
for (NSString *name in @[@"recordAtTime:", @"recordForDuration:"]) {
LCPrivacyReplace(recorder, NSSelectorFromString(name), imp_implementationWithBlock(^BOOL(id self, NSTimeInterval value) { return NO; }));
}
LCPrivacyReplace(recorder, @selector(recordAtTime:forDuration:),
imp_implementationWithBlock(^BOOL(id self, NSTimeInterval time, NSTimeInterval duration) { return NO; }));
}
}

static inline void LCPrivacyInstallDevice(BOOL battery, BOOL proximity) {
UIDevice *device = UIDevice.currentDevice;
Class cls = device.class;
if (battery) {
device.batteryMonitoringEnabled = NO;
LCPrivacyReplace(cls, @selector(setBatteryMonitoringEnabled:),
imp_implementationWithBlock(^(id self, BOOL value) {}));
LCPrivacyReplace(cls, @selector(isBatteryMonitoringEnabled),
imp_implementationWithBlock(^BOOL(id self) { return NO; }));
LCPrivacyReplace(cls, @selector(batteryLevel),
imp_implementationWithBlock(^float(id self) { return -1.0f; }));
LCPrivacyReplace(cls, @selector(batteryState),
imp_implementationWithBlock(^UIDeviceBatteryState(id self) { return UIDeviceBatteryStateUnknown; }));
}
if (proximity) {
device.proximityMonitoringEnabled = NO;
LCPrivacyReplace(cls, @selector(setProximityMonitoringEnabled:),
imp_implementationWithBlock(^(id self, BOOL value) {}));
LCPrivacyReplace(cls, @selector(isProximityMonitoringEnabled),
imp_implementationWithBlock(^BOOL(id self) { return NO; }));
LCPrivacyReplace(cls, @selector(proximityState),
imp_implementationWithBlock(^BOOL(id self) { return NO; }));
}
}

static inline BOOL LCPrivacyEventBlocked(NSString *name, BOOL screenshots, BOOL battery, BOOL proximity) {
// Explicitly named UIKit subscriptions only. Do not change screen-capture
// state, secure content, capture indicators, or OS screenshot behavior.
return (screenshots && [name isEqualToString:UIApplicationUserDidTakeScreenshotNotification]) ||
(battery && ([name isEqualToString:UIDeviceBatteryLevelDidChangeNotification] ||
[name isEqualToString:UIDeviceBatteryStateDidChangeNotification])) ||
(proximity && [name isEqualToString:UIDeviceProximityStateDidChangeNotification]);
}

static inline void LCPrivacyInstallEvents(BOOL screenshots, BOOL battery, BOOL proximity) {
if (!screenshots && !battery && !proximity) return;
Class cls = NSNotificationCenter.defaultCenter.class;
SEL add = @selector(addObserver:selector:name:object:);
void (*originalAdd)(id, SEL, id, SEL, NSString *, id) =
(void *)class_getMethodImplementation(cls, add);
LCPrivacyReplace(cls, add, imp_implementationWithBlock(^(id self, id observer, SEL selector, NSString *name, id object) {
if (LCPrivacyEventBlocked(name, screenshots, battery, proximity)) return;
originalAdd(self, add, observer, selector, name, object);
}));
SEL addBlock = @selector(addObserverForName:object:queue:usingBlock:);
id (*originalBlock)(id, SEL, NSString *, id, NSOperationQueue *, void (^)(NSNotification *)) =
(void *)class_getMethodImplementation(cls, addBlock);
LCPrivacyReplace(cls, addBlock, imp_implementationWithBlock(^id(id self, NSString *name, id object, NSOperationQueue *queue, void (^handler)(NSNotification *)) {
if (LCPrivacyEventBlocked(name, screenshots, battery, proximity)) {
// Keep a valid, removable observer token; do not deliver the event.
return originalBlock(self, addBlock, name, object, queue, ^(NSNotification *note) {});
}
return originalBlock(self, addBlock, name, object, queue, handler);
}));
}

static inline void LCGuestPrivacyHooksInit(NSDictionary *info) {
BOOL camera = LCGuestPrivacyEnabled(info, @"camera");
BOOL microphone = LCGuestPrivacyEnabled(info, @"microphone");
BOOL battery = LCGuestPrivacyEnabled(info, @"battery");
BOOL proximity = LCGuestPrivacyEnabled(info, @"proximity");
BOOL screenshots = LCGuestPrivacyEnabled(info, @"screenshotEvents");
LCPrivacyInstallCapture(camera, microphone);
if (battery || proximity) LCPrivacyInstallDevice(battery, proximity);
LCPrivacyInstallEvents(screenshots, battery, proximity);
}
15 changes: 15 additions & 0 deletions LiveContainer/Tweaks/LCGuestPrivacyPolicy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#import <Foundation/Foundation.h>

/// Per-guest preferences stored in LCAppInfo.plist. Missing or unknown
/// keys never change the behavior of existing apps.
static inline NSArray<NSString *> *LCGuestPrivacyKeys(void) {
return @[@"camera", @"microphone", @"battery", @"proximity", @"screenshotEvents"];
}

static inline BOOL LCGuestPrivacyEnabled(NSDictionary *appInfo, NSString *key) {
if (![LCGuestPrivacyKeys() containsObject:key]) return NO;
id policy = appInfo[@"LCGuestPrivacy"];
if (![policy isKindOfClass:NSDictionary.class]) return NO;
id value = policy[key];
return [value isKindOfClass:NSNumber.class] && [value boolValue];
}
22 changes: 12 additions & 10 deletions LiveContainerSwiftUI/HomeScreen/Core/LCHomeMetrics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ struct LCHomeMetrics: Equatable {

init(width: Double, height: Double, tablet: Bool, mini: Bool, accessibility: Bool = false, isLandscape: Bool? = nil) {
let landscape = isLandscape ?? (width > height)
if tablet {
columns = width < 600 ? 4 : (landscape ? 6 : 5)
rows = mini && !landscape ? 6 : 5
} else {
columns = landscape ? 6 : 4
rows = landscape ? 3 : 6
}
horizontalInset = tablet ? max(20, min(64, width * 0.055)) : 20
let cellWidth = max(1, (width - 2 * horizontalInset) / Double(columns))
iconSide = max(42, min(accessibility ? 72 : (tablet ? 68 : 62), cellWidth - 18))
let preferredColumns = tablet ? (width < 600 ? 4 : (landscape ? 6 : 5)) : (landscape ? 6 : 4)
horizontalInset = min(max(0, width * 0.08),
tablet ? max(12, min(64, width * 0.055)) : 20)
let available = max(1, width - 2 * horizontalInset)
// Preserve familiar 4/5/6-column layouts at normal widths, but
// prioritize room for labels at Accessibility Dynamic Type or in
// narrow Stage Manager/Split View windows.
let minimumCell = accessibility ? 105.0 : 60.0
columns = max(1, min(preferredColumns, Int(available / minimumCell)))
rows = tablet ? (mini && !landscape ? 6 : 5) : (landscape ? 3 : 6)
let cellWidth = max(1, available / Double(columns))
iconSide = max(1, min(accessibility ? 72 : (tablet ? 68 : 62), cellWidth - 18))
// The root home screen is one continuous vertical grid, not a page
// of rows that must fill the viewport. Keep spacing stable when window
// height changes (rotation, keyboard and Stage Manager resizing).
Expand Down
Loading