Skip to content

Commit

Permalink
Merge pull request #253 from newrelic/prod7412
Browse files Browse the repository at this point in the history
Production New Relic iOS agent 7.4.12
  • Loading branch information
cdillard-NewRelic authored May 29, 2024
2 parents b5ea84f + d6d88da commit 9bfce72
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 85 deletions.
48 changes: 24 additions & 24 deletions Agent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4970,9 +4970,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = RQZ9D969HD;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
Expand Down Expand Up @@ -5023,9 +5023,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
Expand Down Expand Up @@ -5217,12 +5217,12 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
"DEVELOPMENT_TEAM[sdk=macosx*]" = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5246,7 +5246,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.11;
MARKETING_VERSION = 7.4.12;
MODULEMAP_FILE = agent.modulemap;
OTHER_CFLAGS = "$(inherited";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5277,11 +5277,11 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Distribution: New Relic Inc (SU7SUNGZJP)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -5303,7 +5303,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.11;
MARKETING_VERSION = 7.4.12;
MODULEMAP_FILE = agent.modulemap;
OTHER_CFLAGS = "$(inherited";
OTHER_LDFLAGS = "";
Expand All @@ -5328,9 +5328,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = RQZ9D969HD;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
Expand Down Expand Up @@ -5385,9 +5385,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
Expand Down Expand Up @@ -5434,9 +5434,9 @@
CLANG_ENABLE_CODE_COVERAGE = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/UnitTests/",
"${SRCROOT}/**",
Expand Down Expand Up @@ -5473,9 +5473,9 @@
CLANG_ENABLE_CODE_COVERAGE = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/UnitTests/",
"${SRCROOT}/**",
Expand Down Expand Up @@ -5513,12 +5513,12 @@
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
"DEVELOPMENT_TEAM[sdk=appletvos*]" = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5540,7 +5540,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.11;
MARKETING_VERSION = 7.4.12;
MODULEMAP_FILE = agent.modulemap;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.newrelic.Agent;
Expand All @@ -5566,11 +5566,11 @@
CODE_SIGN_IDENTITY = "Apple Distribution: New Relic Inc (SU7SUNGZJP)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.11;
CURRENT_PROJECT_VERSION = 7.4.12;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.11;
DYLIB_CURRENT_VERSION = 7.4.12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5591,7 +5591,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.11;
MARKETING_VERSION = 7.4.12;
MODULEMAP_FILE = agent.modulemap;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.newrelic.Agent;
Expand Down
2 changes: 1 addition & 1 deletion Agent/Analytics/Events/NRMAMobileEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

NS_ASSUME_NONNULL_BEGIN

@interface NRMAMobileEvent : NSObject <NRMAAnalyticEventProtocol, NSCoding>
@interface NRMAMobileEvent : NSObject <NRMAAnalyticEventProtocol, NSSecureCoding>

@property NSTimeInterval timestamp;
@property NSTimeInterval sessionElapsedTimeSeconds;
Expand Down
2 changes: 1 addition & 1 deletion Agent/Analytics/NRMAAnalyticEventProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#import "NRMAJSON.h"

@protocol NRMAAnalyticEventProtocol <NSObject, NRMAJSONABLE, NSCoding>
@protocol NRMAAnalyticEventProtocol <NSObject, NRMAJSONABLE, NSSecureCoding>

@property (readonly) NSTimeInterval timestamp;
@property (readonly) NSTimeInterval sessionElapsedTimeSeconds;
Expand Down
2 changes: 1 addition & 1 deletion Agent/Analytics/NRMAPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

NS_ASSUME_NONNULL_BEGIN

@interface NRMAPayload : NSObject <NRMAJSONABLE, NSCoding>
@interface NRMAPayload : NSObject <NRMAJSONABLE, NSSecureCoding>
@property NSTimeInterval timestamp;
@property (nonatomic, strong) NSString *payloadType;
@property (nonatomic, strong) NSString *accountId;
Expand Down
2 changes: 1 addition & 1 deletion Agent/DistributedTracing/W3CTraceState.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@property (strong) NSString* appId;
@property (strong) NSString* spanId;
@property (strong) NSString* transactionId;
@property int sampled;
//@property int sampled;
@property (strong) NSString* priority;
@property long long timestamp;

