rn: skip logging potentially sensitive data

This commit is contained in:
Saúl Ibarra Corretgé 2019-11-14 13:33:20 +01:00 committed by Saúl Ibarra Corretgé
parent af6642b91b
commit c2c323347a
2 changed files with 23 additions and 10 deletions

View File

@ -4,6 +4,8 @@ import md5 from 'js-md5';
import logger from './logger';
declare var __DEV__;
/**
* The name of the {@code localStorage} store where the app persists its values.
*/
@ -87,7 +89,9 @@ class PersistenceRegistry {
// Initialize the checksum.
this._checksum = this._calculateChecksum(filteredPersistedState);
if (typeof __DEV__ !== 'undefined' && __DEV__) {
logger.info('redux state rehydrated as', filteredPersistedState);
}
return filteredPersistedState;
}
@ -113,7 +117,6 @@ class PersistenceRegistry {
logger.error(
'Error persisting redux subtree',
subtreeName,
filteredState[subtreeName],
error);
}
}
@ -153,7 +156,7 @@ class PersistenceRegistry {
try {
return md5.hex(JSON.stringify(state) || '');
} catch (error) {
logger.error('Error calculating checksum for state', state, error);
logger.error('Error calculating checksum for state', error);
return '';
}

View File

@ -15,10 +15,10 @@ import {
CONNECTION_DISCONNECTED,
CONNECTION_FAILED,
JITSI_CONNECTION_CONFERENCE_KEY,
JITSI_CONNECTION_URL_KEY
JITSI_CONNECTION_URL_KEY,
getURLWithoutParams
} from '../../base/connection';
import { MiddlewareRegistry } from '../../base/redux';
import { toURLString } from '../../base/util';
import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
import { sendEvent } from './functions';
@ -82,7 +82,7 @@ MiddlewareRegistry.register(store => next => action => {
store,
CONFERENCE_TERMINATED,
/* data */ {
url: toURLString(locationURL)
url: _normalizeUrl(locationURL)
});
}
@ -106,7 +106,7 @@ MiddlewareRegistry.register(store => next => action => {
CONFERENCE_TERMINATED,
/* data */ {
error: _toErrorString(error),
url: toURLString(locationURL)
url: _normalizeUrl(locationURL)
});
break;
}
@ -161,10 +161,20 @@ function _maybeTriggerEarlyConferenceWillJoin(store, action) {
store,
CONFERENCE_WILL_JOIN,
/* data */ {
url: toURLString(locationURL)
url: _normalizeUrl(locationURL)
});
}
/**
* Normalizes the given URL for presentation over the external API.
*
* @param {URL} url -The URL to normalize.
* @returns {string} - The normalized URL as a string.
*/
function _normalizeUrl(url: URL) {
return getURLWithoutParams(url).href;
}
/**
* Sends an event to the native counterpart of the External API for a specific
* conference-related redux action.
@ -186,7 +196,7 @@ function _sendConferenceEvent(
// instance. The external API cannot transport such an object so we have to
// transport an "equivalent".
if (conference) {
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
data.url = _normalizeUrl(conference[JITSI_CONFERENCE_URL_KEY]);
}
if (_swallowEvent(store, action, data)) {
@ -233,7 +243,7 @@ function _sendConferenceFailedOnConnectionError(store, action) {
store,
CONFERENCE_TERMINATED,
/* data */ {
url: toURLString(locationURL),
url: _normalizeUrl(locationURL),
error: action.error.name
});
}