Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLASK] Filter out snaps source code and state from UI state #20136

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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