Skip to content

Commit 1bf432b

Browse files
authored
feat: Replace user.ipAddress = {{auto}} with a new settings.infer_ip property in the sdk metadata (#5877)
* feat: Replace `user.ipAddress = {{auto}}` with a new settings.infer_ip property in the sdk metadata * Use `SENTRY_UNWRAP_NULLABLE` to cast var
1 parent 802deb6 commit 1bf432b

19 files changed

+569
-60
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,8 @@
10321032
F41362112E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362102E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift */; };
10331033
F41362132E1C566100B84443 /* SentryScopePersistentStore+User.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362122E1C566100B84443 /* SentryScopePersistentStore+User.swift */; };
10341034
F41362152E1C568400B84443 /* SentryScopePersistentStore+Context.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362142E1C568400B84443 /* SentryScopePersistentStore+Context.swift */; };
1035+
F429DCBB2E4A59370054383F /* SentrySDKSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = F429DCBA2E4A59370054383F /* SentrySDKSettings.m */; };
1036+
F429DCBC2E4A59370054383F /* SentrySDKSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = F429DCB92E4A59370054383F /* SentrySDKSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
10351037
F443DB272E09BE8C009A9045 /* LoadValidatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F443DB262E09BE8C009A9045 /* LoadValidatorTests.swift */; };
10361038
F44858132E03579D0013E63B /* SentryCrashDynamicLinker+Test.h in Headers */ = {isa = PBXBuildFile; fileRef = F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */; };
10371039
F451FAA62E0B304E0050ACF2 /* LoadValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F451FAA52E0B304E0050ACF2 /* LoadValidator.swift */; };
@@ -1051,6 +1053,8 @@
10511053
F4AACD612E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4AACD602E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m */; };
10521054
F4DC35562E1FFD620077CE89 /* SentryVideoFrameProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DC35552E1FFD610077CE89 /* SentryVideoFrameProcessor.swift */; };
10531055
F4DC35582E1FFE1F0077CE89 /* SentryVideoFrameProcessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DC35572E1FFE1B0077CE89 /* SentryVideoFrameProcessorTests.swift */; };
1056+
F4DCC9DD2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DCC9DC2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift */; };
1057+
F4DCC9E52E4AACE0008ECE45 /* SentrySDKSettings+Equality.m in Sources */ = {isa = PBXBuildFile; fileRef = F4DCC9E42E4AACE0008ECE45 /* SentrySDKSettings+Equality.m */; };
10541058
F4E3DCCB2E1579240093CB80 /* SentryScopePersistentStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E3DCCA2E1579240093CB80 /* SentryScopePersistentStore.swift */; };
10551059
FA034AC82DD3DB4900FE3107 /* SentryIntegrationProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = FA034AC72DD3DB4900FE3107 /* SentryIntegrationProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
10561060
FA21F0B42E4A2A80008B4E5A /* SentryAppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA4C32972DF7513F001D7B01 /* SentryAppState.swift */; };
@@ -2376,6 +2380,8 @@
23762380
F41362102E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+Tags.swift"; sourceTree = "<group>"; };
23772381
F41362122E1C566100B84443 /* SentryScopePersistentStore+User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+User.swift"; sourceTree = "<group>"; };
23782382
F41362142E1C568400B84443 /* SentryScopePersistentStore+Context.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+Context.swift"; sourceTree = "<group>"; };
2383+
F429DCB92E4A59370054383F /* SentrySDKSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySDKSettings.h; path = include/SentrySDKSettings.h; sourceTree = "<group>"; };
2384+
F429DCBA2E4A59370054383F /* SentrySDKSettings.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySDKSettings.m; sourceTree = "<group>"; };
23792385
F443DB262E09BE8C009A9045 /* LoadValidatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadValidatorTests.swift; sourceTree = "<group>"; };
23802386
F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryCrashDynamicLinker+Test.h"; sourceTree = "<group>"; };
23812387
F451FAA52E0B304E0050ACF2 /* LoadValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadValidator.swift; sourceTree = "<group>"; };
@@ -2395,6 +2401,9 @@
23952401
F4AACD602E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashDynamicLinkerTests.m; sourceTree = "<group>"; };
23962402
F4DC35552E1FFD610077CE89 /* SentryVideoFrameProcessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryVideoFrameProcessor.swift; sourceTree = "<group>"; };
23972403
F4DC35572E1FFE1B0077CE89 /* SentryVideoFrameProcessorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryVideoFrameProcessorTests.swift; sourceTree = "<group>"; };
2404+
F4DCC9DC2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKSettingsTests.swift; sourceTree = "<group>"; };
2405+
F4DCC9E32E4AACE0008ECE45 /* SentrySDKSettings+Equality.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentrySDKSettings+Equality.h"; sourceTree = "<group>"; };
2406+
F4DCC9E42E4AACE0008ECE45 /* SentrySDKSettings+Equality.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SentrySDKSettings+Equality.m"; sourceTree = "<group>"; };
23982407
F4E3DCCA2E1579240093CB80 /* SentryScopePersistentStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryScopePersistentStore.swift; sourceTree = "<group>"; };
23992408
FA034AC72DD3DB4900FE3107 /* SentryIntegrationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryIntegrationProtocol.h; path = Public/SentryIntegrationProtocol.h; sourceTree = "<group>"; };
24002409
FA3734812E0EEA670091EF24 /* SentryScreenshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryScreenshot.swift; sourceTree = "<group>"; };
@@ -2733,6 +2742,8 @@
27332742
7BC9A20528F41781001E7C4C /* SentryMeasurementUnit.m */,
27342743
A8F17B2D2901765900990B25 /* SentryRequest.m */,
27352744
A8AFFCCE2906C03700967CD7 /* SentryRequest.h */,
2745+
F429DCB92E4A59370054383F /* SentrySDKSettings.h */,
2746+
F429DCBA2E4A59370054383F /* SentrySDKSettings.m */,
27362747
);
27372748
name = Protocol;
27382749
sourceTree = "<group>";
@@ -3380,6 +3391,7 @@
33803391
7B3D0474249A3D5800E106B6 /* Protocol */ = {
33813392
isa = PBXGroup;
33823393
children = (
3394+
F4DCC9DC2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift */,
33833395
9264E1EC2E2E397400B077CF /* SentryLogMessageTests.swift */,
33843396
92B6BDAC2E05B9F700D538B3 /* SentryLogTests.swift */,
33853397
92ECD7472E05B5760063EC10 /* SentryLogAttributeTests.swift */,
@@ -3396,6 +3408,8 @@
33963408
7B26BBFA24C0A66D00A79CCC /* SentrySdkInfoNilTests.m */,
33973409
7B6D98E724C6D336005502FA /* SentrySdkInfo+Equality.h */,
33983410
7B6D98E824C6D336005502FA /* SentrySdkInfo+Equality.m */,
3411+
F4DCC9E32E4AACE0008ECE45 /* SentrySDKSettings+Equality.h */,
3412+
F4DCC9E42E4AACE0008ECE45 /* SentrySDKSettings+Equality.m */,
33993413
7B82D54824E2A2D400EE670F /* SentryIdTests.swift */,
34003414
7B04A9AA24EA5F8D00E710B1 /* SentryUserTests.swift */,
34013415
9286059829A50BAA00F96038 /* SentryGeoTests.swift */,
@@ -5111,6 +5125,7 @@
51115125
63BE85701ECEC6DE00DC44F5 /* SentryDateUtils.h in Headers */,
51125126
63FE709520DA4C1000CDBAE8 /* SentryCrashReportFilterBasic.h in Headers */,
51135127
844EDCE52947DC3100C86F34 /* SentryNSTimerFactory.h in Headers */,
5128+
F429DCBC2E4A59370054383F /* SentrySDKSettings.h in Headers */,
51145129
D8B088B629C9E3FF00213258 /* SentryTracerConfiguration.h in Headers */,
51155130
7B63459D280EBA6300CFA05A /* SentryUIEventTracker.h in Headers */,
51165131
7B7D873424864C6600D2ECFF /* SentryCrashDefaultMachineContextWrapper.h in Headers */,
@@ -5870,6 +5885,7 @@
58705885
8E25C95325F836D000DC215B /* SentryRandom.m in Sources */,
58715886
03F84D3527DD4191008FE43F /* SentryThreadHandle.cpp in Sources */,
58725887
0A2D8DA9289BC905008720F6 /* SentryViewHierarchyProvider.m in Sources */,
5888+
F429DCBB2E4A59370054383F /* SentrySDKSettings.m in Sources */,
58735889
D84D2CDD2C2BF7370011AF8A /* SentryReplayEvent.swift in Sources */,
58745890
D8BC28CC2BFF78220054DA4D /* SentryRRWebTouchEvent.swift in Sources */,
58755891
D452FC592DDB4B1700AFF56F /* SentryWatchdogTerminationBreadcrumbProcessor.m in Sources */,
@@ -6061,6 +6077,7 @@
60616077
62E081AB29ED4322000F69FC /* SentryBreadcrumbTestDelegate.swift in Sources */,
60626078
D8751FA5274743710032F4DE /* SentryNSURLSessionTaskSearchTests.swift in Sources */,
60636079
D86F419827C8FEFA00490520 /* SentryCoreDataTrackerExtension.swift in Sources */,
6080+
F4DCC9E52E4AACE0008ECE45 /* SentrySDKSettings+Equality.m in Sources */,
60646081
7BF536D124BDF3E7004FA6A2 /* SentryEnvelopeTests.swift in Sources */,
60656082
7B98D7E025FB73B900C5A389 /* SentryWatchdogTerminationTrackerTests.swift in Sources */,
60666083
63FE721620DA66EC00CDBAE8 /* SentryCrashReportFixer_Tests.m in Sources */,
@@ -6247,6 +6264,7 @@
62476264
7BFA69F627E0840400233199 /* SentryANRTrackingIntegrationTests.swift in Sources */,
62486265
7BBD18B62451807600427C76 /* SentryDefaultRateLimitsTests.swift in Sources */,
62496266
63FE720620DA66EC00CDBAE8 /* SentryCrashMonitor_AppState_Tests.m in Sources */,
6267+
F4DCC9DD2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift in Sources */,
62506268
7B4E375B2582313100059C93 /* SentryAttachmentTests.swift in Sources */,
62516269
63FE721320DA66EC00CDBAE8 /* SentryCrashMonitor_Signal_Tests.m in Sources */,
62526270
7BBD18B32451805500427C76 /* SentryRateLimitsParserTests.swift in Sources */,

Sources/Resources/Sentry.modulemap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ framework module Sentry {
2727
header "SentrySessionReplayIntegration-Hybrid.h"
2828

2929
header "SentrySdkInfo.h"
30+
header "SentrySDKSettings.h"
3031
header "SentryInternalSerializable.h"
3132

3233
export *

Sources/Sentry/Public/SentryOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ NS_SWIFT_NAME(Options)
270270
* When enabled, the SDK sends personal identifiable along with events.
271271
* @note The default is @c NO .
272272
* @discussion When the user of an event doesn't contain an IP address, and this flag is
273-
* @c YES, the SDK sets it to @c {{auto}} to instruct the server to use the
274-
* connection IP address as the user address. Due to backward compatibility concerns, Sentry set the
275-
* IP address to @c {{auto}} out of the box for Cocoa. If you want to stop Sentry from
273+
* @c YES, the SDK sets sdk.settings.infer_ip to @c auto to instruct the server to use the
274+
* connection IP address as the user address. Due to backward compatibility concerns, Sentry sets
275+
* sdk.settings.infer_ip to @c auto out of the box for Cocoa. If you want to stop Sentry from
276276
* using the connections IP address, you have to enable Prevent Storing of IP Addresses in your
277277
* project settings in Sentry.
278278
*/

Sources/Sentry/SentryClient.m

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -811,15 +811,6 @@ - (SentryEvent *_Nullable)prepareEvent:(SentryEvent *)event
811811
// Need to do this after the scope is applied cause this sets the user if there is any
812812
[self setUserIdIfNoUserSet:event];
813813

814-
// User can't be nil as setUserIdIfNoUserSet sets it.
815-
if (self.options.sendDefaultPii && nil == event.user.ipAddress) {
816-
// Let Sentry infer the IP address from the connection.
817-
// Due to backward compatibility concerns, Sentry servers set the IP address to {{auto}} out
818-
// of the box for only Cocoa and JavaScript, which makes this toggle currently somewhat
819-
// useless. Still, we keep it for future compatibility reasons.
820-
event.user.ipAddress = @"{{auto}}";
821-
}
822-
823814
BOOL eventIsATransaction
824815
= event.type != nil && [event.type isEqualToString:SentryEnvelopeItemTypeTransaction];
825816
BOOL eventIsATransactionClass

Sources/Sentry/SentrySDKSettings.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#import "SentrySDKSettings.h"
2+
#import "SentryOptions.h"
3+
#import "SentrySDKInternal.h"
4+
5+
@implementation SentrySDKSettings
6+
7+
- (instancetype)initWithOptions:(SentryOptions *_Nullable)options
8+
{
9+
if (self = [super init]) {
10+
_autoInferIP = options.sendDefaultPii;
11+
}
12+
13+
return self;
14+
}
15+
16+
- (instancetype)initWithDict:(NSDictionary *)dict
17+
{
18+
if (self = [super init]) {
19+
if ([dict[@"infer_ip"] isKindOfClass:[NSString class]]) {
20+
_autoInferIP = [dict[@"infer_ip"] isEqualToString:@"auto"];
21+
}
22+
}
23+
return self;
24+
}
25+
26+
- (nonnull NSDictionary<NSString *, id> *)serialize
27+
{
28+
return @{ @"infer_ip" : _autoInferIP ? @"auto" : @"never" };
29+
}
30+
31+
@end

Sources/Sentry/SentrySdkInfo.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#import "SentrySdkInfo.h"
22
#import "SentryClient+Private.h"
33
#import "SentryHub+Private.h"
4+
#import "SentryInternalDefines.h"
45
#import "SentryMeta.h"
56
#import "SentryOptions.h"
67
#import "SentrySDK+Private.h"
8+
#import "SentrySDKSettings.h"
79
#import "SentrySwift.h"
810

911
NS_ASSUME_NONNULL_BEGIN
@@ -43,26 +45,30 @@ - (instancetype)initWithOptions:(SentryOptions *_Nullable)options
4345
if (sdkPackage != nil) {
4446
[packages addObject:sdkPackage];
4547
}
48+
SentrySDKSettings *settings = [[SentrySDKSettings alloc] initWithOptions:options];
4649

4750
return [self initWithName:SentryMeta.sdkName
4851
version:SentryMeta.versionString
4952
integrations:integrations
5053
features:features
51-
packages:[packages allObjects]];
54+
packages:[packages allObjects]
55+
settings:settings];
5256
}
5357

5458
- (instancetype)initWithName:(NSString *)name
5559
version:(NSString *)version
5660
integrations:(NSArray<NSString *> *)integrations
5761
features:(NSArray<NSString *> *)features
5862
packages:(NSArray<NSDictionary<NSString *, NSString *> *> *)packages
63+
settings:(SentrySDKSettings *)settings
5964
{
6065
if (self = [super init]) {
6166
_name = name ?: @"";
6267
_version = version ?: @"";
6368
_integrations = integrations ?: @[];
6469
_features = features ?: @[];
6570
_packages = packages ?: @[];
71+
_settings = settings;
6672
}
6773

6874
return self;
@@ -75,6 +81,7 @@ - (instancetype)initWithDict:(NSDictionary *)dict
7581
NSMutableSet<NSString *> *integrations = [[NSMutableSet alloc] init];
7682
NSMutableSet<NSString *> *features = [[NSMutableSet alloc] init];
7783
NSMutableSet<NSDictionary<NSString *, NSString *> *> *packages = [[NSMutableSet alloc] init];
84+
SentrySDKSettings *settings = [[SentrySDKSettings alloc] initWithDict:@{}];
7885

7986
if ([dict[@"name"] isKindOfClass:[NSString class]]) {
8087
name = dict[@"name"];
@@ -110,11 +117,17 @@ - (instancetype)initWithDict:(NSDictionary *)dict
110117
}
111118
}
112119

120+
if (dict[@"settings"] && [dict[@"settings"] isKindOfClass:[NSDictionary class]]) {
121+
settings = [[SentrySDKSettings alloc]
122+
initWithDict:SENTRY_UNWRAP_NULLABLE(NSDictionary, dict[@"settings"])];
123+
}
124+
113125
return [self initWithName:name
114126
version:version
115127
integrations:[integrations allObjects]
116128
features:[features allObjects]
117-
packages:[packages allObjects]];
129+
packages:[packages allObjects]
130+
settings:settings];
118131
}
119132

