1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01: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 GitHub
parent 13faeeac2b
commit b584b82dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2107,9 +2107,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
};
}