dnsvalidator icon indicating copy to clipboard operation
dnsvalidator copied to clipboard

Baseline check only saves last returned IP for the last baseline resolver

Open amalmurali47 opened this issue 6 years ago • 1 comments

The goodip comparison isn't working as expected here: https://github.com/vortexau/dnsvalidator/blob/b55b6f0930102f03c95c58c552d4eec64c30154a/dnsvalidator/dnsvalidator.py#L95

The reason is because goodip is getting overwritten in the loop:

https://github.com/vortexau/dnsvalidator/blob/b55b6f0930102f03c95c58c552d4eec64c30154a/dnsvalidator/dnsvalidator.py#L126-L128

It would essentially mean that goodip value will have the last IP address of the root domain for the last resolver.

Ideally, I'd suggest avoiding the use of global variables. It makes the flow of the code a bit confusing and could potentially cause problems down the road.

Another improvement would be to restructure the code so that program fails if the baseline resolvers produce different results. The goodip, nxdomain status, poison checks happen for all baseline resolvers - if they all produce the same results, program should continue. If not, exit with a fatal error. This will also avoid the need for comparing the results of individual resolvers with that of all the three baseline resolvers - they're all the same, so only one of them needs to be checked.

amalmurali47 avatar Sep 18 '19 10:09 amalmurali47

Thank you for your submission! It does look like an issue as discussed, we'll investigate further and push a fix.

vortexau avatar Sep 18 '19 11:09 vortexau