120133
- (NSDictionary<NSString *, id> *)serialize
@@ -125,6 +138,7 @@ - (instancetype)initWithDict:(NSDictionary *)dict
125138
@"integrations" : self.integrations,
126139
@"features" : self.features,
127140
@"packages" : self.packages,
141+
@"settings" : [self.settings serialize]
128142
};
129143
}
130144

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#if __has_include(<Sentry/SentryInternalSerializable.h>)
2+
# import <Sentry/SentryInternalSerializable.h>
3+
#else
4+
# import "SentryInternalSerializable.h"
5+
#endif
6+
7+
#import <Foundation/Foundation.h>
8+
9+
@class SentryOptions;
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
/**
14+
* Describes the settings for the Sentry SDK
15+
* @see https://develop.sentry.dev/sdk/event-payloads/sdk/
16+
*/
17+
@interface SentrySDKSettings : NSObject <SentryInternalSerializable>
18+
19+
- (instancetype)initWithOptions:(SentryOptions *_Nullable)options;
20+
21+
- (instancetype)initWithDict:(NSDictionary *)dict;
22+
23+
@property (nonatomic, assign) BOOL autoInferIP;
24+
25+
@end
26+
27+
NS_ASSUME_NONNULL_END

Sources/Sentry/include/SentrySdkInfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#import <Foundation/Foundation.h>
1414

