Bug 1937712

Summary: Designate DNS – create TLD using valid Unicode string
Product: Red Hat OpenStack Reporter: Arkady Shtempler <ashtempl>
Component: openstack-designateAssignee: Nate Johnston <njohnston>
Status: CLOSED WONTFIX QA Contact: Toni Freger <tfreger>
Severity: medium Docs Contact:
Priority: low    
Version: 17.0 (Wallaby)CC: beagles, gthiemon, michjohn, njohnston, scohen
Target Milestone: betaKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-01 14:38:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Arkady Shtempler 2021-03-11 12:02:33 UTC
Scenario:
Try to create a new TLD using unicode string, for example: “例え”

Actual Result:
API fails with: 
Details: {'code': 400, 'type': 'invalid_object', 'message': 'Provided object is not valid. Got a ValueError error with message \u4f8b\u3048 is not an TLD', 'request_id': 'req-fa7cb43e-a6e9-41f2-b878-1ced6a853a2a'}

Expected Result:
Should  pass 

Notes:
1) There is an tempest patch could be used to reproduce the scenario:
https://review.opendev.org/c/openstack/designate-tempest-plugin/+/779558

2) Documentation: https://docs.openstack.org/api-ref/dns/?expanded=get-the-name-servers-for-a-zone-detail,list-all-recordsets-owned-by-project-detail,create-zone-detail,create-tld-detail#create-tld

Comment 1 Michael Johnson 2021-03-12 20:32:48 UTC
The designate API is inconsistently accepting multi-byte strings.

For example, the string above can be used for the TLD description, but not the TLD name even though it is a valid TLD.

The Designate objects are performing a regex on the input value here: https://opendev.org/openstack/designate/src/branch/master/designate/objects/fields.py#L293

With the regex here:
https://opendev.org/openstack/designate/src/branch/master/designate/objects/fields.py#L98

Making the assumption that the TLD will be ascii only.