Skip to content

Commit

Permalink
fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Sep 4, 2024
1 parent 0e41e99 commit f3d1d7f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions patches/react-native+0.75.2+017+redactAppParameters.patch
Original file line number Diff line number Diff line change
@@ -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) ? '<REDACTED>' : 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++,

0 comments on commit f3d1d7f

Please sign in to comment.