thomasDOTwtf / PowerDNS-Admin

PowerDNS Web-GUI - Built by Flask
MIT License
19 stars 5 forks source link

Uppercase letters in domain names can cause issues #15

Open MedicMomcilo opened 6 years ago

MedicMomcilo commented 6 years ago

Even though the domain names are case insensitive, database may contain values which contain uppercase letters. This is not being handled in PowerDNS Admin interface right now.

Displaying such zone would cause all records to also have zone name in the record (instead of '@'). Stripping fails due to records not being uppercase, while zone is. If you change and commit those records to PowerDNS it would then append zone name again to the records.

Example zone:

www  CNAME  Active  3600  example.com
@  A  Active  3600  127.0.0.1

When it is in database noted as 'Example.com' instead of 'example.com' it would be displayed like this:

www.example.com  CNAME  Active  3600  example.com
example.com  A  Active  3600  127.0.0.1

After adding record and refreshing domain names would get corrupted:

www.example.com.example.com  CNAME  Active  3600  example.com
example.com.example.com  A  Active  3600  127.0.0.1
new.example.com  A  Active  3600  127.0.0.1

This should be easily fixed by first converting zone name to lowercase on stripping. Even though it is not expected to have zones in uppercase in the database, I think interface should not corrupt the zone if it appears.

thomasDOTwtf commented 6 years ago

Hey, does the issue occour on lower case only domain names too?

MedicMomcilo commented 6 years ago

Hey Thomas,

The issue is, if database contains domains with uppercases, this will not be handled correctly in PowerDNS Admin.

Most likely fix is to convert everything to lowercase prior to actually parsing and constructing the UI.

Please let me know if this doesn't clarify the problem.

Kind regards, Momo.

thomasDOTwtf commented 6 years ago

Hi, I've tried to reproduce the issue. Steps I've done:

  1. Create new Domain "Test.com"
  2. Manage Domain and add A-record test1 -> 1.1.1.1
  3. Save and Apply Changes
  4. Refresh Domain (F5)

My new a-record is not suffixed by test.com. Am I doing right reproducing the issue? Which pdns-version do you use?