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

Hotfix remove eth sign #5848

Merged
merged 10 commits into from
Mar 2, 2023
Prev Previous commit
Next Next commit
Added toggle switch in advanced settings to turn on/off eth_sign
BelfordZ authored and Gudahtt committed Mar 1, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 8d2103c4c0187130a9eb40b65bce04533f3674c7
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.17.3
32 changes: 32 additions & 0 deletions app/components/Views/Settings/AdvancedSettings/index.js
Original file line number Diff line number Diff line change
@@ -133,6 +133,10 @@ class AdvancedSettings extends PureComponent {
* Indicates whether hex data should be shown in transaction editor
*/
showHexData: PropTypes.bool,
/**
* Allow dapp api requests to eth_sign
*/
enableEthSign: PropTypes.bool,
/**
* Called to toggle show hex data
*/
@@ -292,6 +296,11 @@ class AdvancedSettings extends PureComponent {
PreferencesController.setIpfsGateway(ipfsGateway);
};

setEnableEthSign = (enabled) => {
const { PreferencesController } = Engine.context;
PreferencesController.setDisabledRpcMethodPreference('eth_sign', enabled);
};

toggleTokenDetection = (detectionStatus) => {
const { PreferencesController } = Engine.context;
PreferencesController.setUseTokenDetection(detectionStatus);
@@ -336,6 +345,7 @@ class AdvancedSettings extends PureComponent {
setShowHexData,
setShowCustomNonce,
ipfsGateway,
enableEthSign,
} = this.props;
const { resetModalVisible, onlineIpfsGateways } = this.state;
const { styles, colors } = this.getStyles();
@@ -424,6 +434,27 @@ class AdvancedSettings extends PureComponent {
/>
</View>
</View>
<View style={styles.setting}>
<Text style={styles.title}>
{strings('app_settings.enable_eth_sign')}
</Text>
<Text style={styles.desc}>
{strings('app_settings.enable_eth_sign_desc')}
</Text>
<View style={styles.marginTop}>
<Switch
value={enableEthSign}
onValueChange={this.setEnableEthSign}
trackColor={{
true: colors.primary.default,
false: colors.border.muted,
}}
thumbColor={importedColors.white}
style={styles.switch}
ios_backgroundColor={colors.border.muted}
/>
</View>
</View>
<View style={styles.setting}>
<Text style={styles.title}>
{strings('app_settings.show_custom_nonce')}
@@ -474,6 +505,7 @@ const mapStateToProps = (state) => ({
ipfsGateway: state.engine.backgroundState.PreferencesController.ipfsGateway,
showHexData: state.settings.showHexData,
showCustomNonce: state.settings.showCustomNonce,
enableEthSign: state.engine.backgroundState.PreferencesController.disabledRpcMethodPreferences['eth_sign'],
fullState: state,
isTokenDetectionEnabled:
state.engine.backgroundState.PreferencesController.useTokenDetection,
2 changes: 2 additions & 0 deletions locales/languages/en.json
Original file line number Diff line number Diff line change
@@ -555,6 +555,8 @@
"nft_autodetect_desc": "Displaying NFT media & data may expose your IP address to centralized servers. Third-party APIs (like OpenSea) are used to detect NFTs in your wallet. This exposes your account address with those services. Leave this disabled if you don't want the app to pull data from those services.",
"show_hex_data": "Show Hex Data",
"show_hex_data_desc": "Select this to show the hex data field on the send screen.",
"enable_eth_sign": "Toggle eth_sign requests",
"enable_eth_sign_desc": "Turn this on to let dapps request your signature using eth_sign requests. eth_sign is an open-ended signing method that lets you sign an arbitrary hash, making it a dangerous phishing risk. Only sign eth_sign requests if you can read what you are signing and trust the origin of the request.",
"show_custom_nonce": "Customize transaction nonce",
"custom_nonce_desc": "Turn this on to change the nonce (transaction number) on confirmation screens. This is an advanced feature, use cautiously.",
"accounts_identicon_title": "Account Identicon",