Expand Down
32 changes: 17 additions & 15 deletions Agent/DistributedTracing/W3CTraceState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,30 @@ + (NSString *) getVersion {
+ (NSString *) getParentType {
return @"2";
}
+ (NSString *) getSampled {
return @"0";
}
//+ (NSString *) getSampled {
// return @"0";
//}
+ (NSString *) getPriority {
return @"";
}
+ (NSString *) headerFromContext:(NRMATraceContext*) traceContext {
NSString *formatStr = @"%@=%@-%@-%@-%@-%@-%@-%@-%@-%lld";
//1 2 3 4 5 6 7 9 10
NSString *formatStr = @"%@=%@-%@-%@-%@-%@-%@-%@-%lld";

// Do not base64 encode. traceContext.spanId should equal traceparent->parentId.
NSString *headerString = [NSString stringWithFormat:formatStr,
[W3CTraceState trustedAccountKeyFor: traceContext],
[W3CTraceState getVersion],
[W3CTraceState getParentType],
traceContext.accountId,
traceContext.appId,
traceContext.spanId,
traceContext.TRACE_FIELD_UNUSED,
[W3CTraceState getSampled],
[W3CTraceState getPriority],
traceContext.timestamp];

[W3CTraceState trustedAccountKeyFor: traceContext], // 1
[W3CTraceState getVersion], // 2
[W3CTraceState getParentType], // 3
traceContext.accountId, // 4
traceContext.appId, // 5
traceContext.spanId, // 6
traceContext.TRACE_FIELD_UNUSED, // 7
// Note: We used to pass 0 as the sampled flag but the Language agent teams requested this change.
// [W3CTraceState getSampled], // 8
[W3CTraceState getPriority], // 9
traceContext.timestamp]; // 10

return headerString;
}

Expand Down
19 changes: 12 additions & 7 deletions Agent/Utilities/NRMAUDIDManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,24 @@ + (NSString*) getSystemIdentifier {
if ([NRMAFlags shouldSaltDeviceUUID]) {
// We use app ID as salt. This will prevent apps across bundle Ids sharing device Ids.
NSString* clearStr = [[NRMAUDIDManager saltValue] stringByAppendingString:[NRMAUDIDManager deviceIdentifier]];
NSData* clearData = [clearStr dataUsingEncoding:NSUTF8StringEncoding];
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1([clearData bytes],(CC_LONG)clearData.length,digest);
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) {
[output appendFormat:@"%02x",digest[i]];
}
NSString *output = [NRMAUDIDManager sha256Hash:clearStr];
return output;
} else {
return [NRMAUDIDManager deviceIdentifier];
}
}

+ (NSString*)sha256Hash:(NSString*)text {
const char* chars = [text UTF8String];
unsigned char result[CC_SHA256_DIGEST_LENGTH];
CC_SHA256(chars, (CC_LONG)strlen(chars), result);
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH*2];
for(int i = 0; i<CC_SHA256_DIGEST_LENGTH; i++) {
[ret appendFormat:@"%02x",result[i]];
}
return ret;
}

+ (NSString*) saltValue {
return [[NSBundle mainBundle] infoDictionary][@"CFBundleExecutable"];
}
Expand Down
38 changes: 20 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.920.0)
aws-sdk-core (3.193.0)
aws-partitions (1.935.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.80.0)
aws-sdk-kms (1.82.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.148.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-s3 (1.151.0)
aws-sdk-core (~> 3, >= 3.194.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -109,29 +109,29 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.62.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-core (0.14.1)
google-apis-androidpublisher_v3 (0.64.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-core (0.15.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
google-apis-iamcredentials_v1 (0.20.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-playcustomapp_v1 (0.15.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-storage_v1 (0.37.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-iamcredentials_v1 (0.21.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-playcustomapp_v1 (0.16.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-storage_v1 (0.38.0)
google-apis-core (>= 0.15.0, < 2.a)
google-cloud-core (1.7.0)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-cloud-storage (1.50.0)
google-cloud-storage (1.51.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-core (~> 0.13)
Expand All @@ -158,7 +158,7 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.4.0)
multipart-post (2.4.1)
nanaimo (0.3.0)
naturally (2.2.1)
nkf (0.2.0)
Expand All @@ -172,7 +172,8 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rexml (3.2.8)
strscan (>= 3.0.9)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand All @@ -185,6 +186,7 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
strscan (3.1.0)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand Down Expand Up @@ -217,4 +219,4 @@ DEPENDENCIES
fastlane (= 2.216.0)

BUNDLED WITH
2.5.9
2.5.10
4 changes: 3 additions & 1 deletion Test Harness/NRTestApp/NRTestApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//NRLogger.setLogTargets(NRLogTargetConsole.rawValue | NRLogTargetFile.rawValue)


NewRelic.replaceDeviceIdentifier("myDeviceId")
NewRelic.saltDeviceUUID(true)

// NewRelic.replaceDeviceIdentifier("myDeviceId")

NewRelic.setMaxEventPoolSize(5000)
NewRelic.setMaxEventBufferTime(60)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@

@interface NewRelic (Replace)
+ (void) replaceDeviceIdentifier:(NSString*)identifier;
+ (void) saltDeviceUUID:(BOOL)enabled;
@end
Loading

0 comments on commit 9bfce72

Please sign in to comment.