fix: Update CNAME validation logic when creating DNS resource records
This corrects the CNAME validation logic when attempting to add resource records to domains and subdomains.
- Ensures the conflict check applies only to the domain where the record is being added
- Looks for conflicts ONLY for the exact hostname match, to be compliant with RFC 1034 and RFC 2181
Impact and risks
Low: This is a non-breaking change that adds functionality in a backwards-compatible manner.
Changes
- Updates CNAME conflict validation logic when creating resource records
Deployment
- Database migrations: No
- Configuration changes: No
- Other dependencies: No
Testing notes
Attempt to create DNS records, specifically:
- Create A, AAA and TXT records at
test.abc123in theampr.org. They should all succeed - Attempt to create a CNAME at
test.abc123. It should be blocked. - Create a CNAME at
ctest.abc123 - Attempt to create other record types at the same hostname (
ctest.abc123). They should be blocked. - Create a TXT at
_acme-challenge.ctest.abc123. It should be allowed. - Create an A record at
test.test.abc123(assuming thetest.abc123A record still exists). It should succeed.
Checklist
-
Tested locally -
Updated documentation as needed -
Linked to issue if applicable
Edited by Zachary Seguin