Bug 1619071 - Trip Canary heuristic when canonical lookup contains only local addresses. r=necko-reviewers,valentin

This allows certain routers to signal us to disable DoH when they are not capable of
responding with NXDOMAIN or no A records.

Differential Revision: https://phabricator.services.mozilla.com/D127538
This commit is contained in:
Nihanth Subramanya 2021-10-06 19:06:07 +00:00
Родитель 2a647010dd
Коммит f56119bc09
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -186,7 +186,13 @@ async function dnsListLookup(domainList) {
async function globalCanary() {
let { addresses, err } = await dnsLookup(GLOBAL_CANARY);
if (err === NXDOMAIN_ERR || !addresses.length) {
if (
err === NXDOMAIN_ERR ||
!addresses.length ||
addresses.every(addr =>
Services.io.hostnameIsLocalIPAddress(Services.io.newURI(`http://${addr}`))
)
) {
return "disable_doh";
}