mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Split Sentry mask into UI and background masks (#20426)
The state mask used to anonymize the Sentry state snapshots has been split into UI and background masks. This was done to simplify later refactors. There should be no functional changes.
This commit is contained in:
parent
c0fd7700c8
commit
4e93b86116
@ -41,7 +41,7 @@ import Migrator from './lib/migrator';
|
||||
import ExtensionPlatform from './platforms/extension';
|
||||
import LocalStore from './lib/local-store';
|
||||
import ReadOnlyNetworkStore from './lib/network-store';
|
||||
import { SENTRY_STATE } from './lib/setupSentry';
|
||||
import { SENTRY_BACKGROUND_STATE } from './lib/setupSentry';
|
||||
|
||||
import createStreamSink from './lib/createStreamSink';
|
||||
import NotificationManager, {
|
||||
@ -886,11 +886,14 @@ browser.runtime.onInstalled.addListener(({ reason }) => {
|
||||
|
||||
function setupSentryGetStateGlobal(store) {
|
||||
global.stateHooks.getSentryState = function () {
|
||||
const fullState = store.getState();
|
||||
const debugState = maskObject({ metamask: fullState }, SENTRY_STATE);
|
||||
const backgroundState = store.getState();
|
||||
const maskedBackgroundState = maskObject(
|
||||
backgroundState,
|
||||
SENTRY_BACKGROUND_STATE,
|
||||
);
|
||||
return {
|
||||
browser: window.navigator.userAgent,
|
||||
store: debugState,
|
||||
store: { metamask: maskedBackgroundState },
|
||||
version: platform.getVersion(),
|
||||
};
|
||||
};
|
||||
|
@ -23,59 +23,64 @@ export const ERROR_URL_ALLOWLIST = {
|
||||
SEGMENT: 'segment.io',
|
||||
};
|
||||
|
||||
// This describes the subset of background controller state attached to errors
|
||||
// sent to Sentry These properties have some potential to be useful for
|
||||
// debugging, and they do not contain any identifiable information.
|
||||
export const SENTRY_BACKGROUND_STATE = {
|
||||
alertEnabledness: true,
|
||||
completedOnboarding: true,
|
||||
connectedStatusPopoverHasBeenShown: true,
|
||||
conversionDate: true,
|
||||
conversionRate: true,
|
||||
currentAppVersion: true,
|
||||
currentBlockGasLimit: true,
|
||||
currentCurrency: true,
|
||||
currentLocale: true,
|
||||
currentMigrationVersion: true,
|
||||
customNonceValue: true,
|
||||
defaultHomeActiveTabName: true,
|
||||
desktopEnabled: true,
|
||||
featureFlags: true,
|
||||
firstTimeFlowType: true,
|
||||
forgottenPassword: true,
|
||||
incomingTxLastFetchedBlockByChainId: true,
|
||||
ipfsGateway: true,
|
||||
isAccountMenuOpen: true,
|
||||
isInitialized: true,
|
||||
isUnlocked: true,
|
||||
metaMetricsId: true,
|
||||
nativeCurrency: true,
|
||||
networkId: true,
|
||||
networkStatus: true,
|
||||
nextNonce: true,
|
||||
participateInMetaMetrics: true,
|
||||
preferences: true,
|
||||
previousAppVersion: true,
|
||||
previousMigrationVersion: true,
|
||||
providerConfig: {
|
||||
nickname: true,
|
||||
ticker: true,
|
||||
type: true,
|
||||
},
|
||||
seedPhraseBackedUp: true,
|
||||
unapprovedDecryptMsgCount: true,
|
||||
unapprovedEncryptionPublicKeyMsgCount: true,
|
||||
unapprovedMsgCount: true,
|
||||
unapprovedPersonalMsgCount: true,
|
||||
unapprovedTypedMessagesCount: true,
|
||||
useBlockie: true,
|
||||
useNonceField: true,
|
||||
usePhishDetect: true,
|
||||
welcomeScreenSeen: true,
|
||||
};
|
||||
|
||||
// This describes the subset of Redux state attached to errors sent to Sentry
|
||||
// These properties have some potential to be useful for debugging, and they do
|
||||
// not contain any identifiable information.
|
||||
export const SENTRY_STATE = {
|
||||
export const SENTRY_UI_STATE = {
|
||||
gas: true,
|
||||
history: true,
|
||||
metamask: {
|
||||
alertEnabledness: true,
|
||||
completedOnboarding: true,
|
||||
connectedStatusPopoverHasBeenShown: true,
|
||||
conversionDate: true,
|
||||
conversionRate: true,
|
||||
currentAppVersion: true,
|
||||
currentBlockGasLimit: true,
|
||||
currentCurrency: true,
|
||||
currentLocale: true,
|
||||
currentMigrationVersion: true,
|
||||
customNonceValue: true,
|
||||
defaultHomeActiveTabName: true,
|
||||
desktopEnabled: true,
|
||||
featureFlags: true,
|
||||
firstTimeFlowType: true,
|
||||
forgottenPassword: true,
|
||||
incomingTxLastFetchedBlockByChainId: true,
|
||||
ipfsGateway: true,
|
||||
isAccountMenuOpen: true,
|
||||
isInitialized: true,
|
||||
isUnlocked: true,
|
||||
metaMetricsId: true,
|
||||
nativeCurrency: true,
|
||||
networkId: true,
|
||||
networkStatus: true,
|
||||
nextNonce: true,
|
||||
participateInMetaMetrics: true,
|
||||
preferences: true,
|
||||
previousAppVersion: true,
|
||||
previousMigrationVersion: true,
|
||||
providerConfig: {
|
||||
nickname: true,
|
||||
ticker: true,
|
||||
type: true,
|
||||
},
|
||||
seedPhraseBackedUp: true,
|
||||
unapprovedDecryptMsgCount: true,
|
||||
unapprovedEncryptionPublicKeyMsgCount: true,
|
||||
unapprovedMsgCount: true,
|
||||
unapprovedPersonalMsgCount: true,
|
||||
unapprovedTypedMessagesCount: true,
|
||||
useBlockie: true,
|
||||
useNonceField: true,
|
||||
usePhishDetect: true,
|
||||
welcomeScreenSeen: true,
|
||||
},
|
||||
metamask: SENTRY_BACKGROUND_STATE,
|
||||
unconnectedAccount: true,
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@ import browser from 'webextension-polyfill';
|
||||
import { getEnvironmentType } from '../app/scripts/lib/util';
|
||||
import { AlertTypes } from '../shared/constants/alerts';
|
||||
import { maskObject } from '../shared/modules/object.utils';
|
||||
import { SENTRY_STATE } from '../app/scripts/lib/setupSentry';
|
||||
import { SENTRY_UI_STATE } from '../app/scripts/lib/setupSentry';
|
||||
import { ENVIRONMENT_TYPE_POPUP } from '../shared/constants/app';
|
||||
import switchDirection from '../shared/lib/switch-direction';
|
||||
import { setupLocale } from '../shared/lib/error-utils';
|
||||
@ -234,11 +234,11 @@ function setupStateHooks(store) {
|
||||
return state;
|
||||
};
|
||||
window.stateHooks.getSentryState = function () {
|
||||
const fullState = store.getState();
|
||||
const debugState = maskObject(fullState, SENTRY_STATE);
|
||||
const reduxState = store.getState();
|
||||
const maskedReduxState = maskObject(reduxState, SENTRY_UI_STATE);
|
||||
return {
|
||||
browser: window.navigator.userAgent,
|
||||
store: debugState,
|
||||
store: maskedReduxState,
|
||||
version: global.platform.getVersion(),
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user