Skip to content

Commit 20001e7

Browse files
McSamMcSam
authored andcommitted
resolve xxs attack
1 parent 7c1084c commit 20001e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/indexPage/endpoint.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export default function endpoint() {
2020
$('#new_endpoint').click(addEndpoint);
2121
$('#reset').click(resetEndpoint);
2222

23+
$('#server_url').keyup(validateURL);
24+
2325
init();
2426
});
2527
return true;
@@ -64,10 +66,21 @@ function addEndpoint(e) {
6466
setStorage('config.server_url', serverUrl);
6567
setStorage('config.app_id', appId);
6668

69+
const UrlReg = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/;
70+
71+
if (!UrlReg.test(serverUrl)) {
72+
$('#error')
73+
.html('Please enter a valid server URL')
74+
.show();
75+
return;
76+
}
77+
6778
checkConnection(appId, serverUrl);
6879
}
6980

7081
function resetEndpoint() {
7182
setStorage('config.app_id', getDefaultEndpoint().appId);
7283
setStorage('config.server_url', getDefaultEndpoint().url);
7384
}
85+
86+
const validateURL = e => {};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy