pdns icon indicating copy to clipboard operation
pdns copied to clipboard

SVCB: allow parsing keys in generic format without value

Open zeha opened this issue 7 months ago • 4 comments

Short description

To avoid other issues, increase strictness of value checks for known keys, regardless if they are in generic or canonical format.

Also add a test for key00NNN (= leading zeroes).

https://github.com/PowerDNS/pdns/issues/15479

Checklist

I have:

  • [x] read the CONTRIBUTING.md document
  • [x] compiled this code
  • [x] tested this code
  • [ ] included documentation (including possible behaviour changes)
  • [ ] documented the code
  • [ ] added or modified regression test(s)
  • [ ] added or modified unit test(s)
  • [ ] checked that this code was merged to master

zeha avatar May 27 '25 20:05 zeha

Pull Request Test Coverage Report for Build 16519017624

Details

  • 87 of 95 (91.58%) changed or added relevant lines in 3 files are covered.
  • 35 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+0.03%) to 65.854%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/rcpgenerator.cc 22 30 73.33%
<!-- Total: 87 95
Files with Coverage Reduction New Missed Lines %
pdns/recursordist/aggressive_nsec.cc 2 66.1%
pdns/iputils.cc 3 56.03%
pdns/recursordist/syncres.cc 3 81.23%
pdns/dnsdistdist/dnsdist-tcp.cc 4 77.14%
pdns/rcpgenerator.cc 4 90.19%
pdns/recursordist/rec-system-resolve.cc 19 45.92%
<!-- Total: 35
Totals Coverage Status
Change from base Build 16517016923: 0.03%
Covered Lines: 127927
Relevant Lines: 165693

💛 - Coveralls

coveralls avatar May 27 '25 21:05 coveralls

There's still a parsing issue that I need to debug.

zeha avatar May 28 '25 06:05 zeha

There's still a parsing issue that I need to debug.

Pushed some additional test cases and a fix for that.

zeha avatar May 28 '25 07:05 zeha

@miodvallat could you rereview?

zeha avatar Jun 10 '25 17:06 zeha

authpy tests found another thing I overlooked, fixed now

zeha avatar Jul 25 '25 09:07 zeha

Did not find anything wrongly rejected, or valid data parsed wrong, but I hope this is not hiding a bug. These parse identically:

1 foo.powerdns.org. ipv4hint=1.2.3.4 key2=port=123

This is very clearly a bug. Fixed that. I wish the if (d_pos != d_end && d_string.at(d_pos) == '=') { block could go away, but that will make the "with value" case unreadable.

zeha avatar Jul 29 '25 22:07 zeha

It's not that looking bad in the end.

miodvallat avatar Jul 30 '25 05:07 miodvallat