Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove all permission checks #2529

Merged
merged 4 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ This version adds a dependency on Swift.
- Bump minimum Xcode version to 13 (#2483)
- Rename `SentryOptions.enableOutOfMemoryTracking` to `SentryOptions.enableWatchdogTerminationTracking` (#2499)
- Remove the automatic `viewAppearing` span for UIViewController APM (#2511)
- Remove the permission context for events (#2529)

## 8.0.0-beta.4

Expand Down
12 changes: 0 additions & 12 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
03F84D3827DD4191008FE43F /* SentryBacktrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F84D3127DD4191008FE43F /* SentryBacktrace.cpp */; };
03F9D37C2819A65C00602916 /* SentryProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03F9D37B2819A65C00602916 /* SentryProfilerTests.mm */; };
0A1B497328E597DD00D7BFA3 /* TestLogOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1B497228E597DD00D7BFA3 /* TestLogOutput.swift */; };
0A2690B72885C2E000E4432D /* TestSentryPermissionsObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AABE2EF2885C2120057ED69 /* TestSentryPermissionsObserver.swift */; };
0A283E79291A67E000EF4126 /* SentryUIDeviceWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A283E78291A67E000EF4126 /* SentryUIDeviceWrapperTests.swift */; };
0A2D7BBA29152CBF008727AF /* SentryWatchdogTerminationsScopeObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2D7BB929152CBF008727AF /* SentryWatchdogTerminationsScopeObserverTests.swift */; };
0A2D8D5B289815C0008720F6 /* SentryBaseIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A2D8D5A289815C0008720F6 /* SentryBaseIntegration.m */; };
Expand All @@ -54,15 +53,13 @@
0A6EEADD28A657970076B469 /* UIViewRecursiveDescriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6EEADC28A657970076B469 /* UIViewRecursiveDescriptionTests.swift */; };
0A80E433291017C300095219 /* SentryWatchdogTerminationScopeObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A80E432291017C300095219 /* SentryWatchdogTerminationScopeObserver.m */; };
0A80E435291017D500095219 /* SentryWatchdogTerminationScopeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A80E434291017D500095219 /* SentryWatchdogTerminationScopeObserver.h */; };
0A8F0A392886CC70000B15F6 /* SentryPermissionsObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AABE2EE288592750057ED69 /* SentryPermissionsObserver.h */; };
0A94158228F6C4C2006A5DD1 /* SentryAppStateManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A94158128F6C4C2006A5DD1 /* SentryAppStateManagerTests.swift */; };
0A9415BA28F96CAC006A5DD1 /* TestSentryReachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9415B928F96CAC006A5DD1 /* TestSentryReachability.swift */; };
0A9BF4E228A114940068D266 /* SentryViewHierarchyIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4E128A114940068D266 /* SentryViewHierarchyIntegration.m */; };
0A9BF4E428A114B50068D266 /* SentryViewHierarchyIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A9BF4E328A114B50068D266 /* SentryViewHierarchyIntegration.h */; };
0A9BF4E928A125390068D266 /* TestSentryViewHierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4E628A123270068D266 /* TestSentryViewHierarchy.swift */; };
0A9BF4EB28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4EA28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift */; };
0A9E917128DC7E7000FB4182 /* SentryInternalDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A9E917028DC7E7000FB4182 /* SentryInternalDefines.h */; };
0AABE2ED2885924A0057ED69 /* SentryPermissionsObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AABE2EC2885924A0057ED69 /* SentryPermissionsObserver.m */; };
0AAE201E28ED9B9400D0CD80 /* SentryReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AAE201D28ED9B9400D0CD80 /* SentryReachability.m */; };
0AAE202128ED9BCC00D0CD80 /* SentryReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AAE202028ED9BCC00D0CD80 /* SentryReachability.h */; };
0ACBA10128A6406400D711F7 /* UIView+Sentry.m in Sources */ = {isa = PBXBuildFile; fileRef = 0ACBA10028A6406400D711F7 /* UIView+Sentry.m */; };
Expand Down Expand Up @@ -816,9 +813,6 @@
0A9BF4E628A123270068D266 /* TestSentryViewHierarchy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryViewHierarchy.swift; sourceTree = "<group>"; };
0A9BF4EA28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryViewHierarchyIntegrationTests.swift; sourceTree = "<group>"; };
0A9E917028DC7E7000FB4182 /* SentryInternalDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryInternalDefines.h; path = include/SentryInternalDefines.h; sourceTree = "<group>"; };
0AABE2EC2885924A0057ED69 /* SentryPermissionsObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryPermissionsObserver.m; sourceTree = "<group>"; };
0AABE2EE288592750057ED69 /* SentryPermissionsObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryPermissionsObserver.h; path = include/SentryPermissionsObserver.h; sourceTree = "<group>"; };
0AABE2EF2885C2120057ED69 /* TestSentryPermissionsObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryPermissionsObserver.swift; sourceTree = "<group>"; };
0AAE201D28ED9B9400D0CD80 /* SentryReachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryReachability.m; sourceTree = "<group>"; };
0AAE202028ED9BCC00D0CD80 /* SentryReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryReachability.h; path = include/SentryReachability.h; sourceTree = "<group>"; };
0ACBA10028A6406400D711F7 /* UIView+Sentry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Sentry.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1830,8 +1824,6 @@
7B7D873524864C9D00D2ECFF /* SentryCrashDefaultMachineContextWrapper.m */,
7B7A30C524B48321005A4C6E /* SentryCrashWrapper.h */,
7B7A30C724B48389005A4C6E /* SentryCrashWrapper.m */,
0AABE2EE288592750057ED69 /* SentryPermissionsObserver.h */,
0AABE2EC2885924A0057ED69 /* SentryPermissionsObserver.m */,
0ADC33ED28D9BB890078D980 /* SentryUIDeviceWrapper.h */,
0ADC33EB28D9BB780078D980 /* SentryUIDeviceWrapper.m */,
);
Expand Down Expand Up @@ -2296,7 +2288,6 @@
0A283E78291A67E000EF4126 /* SentryUIDeviceWrapperTests.swift */,
7BED3574266F7BC600EAA70D /* TestSentryCrashWrapper.h */,
7BED3575266F7BFF00EAA70D /* TestSentryCrashWrapper.m */,
0AABE2EF2885C2120057ED69 /* TestSentryPermissionsObserver.swift */,
0ADC33EF28D9BE690078D980 /* TestSentryUIDeviceWrapper.swift */,
7B984A9E28E572AF001F4BEE /* CrashReportWriter.swift */,
);
Expand Down Expand Up @@ -3117,7 +3108,6 @@
03F84D1E27DD414C008FE43F /* SentryBacktrace.hpp in Headers */,
63AA76991EB9C1C200D153DE /* SentryDefines.h in Headers */,
0A4EDEA928D3461B00FA67CB /* SentryPerformanceTracker+Private.h in Headers */,
0A8F0A392886CC70000B15F6 /* SentryPermissionsObserver.h in Headers */,
7B2A70DB27D607CF008B0D15 /* SentryThreadWrapper.h in Headers */,
8EAE980B261E9F530073B6B3 /* SentryPerformanceTracker.h in Headers */,
63FE718520DA4C1100CDBAE8 /* SentryCrashC.h in Headers */,
Expand Down Expand Up @@ -3663,7 +3653,6 @@
0ACBA10128A6406400D711F7 /* UIView+Sentry.m in Sources */,
639FCF991EBC7B9700778193 /* SentryEvent.m in Sources */,
632F43521F581D5400A18A36 /* SentryCrashExceptionApplication.m in Sources */,
0AABE2ED2885924A0057ED69 /* SentryPermissionsObserver.m in Sources */,
7B77BE3727EC8460003C9020 /* SentryDiscardReasonMapper.m in Sources */,
63FE712520DA4C1000CDBAE8 /* SentryCrashSignalInfo.c in Sources */,
63FE70F320DA4C1000CDBAE8 /* SentryCrashMonitor_Signal.c in Sources */,
Expand Down Expand Up @@ -3807,7 +3796,6 @@
7BA0C04C28056556003E0326 /* SentryTransportAdapterTests.swift in Sources */,
7BE0DC29272A9E1C004FA8B7 /* SentryBreadcrumbTrackerTests.swift in Sources */,
63FE722520DA66EC00CDBAE8 /* SentryCrashFileUtils_Tests.m in Sources */,
0A2690B72885C2E000E4432D /* TestSentryPermissionsObserver.swift in Sources */,
7BFC16BA2524D4AF00FF6266 /* SentryMessage+Equality.m in Sources */,
7B4260342630315C00B36EDD /* SampleError.swift in Sources */,
D855B3E827D652AF00BCED76 /* SentryCoreDataTrackingIntegrationTest.swift in Sources */,
Expand Down
10 changes: 0 additions & 10 deletions Sources/Sentry/Public/SentryDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ typedef NS_ENUM(NSUInteger, SentryLevel) {
kSentryLevelFatal = 5
};

