Skip to content

Commit

Permalink
Merge pull request #1381 from crypto-com/dev
Browse files Browse the repository at this point in the history
Internal Release v1.4.4
  • Loading branch information
crypto-matto authored Sep 21, 2023
2 parents b0f32a5 + b8ed35c commit 9adc9b4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
*Unreleased*

*Released*
## [v1.4.4] - 2023-09-21
### Additions
- Security enhancement on DApp Browser
## [v1.4.3] - 2023-09-13
### Bug Fixes
- Fix malfunctioned Staking services
Expand Down
11 changes: 11 additions & 0 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Store from 'electron-store';
import { APP_PROTOCOL_NAME } from '../src/config/StaticConfig';

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

remoteMain.initialize();

Expand Down Expand Up @@ -192,6 +193,16 @@ app.on('ready', async function () {
}
});

app.on('web-contents-created', (event, contents) => {
if (contents.getType() == 'webview') {
contents.on('will-navigate', (event, url) => {
if (!isValidURL(url)) {
event.preventDefault();
}
})
}
})

ipcMain.handle('get_auto_update_expire_time', (event) => {
return store.get('autoUpdateExpireTime');
});
Expand Down
11 changes: 11 additions & 0 deletions electron/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export function isValidURL(str: string) {
const regex = new RegExp(
'^(http[s]?:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?', // lgtm [js/redos]
);

const withoutPrefixRegex = new RegExp(
'^([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?', // lgtm [js/redos]
);
return regex.test(str) || withoutPrefixRegex.test(str);
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chain-desktop-wallet",
"version": "1.4.3",
"version": "1.4.4",
"description": "Crypto.com DeFi Desktop Wallet App",
"repository": "github:crypto-com/chain-desktop-wallet",
"author": "Crypto.com <[email protected]>",
Expand Down

0 comments on commit 9adc9b4

Please sign in to comment.