PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.67k stars 906 forks source link

A few metadata funnies in the API #11697

Open james-stevens opened 2 years ago

james-stevens commented 2 years ago

All this refers to the REST/API.

Environment

Other information

PERSONALLY, I think you should drop the whole "zone properties" charade, as only kind & the zone name are real zone properties, the rest are all implemented (in the database) as metadata values - therefore users SHOULD be allowed to address them, in the API, as the metadata they really are - instead you give the error message "Not a metadata item" when that's exactly that they really are !?!?!?!?

zeha commented 2 years ago

The "charade" as you describe it was built to avoid exactly the problems you describe. I.e. there is no point of assigning multiple values to SOA-EDIT, SOA-EDIT-API, etc., and the facade is intended to allow only valid settings. IIRC at some point this got relaxed, and now some metadata is visible as metadata and via the facade, leading to new problems.

james-stevens commented 2 years ago

But the protection you describe only works via the API - i.e. the protection can still be violated by direct SQL changes to METADATA

However, if the user is only updating the METADATA via the API, then all the protection you describe can still be applied via the METADATA update calls.

So I don't really buy this argument.

zeha commented 2 years ago

But the protection you describe only works via the API - i.e. the protection can still be violated by direct SQL changes to METADATA

Sure, but this is also true if you use a hex editor on your database files.

However, if the user is only updating the METADATA via the API, then all the protection you describe can still be applied via the METADATA update calls.

That makes for a very weird API.

james-stevens commented 2 years ago

That makes for a very weird API

That ship already sailed - with some METADATA addressed as real METADATA and some as fake zone properties, as well as having some real zone properties.

RRs are validated when submitted via the API - I don't see how validating METADATA is any different.

In fact I'd say it's weird that you DON'T validate API submitted METADATA.

Are you really trying to argue that validating METADATA value, when submitted via the API, would be a bad idea? Its a case to be made, but not one I would support.

IMHO, having all METADATA treated as METADATA, and correctly validated, would be a simplification of what you currently have.