/**
* Permission status
*/
typedef NS_ENUM(NSInteger, SentryPermissionStatus) {
kSentryPermissionStatusUnknown = 0,
kSentryPermissionStatusGranted,
kSentryPermissionStatusPartial,
kSentryPermissionStatusDenied
};

/**
* Static internal helper to convert enum to string
*/
Expand Down
70 changes: 1 addition & 69 deletions Sources/Sentry/SentryClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#import "SentryMeta.h"
#import "SentryNSError.h"
#import "SentryOptions+Private.h"
#import "SentryPermissionsObserver.h"
#import "SentrySDK+Private.h"
#import "SentryScope+Private.h"
#import "SentryStacktraceBuilder.h"
Expand Down Expand Up @@ -59,7 +58,6 @@
@property (nonatomic, strong) SentryDebugImageProvider *debugImageProvider;
@property (nonatomic, strong) id<SentryRandom> random;
@property (nonatomic, strong) SentryCrashWrapper *crashWrapper;
@property (nonatomic, strong) SentryPermissionsObserver *permissionsObserver;
@property (nonatomic, strong) SentryUIDeviceWrapper *deviceWrapper;
@property (nonatomic, strong) NSLocale *locale;
@property (nonatomic, strong) NSTimeZone *timezone;
Expand Down Expand Up @@ -89,33 +87,11 @@ - (nullable instancetype)initWithOptions:(SentryOptions *)options
SENTRY_LOG_ERROR(@"Cannot init filesystem.");
return nil;
}
return [self initWithOptions:options
permissionsObserver:[[SentryPermissionsObserver alloc] init]
fileManager:fileManager];
}

