External Service Registration containing an IP address with trailing space caracter.. is accepted.. and produces awkward DNS answers.
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
External Service Registration containing an IP address with a trailing space caracter.. is accepted.. and produces awkward DNS answer.
---
#### Reproduction Steps
Steps to reproduce this issue, eg:
1. Create a cluster with n client nodes n and n server nodes
2. Register a external service:
```
#!/bin/bash
curl -v -X PUT \
'http://127.0.0.1:8500/v1/agent/service/register' \
-H 'X-Consul-Token: YourTokenhere' \
-H 'cache-control: no-cache' \
-d '{
"name": "bugtest",
"tags": [
"anything"
],
"address": "172.22.129.191 ", ## SPACE caracter just after the IP address is important here.
"port": 443,
"meta": {
"bugtest": "1.0"
},
"EnableTagOverride": false
}'
```
3. request service with DNS query :
```
dig bugtest.redacted
; <<>> DiG 9.16.1-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 36442
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
bugtest.redacted. IN A
;; ANSWER SECTION:
bugtest.redacted. 5 IN CNAME 172.22.129.191\032.
```
### Consul info for both Client and Server
Consul version : 1.15.2
Not impacting Consul UI..., only DNS output.
Workaround: obviously remove the trailing space in Ipaddress field...
Contributor guide
Research direction
Start by reproducing the issue through the /v1/agent/service/register endpoint with the curl payload, then query the registered service with dig. Trace the registration and DNS response paths; done means a trailing-space IP address no longer produces the escaped-space CNAME shown in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100