diff --git a/patches/react-native+0.75.2+017+redactAppParameters.patch b/patches/react-native+0.75.2+017+redactAppParameters.patch new file mode 100644 index 000000000000..7c4273c6d0c1 --- /dev/null +++ b/patches/react-native+0.75.2+017+redactAppParameters.patch @@ -0,0 +1,40 @@ +diff --git a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js +index 68bd389..be9b5bf 100644 +--- a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js ++++ b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js +@@ -232,12 +232,34 @@ const AppRegistry = { + appParameters: Object, + displayMode?: number, + ): void { ++ const redactAppParameters = (parameters) => { ++ const initialProps = parameters['initialProps']; ++ const url = initialProps['url']; ++ ++ if(!url) { ++ return parameters; ++ } ++ ++ const sensitiveParams = ['authToken', 'autoGeneratedPassword', 'autoGeneratedLogin']; ++ const [urlBase, queryString] = url.split('?'); ++ ++ if (!queryString) { ++ return parameters; ++ } ++ ++ const redactedSearchParams = queryString.split('&').map((param) => { ++ const [key, value] = param.split('='); ++ return `${key}=${sensitiveParams.includes(key) ? '' : value}` ++ }); ++ return {...parameters, initialProps: {...initialProps, url: `${urlBase}?${redactedSearchParams.join('&')}`}}; ++ } ++ + if (appKey !== 'LogBox') { + const msg = + 'Updating props for Surface "' + + appKey + + '" with ' + +- JSON.stringify(appParameters); ++ JSON.stringify(redactAppParameters(appParameters)); + infoLog(msg); + BugReporting.addSource( + 'AppRegistry.setSurfaceProps' + runCount++,