- (nullable instancetype)initWithOptions:(SentryOptions *)options
permissionsObserver:(SentryPermissionsObserver *)permissionsObserver
dispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueue
{
NSError *error;
SentryFileManager *fileManager =
[[SentryFileManager alloc] initWithOptions:options
andCurrentDateProvider:[SentryDefaultCurrentDateProvider sharedInstance]
dispatchQueueWrapper:dispatchQueue
error:&error];
if (error != nil) {
SENTRY_LOG_ERROR(@"Cannot init filesystem.");
return nil;
}
return [self initWithOptions:options
permissionsObserver:permissionsObserver
fileManager:fileManager];
return [self initWithOptions:options fileManager:fileManager];
}

/** Internal constructor for testing purposes. */
- (instancetype)initWithOptions:(SentryOptions *)options
permissionsObserver:(SentryPermissionsObserver *)permissionsObserver
fileManager:(SentryFileManager *)fileManager
{
id<SentryTransport> transport = [SentryTransportFactory initTransport:options
Expand Down Expand Up @@ -144,7 +120,6 @@ - (instancetype)initWithOptions:(SentryOptions *)options
threadInspector:threadInspector
random:[SentryDependencyContainer sharedInstance].random
crashWrapper:[SentryCrashWrapper sharedInstance]
permissionsObserver:permissionsObserver
deviceWrapper:deviceWrapper
locale:[NSLocale autoupdatingCurrentLocale]
timezone:[NSCalendar autoupdatingCurrentCalendar].timeZone];
Expand All @@ -156,7 +131,6 @@ - (instancetype)initWithOptions:(SentryOptions *)options
threadInspector:(SentryThreadInspector *)threadInspector
random:(id<SentryRandom>)random
crashWrapper:(SentryCrashWrapper *)crashWrapper
permissionsObserver:(SentryPermissionsObserver *)permissionsObserver
deviceWrapper:(SentryUIDeviceWrapper *)deviceWrapper
locale:(NSLocale *)locale
timezone:(NSTimeZone *)timezone
Expand All @@ -169,7 +143,6 @@ - (instancetype)initWithOptions:(SentryOptions *)options
self.threadInspector = threadInspector;
self.random = random;
self.crashWrapper = crashWrapper;
self.permissionsObserver = permissionsObserver;
self.debugImageProvider = [SentryDependencyContainer sharedInstance].debugImageProvider;
self.locale = locale;
self.timezone = timezone;
Expand Down Expand Up @@ -583,7 +556,6 @@ - (SentryEvent *_Nullable)prepareEvent:(SentryEvent *)event
// at the time of this event, but not for crashes as the current data isn't guaranteed to be
// the same as when the app crashed.
[self applyExtraDeviceContextToEvent:event];
[self applyPermissionsToEvent:event];
[self applyCultureContextToEvent:event];
}

Expand Down Expand Up @@ -741,46 +713,6 @@ - (BOOL)isWatchdogTermination:(SentryEvent *)event isCrashEvent:(BOOL)isCrashEve
[exception.mechanism.type isEqualToString:SentryWatchdogTerminationMechanismType];
}

- (void)applyPermissionsToEvent:(SentryEvent *)event
{
[self modifyContext:event
key:@"app"
block:^(NSMutableDictionary *app) {
app[@"permissions"] = @ {
@"push_notifications" :
[self stringForPermissionStatus:self.permissionsObserver
.pushPermissionStatus],
@"location_access" :
[self stringForPermissionStatus:self.permissionsObserver
.locationPermissionStatus],
@"photo_library" :
[self stringForPermissionStatus:self.permissionsObserver
.photoLibraryPermissionStatus],
};
}];
}

- (NSString *)stringForPermissionStatus:(SentryPermissionStatus)status
{
switch (status) {
case kSentryPermissionStatusUnknown:
return @"unknown";
break;

case kSentryPermissionStatusGranted:
return @"granted";
break;

case kSentryPermissionStatusPartial:
return @"partial";
break;

case kSentryPermissionStatusDenied:
return @"not_granted";
break;
}
}

- (void)applyCultureContextToEvent:(SentryEvent *)event
{
[self modifyContext:event
Expand Down
153 changes: 0 additions & 153 deletions Sources/Sentry/SentryPermissionsObserver.m

This file was deleted.

Loading