Skip to content

Conversation

@omoerbeek
Copy link
Member

@omoerbeek omoerbeek commented Jan 15, 2026

Short description

While working on this I noticed a bug in the condition evaluation, which I fixed in the: Fix case where there are ot conditions, but none matches commit.

I also noticed that Zones use quoted-printable encoding for ids (a slash becomes =2F). I found that strange as, one would expect to see URL encoded values (a slash becomes %2F). Note that quoted-printable encoding is NOT safe to use in the parameter part of a URL. While we do not use query parameters like that in this code, I decided that using URL encoding would be both safe and expected. So encoding a subnet 1.2.3.0/24 (OT Trace Conditions are keyed by subnet) looks like: /api/v1/servers/localhost/ottraceconditions/1.2.3.0%2F24.

@Habbie @zeha Do you agree? I's too late to change the encoding for zone ids now, but IMO we should do the right thing for new functionality.

Update: reworked to code, tests and docs to use ip/prefixlen for subnets as two path components, as auth does.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
@zeha
Copy link
Collaborator

zeha commented Jan 15, 2026

I explicitly picked something else than URL-encoded, to prevent the common failure where %2F gets turned into a /, breaking domains with a / in them.

@coveralls
Copy link

coveralls commented Jan 15, 2026

Pull Request Test Coverage Report for Build 21241657418

Details

  • 10 of 169 (5.92%) changed or added relevant lines in 5 files are covered.
  • 33 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.04%) to 71.512%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/recursordist/rec_channel_rec.cc 2 5 40.0%
pdns/dnsname.hh 0 8 0.0%
pdns/recursordist/ws-recursor.cc 0 148 0.0%
Files with Coverage Reduction New Missed Lines %
modules/lmdbbackend/lmdbbackend.cc 2 72.77%
modules/pipebackend/pipebackend.cc 2 60.79%
pdns/recursordist/negcache.hh 2 88.0%
pdns/remote_logger.cc 3 58.97%
pdns/packethandler.cc 4 72.87%
pdns/recursordist/test-syncres_cc1.cc 7 80.43%
pdns/recursordist/syncres.cc 13 81.08%
Totals Coverage Status
Change from base Build 21239844347: -0.04%
Covered Lines: 128795
Relevant Lines: 165221

💛 - Coveralls

@omoerbeek
Copy link
Member Author

I explicitly picked something else than URL-encoded, to prevent the common failure where %2F gets turned into a /, breaking domains with a / in them.

Thanks, we also discussed this internally and I understand the reasoning now. Will adapt the code and docs.

@zeha
Copy link
Collaborator

zeha commented Jan 15, 2026

(In parameters you can/should still URL-encode the zoneid, so i doubt it matters?)

@omoerbeek
Copy link
Member Author

Setting to draft while reworking the subnet handling to use ip/prefixlen as path components, as auth does.

@omoerbeek omoerbeek marked this pull request as draft January 15, 2026 11:54
…auth does

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
@omoerbeek omoerbeek marked this pull request as ready for review January 15, 2026 12:15
@omoerbeek omoerbeek requested a review from pieterlexis January 20, 2026 14:42
Co-authored-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
omoerbeek and others added 2 commits January 22, 2026 09:34
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Co-authored-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
@omoerbeek omoerbeek requested a review from miodvallat January 22, 2026 10:16
Copy link
Contributor

@miodvallat miodvallat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@omoerbeek omoerbeek merged commit f36af1e into PowerDNS:master Jan 22, 2026
91 checks passed
@omoerbeek omoerbeek deleted the rec-ottrace-rest branch January 22, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants