Skip to content

Commit

Permalink
Fix incomplete URL substring sanitization
Browse files Browse the repository at this point in the history
'cdn.jsdelivr.net' can be anywhere in the URL, and arbitrary hosts may come before or after it.
  • Loading branch information
etienneCharignon committed Dec 18, 2024
1 parent 2425c40 commit 6f5882a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tarteaucitron.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ var tarteaucitron = {

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

0 comments on commit 6f5882a

Please sign in to comment.