Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 101684
Status: rejected
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: johnpc [...] xs4all.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::DNS better verification... bug/feature?
Date: Fri, 23 Jan 2015 00:42:54 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Jan-Pieter Cornet <johnpc [...] xs4all.net>
Hi, Not sure if it's considered a bug or a feature that Net::DNS silently ignores several input errors. At XS4ALL, we are trying to use it for input verification, but it's currently ignoring most errors. I've attached a patch that adds input verification for A and AAAA records, and that makes sure additional tokens aren't being ignored. As an example, the following records are currently (Net::DNS 0.82) parsed without any warning: $ perl -MNet::DNS -wnle 'Net::DNS::RR->new($_)' x A 1.2.3.4 5 x A 1.2.3.4.5 x AAAA ::1::2 ^D Note that the patch to detect unprocessed tokens in Net::DNS::RR sub _new_string is ugly, but this is just a quick first pass. It's probably better to change every sub parse_rdata in each Net::DNS::RR::* subclass, and end it with something like: @_ and die "Extra tokens @_ for " . $self->name() . " " . $self->type(); This will break backward compatibility for those who are currently relying on the fact that Net::DNS silently ignores most errors. Not sure if anyone does that, on purpose. Also, the test cases in t/05-AAAA.t had some illegal IPv6 addresses in the last block (stuff like "1:"). I've removed all IPv6 addresses that libc inet_pton() doesn't parse, as those are all rejected by the new Net::DNS::RR::AAAA. Likewise, IPv4 addresses such as 1.258 are rejected because the previous Net::DNS::RR::A implementation parsed those differently than libc did (libc turns it into 1.0.1.2, while Net::DNS::RR::A turns it into 1.0.0.2, truncating the high bits off of the 258). If you believe that this feature is beneficial, I'm willing to invest some more time in verification of other resource records, or at least the most common ones. Also if you think this might be a good thing but in a slightly different way, let me know and I can submit a modified patch. (Should there be a full-backward-compatibility switch?) Best regards, -- Jan-Pieter Cornet <johnpc@xs4all.net> Systeembeheer XS4ALL Internet bv www.xs4all.nl

Message body is not shown because sender requested not to inline it.

Download signature.asc
application/pgp-signature 971b

Message body not shown because it is not plain text.

From: rwfranks [...] acm.org
On Thu Jan 22 18:43:16 2015, johnpc@xs4all.net wrote: Show quoted text
> Hi, > > Not sure if it's considered a bug or a feature that Net::DNS silently > ignores several input errors. At XS4ALL, we are trying to use it for > input verification, but it's currently ignoring most errors. >
Net::DNS is a DNS resolver _not_ a syntax checker. It is a library component designed to provide DNS capability to other applications. The responsibility for ensuring the integrity of its own DNS record data lies with the application itself and cannot simply be shipped out to Net::DNS. Syntax checking to the extent that you seem to think desirable would load an intolerable performance burden onto applications which are either not exposed to unreliable DNS data or have already incurred the computational cost of proper input validation.
Subject: Re: [rt.cpan.org #101684] Net::DNS better verification... bug/feature?
Date: Fri, 30 Jan 2015 13:59:43 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Jan-Pieter Cornet <johnpc [...] xs4all.net>
On 2015-1-30 2:44 , Dick Franks via RT wrote: Show quoted text
>> Not sure if it's considered a bug or a feature that Net::DNS silently >> ignores several input errors. At XS4ALL, we are trying to use it for >> input verification, but it's currently ignoring most errors.
> > Net::DNS is a DNS resolver _not_ a syntax checker. > > It is a library component designed to provide DNS capability to other applications. The responsibility for ensuring the integrity of its own DNS record data lies with the application itself and cannot simply be shipped out to Net::DNS. > > Syntax checking to the extent that you seem to think desirable would load an intolerable performance burden onto applications which are either not exposed to unreliable DNS data or have already incurred the computational cost of proper input validation.
Fair enough. I'll move our syntax checking elsewhere. You can close this ticket. -- Jan-Pieter Cornet <johnpc@xs4all.net> Systeembeheer XS4ALL Internet bv www.xs4all.nl
Download signature.asc
application/pgp-signature 971b

Message body not shown because it is not plain text.

Rejecting because of backwards compatibility issues, though thanks for bringing this up. I do feel we could and should do something to raise awareness of the lenient nature of presentation format parsing of Net::DNS.