1515
@class SentryOptions;
16+
@class SentrySDKSettings;
1617

1718
NS_ASSUME_NONNULL_BEGIN
1819

@@ -61,14 +62,19 @@ SENTRY_NO_INIT
6162
*/
6263
@property (nonatomic, readonly, copy) NSArray<NSDictionary<NSString *, NSString *> *> *packages;
6364

65+
/**
66+
* A set of settings as part of this SDK.
67+
*/
68+
@property (nonatomic, readonly, copy) SentrySDKSettings *settings;
69+
6470
- (instancetype)initWithOptions:(SentryOptions *_Nullable)options;
6571

6672
- (instancetype)initWithName:(NSString *)name
6773
version:(NSString *)version
6874
integrations:(NSArray<NSString *> *)integrations
6975
features:(NSArray<NSString *> *)features
7076
packages:(NSArray<NSDictionary<NSString *, NSString *> *> *)packages
71-
NS_DESIGNATED_INITIALIZER;
77+
settings:(SentrySDKSettings *)settings NS_DESIGNATED_INITIALIZER;
7278

7379
- (instancetype)initWithDict:(NSDictionary *)dict;
7480

Tests/SentryTests/Helper/SentryFileManagerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class SentryFileManagerTests: XCTestCase {
158158
}
159159

