From e68e3ccc2fa912372d48a1382cefb81d843d6d41 Mon Sep 17 00:00:00 2001 From: Connor Bryan Date: Thu, 5 Jul 2018 12:29:23 -0500 Subject: [PATCH 1/8] Tighten web3 network change refresh validation (#2014) * Add a check to make sure a network even exists on the web3Wallet instance * Format snap files --- common/features/config/__snapshots__/sagas.spec.ts.snap | 4 +++- .../deterministicWallets/__snapshots__/sagas.spec.ts.snap | 6 ++++-- common/features/handleMetaMaskPolling.ts | 7 ++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/features/config/__snapshots__/sagas.spec.ts.snap b/common/features/config/__snapshots__/sagas.spec.ts.snap index bd0f53b5..5c78d960 100644 --- a/common/features/config/__snapshots__/sagas.spec.ts.snap +++ b/common/features/config/__snapshots__/sagas.spec.ts.snap @@ -12,7 +12,9 @@ Object { } `; -exports[`handleChangeNodeRequested* should select getCustomNodeConfig and match race snapshot 1`] = ` +exports[ + `handleChangeNodeRequested* should select getCustomNodeConfig and match race snapshot 1` +] = ` Object { "@@redux-saga/IO": true, "SELECT": Object { diff --git a/common/features/deterministicWallets/__snapshots__/sagas.spec.ts.snap b/common/features/deterministicWallets/__snapshots__/sagas.spec.ts.snap index 74d459c8..ab5c6333 100644 --- a/common/features/deterministicWallets/__snapshots__/sagas.spec.ts.snap +++ b/common/features/deterministicWallets/__snapshots__/sagas.spec.ts.snap @@ -1,6 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`getDeterministicWallets* starting from publicKey & chainCode should match put snapshot 1`] = ` +exports[ + `getDeterministicWallets* starting from publicKey & chainCode should match put snapshot 1` +] = ` Object { "@@redux-saga/IO": true, "PUT": Object { @@ -215,4 +217,4 @@ Object { }, ], } -`; \ No newline at end of file +`; diff --git a/common/features/handleMetaMaskPolling.ts b/common/features/handleMetaMaskPolling.ts index 9c3d12b1..118ec5f7 100644 --- a/common/features/handleMetaMaskPolling.ts +++ b/common/features/handleMetaMaskPolling.ts @@ -37,7 +37,12 @@ export default async function handleMetaMaskPolling(store: Store): Pro const actualChainId = await getActualChainId(); const actualNetwork = configNetworksSelectors.getNetworkByChainId(state, actualChainId); - if (web3Wallet && actualNetwork && (web3Wallet as Web3Wallet).network !== actualNetwork.id) { + if ( + web3Wallet && + (web3Wallet as Web3Wallet).network && + actualNetwork && + (web3Wallet as Web3Wallet).network !== actualNetwork.id + ) { window.location.reload(); return true; From eb9f65146525b74c0155228d516c876ef4a8922f Mon Sep 17 00:00:00 2001 From: Connor Bryan Date: Thu, 5 Jul 2018 15:04:28 -0500 Subject: [PATCH 2/8] Added a preliminary check before polling --- common/features/store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/features/store.ts b/common/features/store.ts index 359378fa..b41f0784 100644 --- a/common/features/store.ts +++ b/common/features/store.ts @@ -91,6 +91,9 @@ window.addEventListener('load', () => { }); }); -setInterval(handleMetaMaskPolling.bind(null, store), METAMASK_POLLING_INTERVAL); +/** @desc When MetaMask is loaded as an extension, watch for network changes. */ +if ((window as any).web3) { + setInterval(handleMetaMaskPolling.bind(null, store), METAMASK_POLLING_INTERVAL); +} export default store; From e0c2b10d8625fd0094ac488bfb0de2c0679e0a88 Mon Sep 17 00:00:00 2001 From: Danny Skubak Date: Fri, 6 Jul 2018 09:15:08 -0400 Subject: [PATCH 3/8] MC-01-003: Add CSP to Meta Tag (#2019) * add meta content security policy * inject meta csp based on production status * use correct var * rollback devtoll modification --- common/index.html | 1 + webpack_config/makeConfig.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/index.html b/common/index.html index cac71d94..8a67e544 100644 --- a/common/index.html +++ b/common/index.html @@ -4,6 +4,7 @@ MyCrypto + diff --git a/webpack_config/makeConfig.js b/webpack_config/makeConfig.js index d9304990..73b2c4bc 100644 --- a/webpack_config/makeConfig.js +++ b/webpack_config/makeConfig.js @@ -166,7 +166,10 @@ module.exports = function(opts = {}) { twitter: { site: config.twitter.creator, creator: config.twitter.creator - } + }, + metaCsp: options.isProduction + ? "default-src 'none'; script-src 'self'; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; manifest-src 'self'; font-src 'self'; img-src 'self' data: https://shapeshift.io; connect-src *;" + : "" }), new CopyWebpackPlugin([ From 425655ee055664abaccafdb5c9786f07ef7beaad Mon Sep 17 00:00:00 2001 From: James Prado Date: Fri, 6 Jul 2018 14:29:39 +0100 Subject: [PATCH 4/8] Fix meta tag link (#2006) * Fix meta tag link * fix path --- common/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/index.html b/common/index.html index 8a67e544..816d698f 100644 --- a/common/index.html +++ b/common/index.html @@ -13,7 +13,7 @@ - + @@ -74,4 +74,4 @@ - + \ No newline at end of file From e5e5dd82747978b4f5aeda8a73d4e0229ea205a8 Mon Sep 17 00:00:00 2001 From: Alejandro Cavallero Date: Fri, 6 Jul 2018 12:13:26 -0300 Subject: [PATCH 5/8] Hide unsupported tabs by RSK (#2011) * Hides unsupported tabs by RSK * Allows swap --- common/features/config/networks/static/reducer.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/features/config/networks/static/reducer.ts b/common/features/config/networks/static/reducer.ts index b3a07312..edb903e2 100644 --- a/common/features/config/networks/static/reducer.ts +++ b/common/features/config/networks/static/reducer.ts @@ -29,6 +29,7 @@ import { } from 'config/dpaths'; import { makeExplorer } from 'utils/helpers'; import { StaticNetworksState } from './types'; +import { TAB } from 'components/Header/components/constants'; const testnetDefaultGasPrice = { min: 0.1, @@ -393,7 +394,8 @@ export const STATIC_NETWORKS_INITIAL_STATE: StaticNetworksState = { min: 0.183, max: 1.5, initial: 0.183 - } + }, + unsupportedTabs: [TAB.ENS] }, RSK_TESTNET: { @@ -419,7 +421,8 @@ export const STATIC_NETWORKS_INITIAL_STATE: StaticNetworksState = { min: 0.183, max: 1.5, initial: 0.183 - } + }, + unsupportedTabs: [TAB.ENS] }, GO: { From e17c94333bfd0dde84d7b28f43b28a754b74abc6 Mon Sep 17 00:00:00 2001 From: Danny Skubak Date: Fri, 6 Jul 2018 12:02:33 -0400 Subject: [PATCH 6/8] MC-01-004: Prevent Navigation on Main Electron Window (#2022) --- electron-app/main/window.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/electron-app/main/window.ts b/electron-app/main/window.ts index 11d0c549..bd5f11f9 100644 --- a/electron-app/main/window.ts +++ b/electron-app/main/window.ts @@ -67,6 +67,10 @@ export default function getWindow() { }); }); + window.webContents.on('will-navigate', (event: any) => { + event.preventDefault(); + }); + if (isDevelopment) { window.webContents.on('did-fail-load', () => { setTimeout(() => { From 9114f69051ac51f93787f5128859c655bf22a532 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Fri, 6 Jul 2018 11:10:15 -0500 Subject: [PATCH 7/8] Remove Alpha Banner on Electron (#2023) --- common/components/ElectronNav/ElectronNav.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/common/components/ElectronNav/ElectronNav.tsx b/common/components/ElectronNav/ElectronNav.tsx index 7f8a0ba7..b70172f3 100644 --- a/common/components/ElectronNav/ElectronNav.tsx +++ b/common/components/ElectronNav/ElectronNav.tsx @@ -44,7 +44,6 @@ class ElectronNav extends React.Component { >
-
Alpha Release
    From 5d841ce1bd51512d46bb9992e4c4de26a7663ae5 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Fri, 6 Jul 2018 12:00:23 -0500 Subject: [PATCH 8/8] Remove Desktop Alpha Warnings (#2024) --- .../AppAlphaNotice/AlphaNotice.scss | 53 -------------- .../components/AppAlphaNotice/AlphaNotice.tsx | 73 ------------------- .../components/AppAlphaNotice/AppExpired.scss | 44 ----------- .../components/AppAlphaNotice/AppExpired.tsx | 26 ------- common/components/AppAlphaNotice/index.tsx | 15 ---- common/components/index.ts | 1 - common/config/data.tsx | 6 -- .../TabSection/ElectronTemplate.tsx | 3 +- 8 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 common/components/AppAlphaNotice/AlphaNotice.scss delete mode 100644 common/components/AppAlphaNotice/AlphaNotice.tsx delete mode 100644 common/components/AppAlphaNotice/AppExpired.scss delete mode 100644 common/components/AppAlphaNotice/AppExpired.tsx delete mode 100644 common/components/AppAlphaNotice/index.tsx diff --git a/common/components/AppAlphaNotice/AlphaNotice.scss b/common/components/AppAlphaNotice/AlphaNotice.scss deleted file mode 100644 index d4b3c5be..00000000 --- a/common/components/AppAlphaNotice/AlphaNotice.scss +++ /dev/null @@ -1,53 +0,0 @@ -@import 'common/sass/variables'; -@import 'common/sass/mixins'; - -.AppAlpha { - @include cover-message; - background: color(brand-info); - left: $electron-sidebar-width - 1; - - &-content { - h2 { - text-align: center; - } - - p { - text-align: justify; - } - - &-btn { - display: block; - width: 100%; - max-width: 280px; - margin: 40px auto 0; - border: none; - padding: 0; - transition: $transition; - height: 60px; - line-height: 60px; - font-size: 22px; - background: #fff; - color: #333; - opacity: 0.96; - border-radius: 4px; - - &:hover { - opacity: 1; - } - } - } - - // Fade out - &.is-fading { - pointer-events: none; - opacity: 0; - background: color(control-bg); - transition: all 500ms ease 400ms; - - .AppAlpha-content { - opacity: 0; - transform: translateY(15px); - transition: all 500ms ease; - } - } -} diff --git a/common/components/AppAlphaNotice/AlphaNotice.tsx b/common/components/AppAlphaNotice/AlphaNotice.tsx deleted file mode 100644 index 9dddd3a1..00000000 --- a/common/components/AppAlphaNotice/AlphaNotice.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react'; -import moment from 'moment'; - -import { discordURL, APP_ALPHA_EXPIRATION } from 'config'; -import { NewTabLink } from 'components/ui'; -import './AlphaNotice.scss'; - -interface State { - isFading: boolean; - isClosed: boolean; -} - -let hasAcknowledged = false; - -export default class AppAlphaNotice extends React.PureComponent<{}, State> { - public state = { - isFading: false, - isClosed: hasAcknowledged - }; - - public render() { - if (this.state.isClosed) { - return null; - } - - const isFading = this.state.isFading ? 'is-fading' : ''; - const expDate = moment(APP_ALPHA_EXPIRATION).format('MMMM Do, YYYY'); - - return ( -
    -
    -

    Welcome to the MyCrypto Desktop App Alpha

    -

    - Thank you for testing out the new MyCrypto desktop app. This is an early release to be - tested by the community before a full launch. We recommend continuing to use the - production site for large or otherwise important transactions. -

    -

    - Because this is for testing purposes only,{' '} - this build of the app will only be accessible until {expDate}. You’ll - then be required to update the application to continue using it. -

    -

    - Feedback and bug reports are greatly appreciated. You can file issues on our{' '} - - GitHub repository - {' '} - or join our Discord server to discuss the - app. -

    -

    - - For critical reports & vulnerabilities, please use{' '} - HackerOne. - -

    - - -
    -
    - ); - } - - private doContinue = () => { - hasAcknowledged = true; - this.setState({ isFading: true }); - setTimeout(() => { - this.setState({ isClosed: true }); - }, 1000); - }; -} diff --git a/common/components/AppAlphaNotice/AppExpired.scss b/common/components/AppAlphaNotice/AppExpired.scss deleted file mode 100644 index 867e360a..00000000 --- a/common/components/AppAlphaNotice/AppExpired.scss +++ /dev/null @@ -1,44 +0,0 @@ -@import 'common/sass/variables'; -@import 'common/sass/mixins'; - -.AppExpired { - @include cover-message; - background: color(brand-danger); - display: flex; - align-items: center; - - &-content { - padding-bottom: 60px; - - h2 { - text-align: center; - } - - p { - text-align: justify; - } - - &-btn { - display: block; - width: 100%; - max-width: 280px; - margin: 40px auto 0; - text-align: center; - border: none; - padding: 0; - transition: $transition; - height: 60px; - line-height: 60px; - font-size: 22px; - background: #fff; - color: #333; - border-radius: 4px; - text-shadow: none; - opacity: 0.95; - - &:hover { - opacity: 1; - } - } - } -} diff --git a/common/components/AppAlphaNotice/AppExpired.tsx b/common/components/AppAlphaNotice/AppExpired.tsx deleted file mode 100644 index a36a79c4..00000000 --- a/common/components/AppAlphaNotice/AppExpired.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; - -import { NewTabLink } from 'components/ui'; -import './AppExpired.scss'; - -const AppExpired: React.SFC<{}> = () => ( -
    -
    -

    Your Alpha Build Has Expired

    -

    - To ensure the safety of your funds, we are expiring alpha builds one month after release and - requiring users to update. All you have to do is download a new build from our GitHub, and - you can continue to use the app. Sorry for the hassle! -

    - - - Download a New Build - -
    -
    -); - -export default AppExpired; diff --git a/common/components/AppAlphaNotice/index.tsx b/common/components/AppAlphaNotice/index.tsx deleted file mode 100644 index 8a66179e..00000000 --- a/common/components/AppAlphaNotice/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; - -import { APP_ALPHA_EXPIRATION } from 'config'; -import AlphaNotice from './AlphaNotice'; -import AppExpired from './AppExpired'; - -const AppAlphaNotice: React.SFC<{}> = () => { - if (APP_ALPHA_EXPIRATION < Date.now()) { - return ; - } else { - return ; - } -}; - -export default AppAlphaNotice; diff --git a/common/components/index.ts b/common/components/index.ts index 013e6645..688f845f 100644 --- a/common/components/index.ts +++ b/common/components/index.ts @@ -24,4 +24,3 @@ export { default as ParityQrSigner } from './ParityQrSigner'; export { default as ElectronNav } from './ElectronNav'; export { default as AddressBookTable } from './AddressBookTable'; export { default as Errorable } from './Errorable'; -export { default as AppAlphaNotice } from './AppAlphaNotice'; diff --git a/common/config/data.tsx b/common/config/data.tsx index 01fa50ae..f7a3d575 100644 --- a/common/config/data.tsx +++ b/common/config/data.tsx @@ -12,12 +12,6 @@ export const discordURL = 'https://discord.gg/VSaTXEA'; export const VERSION = packageJson.version; export const N_FACTOR = 8192; -// Bricks the app once this date has been exceeded. Remember to update these 2 -// whenever making a new app release. -// It is currently set to: Wednesday, July 25, 2018 12:00:00 AM (GMT) -// TODO: Remove me once app alpha / release candidates are done -export const APP_ALPHA_EXPIRATION = 1532476800000; - // Displays at the top of the site, make message empty string to remove. // Type can be primary, warning, danger, success, info, or blank for grey. // Message must be a JSX element if you want to use HTML. diff --git a/common/containers/TabSection/ElectronTemplate.tsx b/common/containers/TabSection/ElectronTemplate.tsx index a4884999..936d12b1 100644 --- a/common/containers/TabSection/ElectronTemplate.tsx +++ b/common/containers/TabSection/ElectronTemplate.tsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { AppState } from 'features/reducers'; import { getOffline } from 'features/config'; -import { ElectronNav, AppAlphaNotice } from 'components'; +import { ElectronNav } from 'components'; import OfflineTab from './OfflineTab'; import Notifications from './Notifications'; import './ElectronTemplate.scss'; @@ -33,7 +33,6 @@ class ElectronTemplate extends Component { {isUnavailableOffline && isOffline ? : children}
-