1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00

Filter out snaps source code and state from UI state (#20136)

This commit is contained in:
Frederik Bolding 2023-07-24 15:13:34 +02:00 committed by Dan J Miller
parent 04d14e2e16
commit 388e19495c

View File

@ -2092,9 +2092,21 @@ export default class MetamaskController extends EventEmitter {
const { vault } = this.keyringController.store.getState();
const isInitialized = Boolean(vault);
const flatState = this.memStore.getFlatState();
return {
isInitialized,
...this.memStore.getFlatState(),
...flatState,
///: BEGIN:ONLY_INCLUDE_IN(snaps)
// Snap state and source code is stripped out to prevent piping to the MetaMask UI.
snapStates: {},
snaps: Object.values(flatState.snaps ?? {}).reduce((acc, snap) => {
// eslint-disable-next-line no-unused-vars
const { sourceCode, ...rest } = snap;
acc[snap.id] = rest;
return acc;
}, {}),
///: END:ONLY_INCLUDE_IN
};
}