Skip to content

Commit 9adc9b4

Browse files
authored
Merge pull request #1381 from crypto-com/dev
Internal Release v1.4.4
2 parents b0f32a5 + b8ed35c commit 9adc9b4

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
*Unreleased*
66

77
*Released*
8+
## [v1.4.4] - 2023-09-21
9+
### Additions
10+
- Security enhancement on DApp Browser
811
## [v1.4.3] - 2023-09-13
912
### Bug Fixes
1013
- Fix malfunctioned Staking services

electron/main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Store from 'electron-store';
1212
import { APP_PROTOCOL_NAME } from '../src/config/StaticConfig';
1313

1414
import { getGAnalyticsCode, getUACode, actionEvent, transactionEvent, pageView } from './UsageAnalytics';
15+
import { isValidURL } from './utils';
1516

1617
remoteMain.initialize();
1718

@@ -192,6 +193,16 @@ app.on('ready', async function () {
192193
}
193194
});
194195

196+
app.on('web-contents-created', (event, contents) => {
197+
if (contents.getType() == 'webview') {
198+
contents.on('will-navigate', (event, url) => {
199+
if (!isValidURL(url)) {
200+
event.preventDefault();
201+
}
202+
})
203+
}
204+
})
205+
195206
ipcMain.handle('get_auto_update_expire_time', (event) => {
196207
return store.get('autoUpdateExpireTime');
197208
});

electron/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function isValidURL(str: string) {
2+
const regex = new RegExp(
3+
'^(http[s]?:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?', // lgtm [js/redos]
4+
);
5+
6+
const withoutPrefixRegex = new RegExp(
7+
'^([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?', // lgtm [js/redos]
8+
);
9+
return regex.test(str) || withoutPrefixRegex.test(str);
10+
}
11+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chain-desktop-wallet",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "Crypto.com DeFi Desktop Wallet App",
55
"repository": "github:crypto-com/chain-desktop-wallet",
66
"author": "Crypto.com <contact@crypto.com>",

0 commit comments

Comments
 (0)