1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Hardening clipboardData handling in EnsInput (#11822)

This commit is contained in:
ryanml 2021-08-12 15:30:07 -07:00 committed by GitHub
parent e0692db7ba
commit 428b86fcf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,15 +36,18 @@ export default class EnsInput extends Component {
} }
onPaste = (event) => { onPaste = (event) => {
event.clipboardData.items[0].getAsString((text) => { if (event.clipboardData.items?.length) {
const input = text.trim(); const clipboardItem = event.clipboardData.items[0];
if ( clipboardItem?.getAsString((text) => {
!isBurnAddress(input) && const input = text.trim();
isValidHexAddress(input, { mixedCaseUseChecksum: true }) if (
) { !isBurnAddress(input) &&
this.props.onPaste(input); isValidHexAddress(input, { mixedCaseUseChecksum: true })
} ) {
}); this.props.onPaste(input);
}
});
}
}; };
onChange = ({ target: { value } }) => { onChange = ({ target: { value } }) => {