160160
func testStoreInvalidEnvelope_ReturnsNil() {
161-
let sdkInfoWithInvalidJSON = SentrySdkInfo(name: SentryInvalidJSONString() as String, version: "8.0.0", integrations: [], features: [], packages: [])
161+
let sdkInfoWithInvalidJSON = SentrySdkInfo(name: SentryInvalidJSONString() as String, version: "8.0.0", integrations: [], features: [], packages: [], settings: SentrySDKSettings(dict: [:]))
162162
let headerWithInvalidJSON = SentryEnvelopeHeader(id: nil, sdkInfo: sdkInfoWithInvalidJSON, traceContext: nil)
163163

164164
let envelope = SentryEnvelope(header: headerWithInvalidJSON, items: [])

Tests/SentryTests/Helper/SentrySerializationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SentrySerializationTests: XCTestCase {
4646
}
4747

4848
func testEnvelopeWithData_InvalidEnvelopeHeaderJSON_ReturnsNil() {
49-
let sdkInfoWithInvalidJSON = SentrySdkInfo(name: SentryInvalidJSONString() as String, version: "8.0.0", integrations: [], features: [], packages: [])
49+
let sdkInfoWithInvalidJSON = SentrySdkInfo(name: SentryInvalidJSONString() as String, version: "8.0.0", integrations: [], features: [], packages: [], settings: SentrySDKSettings(dict: [:]))
5050
let headerWithInvalidJSON = SentryEnvelopeHeader(id: nil, sdkInfo: sdkInfoWithInvalidJSON, traceContext: nil)
5151

5252
let envelope = SentryEnvelope(header: headerWithInvalidJSON, items: [])
@@ -147,7 +147,7 @@ class SentrySerializationTests: XCTestCase {
147147
}
148148

149149
func testEnvelopeWithData_WithSdkInfo_ReturnsSDKInfo() throws {
150-
let sdkInfo = SentrySdkInfo(name: "sentry.cocoa", version: "5.0.1", integrations: [], features: [], packages: [])
150+
let sdkInfo = SentrySdkInfo(name: "sentry.cocoa", version: "5.0.1", integrations: [], features: [], packages: [], settings: SentrySDKSettings(dict: [:]))
151151
let envelopeHeader = SentryEnvelopeHeader(id: nil, sdkInfo: sdkInfo, traceContext: nil)
152152
let envelope = SentryEnvelope(header: envelopeHeader, singleItem: createItemWithEmptyAttachment())
153153

@@ -647,7 +647,7 @@ class SentrySerializationTests: XCTestCase {
647647
}
648648

649649
private func assertDefaultSdkInfoSet(deserializedEnvelope: SentryEnvelope, file: StaticString = #file, line: UInt = #line) {
650-
let sdkInfo = SentrySdkInfo(name: SentryMeta.sdkName, version: SentryMeta.versionString, integrations: [], features: [], packages: [])
650+
let sdkInfo = SentrySdkInfo(name: SentryMeta.sdkName, version: SentryMeta.versionString, integrations: [], features: [], packages: [], settings: SentrySDKSettings(dict: [:]))
651651
XCTAssertEqual(sdkInfo, deserializedEnvelope.header.sdkInfo, file: file, line: line)
652652
}
653653

0 commit comments

Comments
 (0)