aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/url-helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/url-helpers.js')
-rw-r--r--src/helpers/url-helpers.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/helpers/url-helpers.js b/src/helpers/url-helpers.js
new file mode 100644
index 000000000..750d1f00c
--- /dev/null
+++ b/src/helpers/url-helpers.js
@@ -0,0 +1,15 @@
1import { URL } from 'url';
2
3import { ALLOWED_PROTOCOLS } from '../config';
4
5const debug = require('debug')('Franz:Helpers:url');
6
7export function isValidExternalURL(url) {
8 const parsedUrl = new URL(url);
9
10 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol);
11
12 debug('protocol check is', isAllowed, 'for:', url);
13
14 return isAllowed;
15}