Fix custom prefixes unduly assigning trust to external lists

Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/issues/3843#issuecomment-3475894380
This commit is contained in:
Raymond Hill 2025-11-01 13:00:05 -04:00
parent 5639b43731
commit b5f74456a4
No known key found for this signature in database
GPG key ID: F5630CAE62A14316

View file

@ -433,7 +433,10 @@ onBroadcast(msg => {
}
}).filter(prefix => prefix !== undefined);
}
const match = /^[a-z-]+:\/\/[^/]+\//.exec(assetKey);
const assetOrigin = match && match[0];
for ( const prefix of this.parsedTrustedListPrefixes ) {
if ( assetOrigin && prefix.length < assetOrigin.length ) { continue; }
if ( assetKey.startsWith(prefix) ) { return true; }
}
return false;