Skip to content

Commit 5cce5a3

Browse files
Fix incomplete URL substring sanitization
'cdn.jsdelivr.net' can be anywhere in the URL, and arbitrary hosts may come before or after it.
1 parent 9318763 commit 5cce5a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

public/pro/tarteaucitron/tarteaucitron.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ var tarteaucitron = {
204204

205205
var cdn = tarteaucitron.cdn,
206206
language = tarteaucitron.getLanguage(),
207-
useMinifiedJS = ((cdn.indexOf('cdn.jsdelivr.net') >= 0) || (tarteaucitronPath.indexOf('.min.') >= 0) || (tarteaucitronUseMin !== '')),
207+
useMinifiedJS = ((new URL(cdn).host == 'cdn.jsdelivr.net') || (tarteaucitronPath.indexOf('.min.') >= 0) || (tarteaucitronUseMin !== '')),
208208
pathToLang = cdn + 'lang/tarteaucitron.' + language + (useMinifiedJS ? '.min' : '') + '.js',
209209
pathToServices = cdn + 'tarteaucitron.services' + (useMinifiedJS ? '.min' : '') + '.js',
210210
linkElement = document.createElement('link'),

0 commit comments

Comments
 (0)