From 629eb6f7f7ba761e9a3c1b580c388e97f1d68f76 Mon Sep 17 00:00:00 2001 From: Aditya Chawla Date: Thu, 26 Sep 2024 15:50:52 -0700 Subject: [PATCH] psd removal reordering bug fix - ios SDK Summary: reordered PSD filtering in ios SDK Reviewed By: KylinChang Differential Revision: D63471859 fbshipit-source-id: a68ef6d0b41e8a9df101e723dad90b60750bd28f --- .../FBSDKCoreKit/AppEvents/FBSDKAppEvents.m | 18 ++++++++++++------ .../FBSDKCoreKit/include/FBSDKFeature.h | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m b/FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m index e677f0154..4d9cf65af 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m +++ b/FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m @@ -1113,6 +1113,17 @@ - (void) logEvent:(FBSDKAppEventName)eventName return; } + + BOOL isProtectedModeApplied = (self.protectedModeManager && [FBSDKProtectedModeManager isProtectedModeAppliedWithParameters:parameters]); + if (!isProtectedModeApplied && self.sensitiveParamsManager) { + @try { + parameters = [self.sensitiveParamsManager processParameters:parameters eventName:eventName]; + } @catch(NSException *exception) { + [self.logger singleShotLogEntry:FBSDKLoggingBehaviorAppEvents + logEntry:@"FBSDKAppEvents: caught exception while processing sensitiveParamsManager."]; + } + } + if (self.macaRuleMatchingManager) { @try { parameters = [self.macaRuleMatchingManager processParameters:parameters event:eventName?:@""]; @@ -1156,6 +1167,7 @@ - (void) logEvent:(FBSDKAppEventName)eventName // Filter out restrictive keys parameters = [self.restrictiveDataFilterParameterProcessor processParameters:parameters eventName:eventName]; + // Filter out non-standard params if (self.protectedModeManager) { @try { @@ -1163,12 +1175,6 @@ - (void) logEvent:(FBSDKAppEventName)eventName } @catch(NSException *exception) {} } - BOOL isProtectedModeApplied = (self.protectedModeManager && [FBSDKProtectedModeManager isProtectedModeAppliedWithParameters:parameters]); - if (!isProtectedModeApplied && self.sensitiveParamsManager) { - @try { - parameters = [self.sensitiveParamsManager processParameters:parameters eventName:eventName]; - } @catch(NSException *exception) {} - } NSMutableDictionary *eventDictionary = [NSMutableDictionary dictionaryWithDictionary:parameters ?: @{}]; [FBSDKTypeUtility dictionary:eventDictionary setObject:eventName forKey:FBSDKAppEventParameterNameEventName]; diff --git a/FBSDKCoreKit/FBSDKCoreKit/include/FBSDKFeature.h b/FBSDKCoreKit/FBSDKCoreKit/include/FBSDKFeature.h index bf4087910..0873d12ad 100644 --- a/FBSDKCoreKit/FBSDKCoreKit/include/FBSDKFeature.h +++ b/FBSDKCoreKit/FBSDKCoreKit/include/FBSDKFeature.h @@ -47,10 +47,10 @@ typedef NS_ENUM(NSUInteger, FBSDKFeature) { FBSDKFeatureIntelligentIntegrity = 0x01010402, FBSDKFeatureModelRequest = 0x01010403, FBSDKFeatureProtectedMode = 0x01010404, + FBSDKFeatureFilterSensitiveParams = 0x01010408, FBSDKFeatureMACARuleMatching = 0x01010405, FBSDKFeatureBlocklistEvents = 0x01010406, FBSDKFeatureFilterRedactedEvents = 0x01010407, - FBSDKFeatureFilterSensitiveParams = 0x01010408, FBSDKFeatureEventDeactivation = 0x01010500, FBSDKFeatureSKAdNetwork = 0x01010600, FBSDKFeatureSKAdNetworkConversionValue = 0x01010601,