소스 검색

rn: skip logging potentially sensitive data

master
Saúl Ibarra Corretgé 6 년 전
부모
커밋
c2c323347a
2개의 변경된 파일23개의 추가작업 그리고 10개의 파일을 삭제
  1. 6
    3
      react/features/base/storage/PersistenceRegistry.js
  2. 17
    7
      react/features/mobile/external-api/middleware.js

+ 6
- 3
react/features/base/storage/PersistenceRegistry.js 파일 보기

@@ -4,6 +4,8 @@ import md5 from 'js-md5';
4 4
 
5 5
 import logger from './logger';
6 6
 
7
+declare var __DEV__;
8
+
7 9
 /**
8 10
  * The name of the {@code localStorage} store where the app persists its values.
9 11
  */
@@ -87,7 +89,9 @@ class PersistenceRegistry {
87 89
         // Initialize the checksum.
88 90
         this._checksum = this._calculateChecksum(filteredPersistedState);
89 91
 
90
-        logger.info('redux state rehydrated as', filteredPersistedState);
92
+        if (typeof __DEV__ !== 'undefined' && __DEV__) {
93
+            logger.info('redux state rehydrated as', filteredPersistedState);
94
+        }
91 95
 
92 96
         return filteredPersistedState;
93 97
     }
@@ -113,7 +117,6 @@ class PersistenceRegistry {
113 117
                     logger.error(
114 118
                         'Error persisting redux subtree',
115 119
                         subtreeName,
116
-                        filteredState[subtreeName],
117 120
                         error);
118 121
                 }
119 122
             }
@@ -153,7 +156,7 @@ class PersistenceRegistry {
153 156
         try {
154 157
             return md5.hex(JSON.stringify(state) || '');
155 158
         } catch (error) {
156
-            logger.error('Error calculating checksum for state', state, error);
159
+            logger.error('Error calculating checksum for state', error);
157 160
 
158 161
             return '';
159 162
         }

+ 17
- 7
react/features/mobile/external-api/middleware.js 파일 보기

@@ -15,10 +15,10 @@ import {
15 15
     CONNECTION_DISCONNECTED,
16 16
     CONNECTION_FAILED,
17 17
     JITSI_CONNECTION_CONFERENCE_KEY,
18
-    JITSI_CONNECTION_URL_KEY
18
+    JITSI_CONNECTION_URL_KEY,
19
+    getURLWithoutParams
19 20
 } from '../../base/connection';
20 21
 import { MiddlewareRegistry } from '../../base/redux';
21
-import { toURLString } from '../../base/util';
22 22
 import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
23 23
 
24 24
 import { sendEvent } from './functions';
@@ -82,7 +82,7 @@ MiddlewareRegistry.register(store => next => action => {
82 82
                 store,
83 83
                 CONFERENCE_TERMINATED,
84 84
                 /* data */ {
85
-                    url: toURLString(locationURL)
85
+                    url: _normalizeUrl(locationURL)
86 86
                 });
87 87
         }
88 88
 
@@ -106,7 +106,7 @@ MiddlewareRegistry.register(store => next => action => {
106 106
             CONFERENCE_TERMINATED,
107 107
             /* data */ {
108 108
                 error: _toErrorString(error),
109
-                url: toURLString(locationURL)
109
+                url: _normalizeUrl(locationURL)
110 110
             });
111 111
         break;
112 112
     }
@@ -161,10 +161,20 @@ function _maybeTriggerEarlyConferenceWillJoin(store, action) {
161 161
         store,
162 162
         CONFERENCE_WILL_JOIN,
163 163
         /* data */ {
164
-            url: toURLString(locationURL)
164
+            url: _normalizeUrl(locationURL)
165 165
         });
166 166
 }
167 167
 
168
+/**
169
+ * Normalizes the given URL for presentation over the external API.
170
+ *
171
+ * @param {URL} url -The URL to normalize.
172
+ * @returns {string} - The normalized URL as a string.
173
+ */
174
+function _normalizeUrl(url: URL) {
175
+    return getURLWithoutParams(url).href;
176
+}
177
+
168 178
 /**
169 179
  * Sends an event to the native counterpart of the External API for a specific
170 180
  * conference-related redux action.
@@ -186,7 +196,7 @@ function _sendConferenceEvent(
186 196
     // instance. The external API cannot transport such an object so we have to
187 197
     // transport an "equivalent".
188 198
     if (conference) {
189
-        data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
199
+        data.url = _normalizeUrl(conference[JITSI_CONFERENCE_URL_KEY]);
190 200
     }
191 201
 
192 202
     if (_swallowEvent(store, action, data)) {
@@ -233,7 +243,7 @@ function _sendConferenceFailedOnConnectionError(store, action) {
233 243
         store,
234 244
         CONFERENCE_TERMINATED,
235 245
         /* data */ {
236
-            url: toURLString(locationURL),
246
+            url: _normalizeUrl(locationURL),
237 247
             error: action.error.name
238 248
         });
239 249
 }

Loading…
취소
저장