Skip to content

Commit 97fd171

Browse files
authored
More validation for potential faulty user.js engines (#2069)
* Prevent new local minified source in `@updateURL` Post #944 Auto-merge
1 parent fff91fd commit 97fd171

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

libs/scriptStorage.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,13 @@ function invalidKey(aAuthorName, aScriptName, aIsLib, aKeyName, aKeyValue) { //
331331
// NOTE: value needs to be decoded already since MongoDB and AWS doesn't store that
332332
matches = keyValueUtf.match(rAnyLocalMetaUrl);
333333
if (matches) {
334-
if (cleanFilename(aAuthorName, '').toLowerCase() +
334+
if (/\.min$/.test(matches[2])) {
335+
return new statusError({
336+
message: '`@' + aKeyName +
337+
'` must not be a minified URL.',
338+
code: 403 // Forbidden
339+
});
340+
} else if (cleanFilename(aAuthorName, '').toLowerCase() +
335341
'/' + cleanFilename(aScriptName, '') ===
336342
matches[1].toLowerCase() + '/' + matches[2]) {
337343
// Same script

0 commit comments

Comments
 (0)