Skip to content

Commit

Permalink
Filter out snaps source code and state from UI state
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jul 22, 2023
1 parent e1722d7 commit a9c25d8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down

0 comments on commit a9c25d8

Please sign in to comment.