Skip to content

Commit c453e5e

Browse files
committed
feat(admin-ui): add webhook url regex validation #1704
1 parent 0b8221e commit c453e5e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

admin-ui/plugins/admin/components/Webhook/WebhookURLChecker.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ export const isValid = (url) => {
33
if (url === undefined || url === null || !isAllowed(url)) {
44
return false;
55
} else {
6-
const pattern = new RegExp(
7-
'^(https?:\\/\\/)?' + // protocol
6+
const exp = '^(https?:\\/\\/)?' + // protocol
87
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
98
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
109
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
1110
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
12-
'(\\#[-a-z\\d_]*)?$', // fragment locator
13-
'i'
14-
);
11+
'(\\#[-a-z\\d_]*)?$';
12+
const pattern = new RegExp(exp, 'i');
1513
return pattern.test(url)
1614
}
1715
}

0 commit comments

Comments
 (0)