Merge pull request #326 from luken11/details-privacy-info

App Details: Show TCC and MobileGestalt Privacy Info
This commit is contained in:
Lars Fröder 2022-10-30 19:04:49 +01:00 committed by GitHub
commit 6af771a251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 105 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#import "TSAppInfo.h" #import "TSAppInfo.h"
#import "TSCommonTCCServiceNames.h"
#import <TSUtil.h> #import <TSUtil.h>
extern CGImageRef LICreateIconForImage(CGImageRef image, int variant, int precomposed); extern CGImageRef LICreateIconForImage(CGImageRef image, int variant, int precomposed);
@ -858,7 +859,7 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
} }
}]; }];
__block NSMutableArray* accessibleContainers = [NSMutableArray new]; __block NSMutableSet* accessibleContainers = [NSMutableSet new];
if(!unrestrictedContainerAccess) if(!unrestrictedContainerAccess)
{ {
[self enumerateAllInfoDictionaries:^(NSString *key, NSObject *value, BOOL *stop) { [self enumerateAllInfoDictionaries:^(NSString *key, NSObject *value, BOOL *stop) {
@ -898,7 +899,7 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
// keychain-access-groups // keychain-access-groups
// Unrestricted if single * (maybe?) // Unrestricted if single * (maybe?)
__block BOOL unrestrictedKeychainAccess = NO; __block BOOL unrestrictedKeychainAccess = NO;
__block NSMutableArray* accessibleKeychainGroups = [NSMutableArray new]; __block NSMutableSet* accessibleKeychainGroups = [NSMutableSet new];
[self enumerateAllEntitlements:^(NSString *key, NSObject *value, BOOL *stop) { [self enumerateAllEntitlements:^(NSString *key, NSObject *value, BOOL *stop) {
if([key isEqualToString:@"keychain-access-groups"]) if([key isEqualToString:@"keychain-access-groups"])
{ {
@ -923,7 +924,7 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
} }
}]; }];
__block NSMutableArray* URLSchemes = [NSMutableArray new]; __block NSMutableSet* URLSchemes = [NSMutableSet new];
[self enumerateAllInfoDictionaries:^(NSString *key, NSObject *value, BOOL *stop) { [self enumerateAllInfoDictionaries:^(NSString *key, NSObject *value, BOOL *stop) {
if([key isEqualToString:@"CFBundleURLTypes"]) if([key isEqualToString:@"CFBundleURLTypes"])
{ {
@ -951,6 +952,61 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
} }
}]; }];
__block NSMutableSet* allowedTccServices = [NSMutableSet new];
[self enumerateAllEntitlements:^(NSString *key, NSObject *value, BOOL *stop) {
if([key isEqualToString:@"com.apple.private.tcc.allow"])
{
NSArray* valueArr = (NSArray*)value;
if([valueArr isKindOfClass:NSArray.class])
{
for(NSString* serviceID in valueArr)
{
if([serviceID isKindOfClass:NSString.class])
{
NSString* displayName = commonTCCServices[serviceID];
if(displayName == nil)
{
[allowedTccServices addObject:[serviceID stringByReplacingOccurrencesOfString:@"kTCCService" withString:@""]];
}
else
{
[allowedTccServices addObject:displayName];
}
}
}
}
}
else if ([key isEqualToString:@"com.apple.locationd.preauthorized"])
{
NSNumber* valueNum = (NSNumber*)value;
if([valueNum isKindOfClass:NSNumber.class])
{
if([valueNum boolValue])
{
[allowedTccServices addObject:@"Location"];
}
}
}
}];
__block NSMutableSet* allowedMGKeys = [NSMutableSet new];
[self enumerateAllEntitlements:^(NSString *key, NSObject *value, BOOL *stop) {
if([key isEqualToString:@"com.apple.private.MobileGestalt.AllowedProtectedKeys"])
{
NSArray* valueArr = (NSArray*)value;
if([valueArr isKindOfClass:NSArray.class])
{
for(NSString* protectedKey in valueArr)
{
if([protectedKey isKindOfClass:NSString.class])
{
[allowedMGKeys addObject:protectedKey];
}
}
}
}
}];
NSMutableParagraphStyle* leftAlignment = [[NSMutableParagraphStyle alloc] init]; NSMutableParagraphStyle* leftAlignment = [[NSMutableParagraphStyle alloc] init];
leftAlignment.alignment = NSTextAlignmentLeft; leftAlignment.alignment = NSTextAlignmentLeft;
@ -1036,6 +1092,20 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\nThe app can not spawn other binaries." attributes:bodyAttributes]]; [description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\nThe app can not spawn other binaries." attributes:bodyAttributes]];
} }
if(allowedTccServices.count)
{
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n\nPrivacy" attributes:headerAttributes]];
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\nThe app can access the following services without asking for permission.\n" attributes:bodyDangerAttributes]];
[description appendAttributedString:[[NSAttributedString alloc] initWithString:[NSListFormatter localizedStringByJoiningStrings:[allowedTccServices allObjects]] attributes:bodyAttributes]];
}
if (allowedMGKeys.count)
{
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n\nDevice Info" attributes:headerAttributes]];
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\nThe app can access protected information about this device.\n" attributes:bodyWarningAttributes]];
[description appendAttributedString:[[NSAttributedString alloc] initWithString:[NSListFormatter localizedStringByJoiningStrings:[allowedMGKeys allObjects]] attributes:bodyAttributes]];
}
if(unrestrictedContainerAccess || accessibleContainers.count) if(unrestrictedContainerAccess || accessibleContainers.count)
{ {
[description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n\nAccessible Containers" attributes:headerAttributes]]; [description appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n\nAccessible Containers" attributes:headerAttributes]];

View File

@ -102,6 +102,7 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
[super viewDidLoad]; [super viewDidLoad];
self.tableView.allowsMultipleSelectionDuringEditing = NO; self.tableView.allowsMultipleSelectionDuringEditing = NO;
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
[self _setUpNavigationBar]; [self _setUpNavigationBar];
[self _setUpSearchBar]; [self _setUpSearchBar];

View File

@ -0,0 +1,31 @@
//
// TSCommonTCCServiceNames.h
// IPAInfo
//
// Created by Luke Noble on 30.10.22.
//
#import <Foundation/Foundation.h>
static NSDictionary* const commonTCCServices = @{
@"kTCCServicePhotos": @"Photo Library",
@"kTCCServicePhotosAdd": @"Photo Library (Add)",
@"kTCCServiceCamera": @"Camera",
@"kTCCServiceMicrophone": @"Microphone",
@"kTCCServiceAddressBook": @"Contacts",
@"kTCCServiceCalendar": @"Calendars",
@"kTCCServiceReminders": @"Reminders",
@"kTCCServiceWillow": @"HomeKit",
@"kTCCServiceGameCenterFriends": @"Game Center Friends",
@"kTCCServiceExposureNotification": @"Exposure Notifications",
@"kTCCServiceFocusStatus": @"Focus Status",
@"kTCCServiceUserTracking": @"User Tracking",
@"kTCCServiceFaceID": @"Face ID",
@"kTCCServiceMediaLibrary": @"Apple Media Library",
@"kTCCServiceMotion": @"Motion Sensors",
@"kTCCServiceNearbyInteraction": @"Nearby Device Interaction",
@"kTCCServiceBluetoothAlways": @"Bluetooth (Always)",
@"kTCCServiceBluetoothWhileInUse": @"Bluetooth (While In Use)",
@"kTCCServiceBluetoothPeripheral": @"Bluetooth (Peripherals)",
@"kTCCServiceLocation": @"Location"
};