Non breaking space in Key Name
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
A "Non-breaking space" (`U+00A0`) in the key name throws an error in `v1.12.3.`
The "classic" withe space (`U+0020`) works well.
In `v0.8.3` this character could have been used, so now we are dealing with cases where keys have been created with this special char, an export was made and when importing such export we hit the below `Unexpected response code: 400 ` error.
#### Reproduction Steps
To reproduce, try to create a new key with value `consul kv put "keyName WithNBSP"`, which contains the "Non-breaking space" (U+00A0) in the key:
v1.12.3:
```
[consul@consul-v1.12.3 /]$ consul -v
Consul v1.12.3
[consul@consul-v1.12.3 /]$ consul kv put "keyName WithWhitespace"
Success! Data written to: keyName WithWhitespace
[consul@consul-v1.12.3 /]$ consul kv put "keyName WithNBSP"
Error! Failed writing data: Unexpected response code: 400 ()
[consul@consul-v1.12.3 /]$
```
v0.8.3
```
[consul@consul-debug /]$ consul -v
Consul v0.8.3
[consul@consul-debug /]$ consul kv put "keyName WithWhitespace"
Success! Data written to: keyName WithWhitespace
[consul@consul-debug /]$ consul kv put "keyName WithNBSP"
Success! Data written to: keyName WithNBSP
[consul@consul-debug /]$ consul kv get "keyName WithNBSP"
[consul@consul-debug /]$
```
### Consul info for Server
Server info
```
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease =
revision = 2308c75e
version = 1.12.3
version_metadata =
consul:
acl = disabled
bootstrap = false
known_datacenters = 1
leader = true
leader_addr = 127.0.0.1:8300
server = true
raft:
applied_index = 29013
commit_index = 29013
fsm_pending = 0
last_contact = 0
last_log_index = 29013
last_log_term = 2
last_snapshot_index = 18213
last_snapshot_term = 2
latest_configuration = [{Suffrage:Voter ID:fd361b64-671b-dfc5-00b4-1ffdce47ce8d Address:127.0.0.1:8300}]
latest_configuration_index = 0
num_peers = 0
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Leader
term = 2
runtime:
arch = amd64
cpu_count = 8
goroutines = 106
max_procs = 8
os = linux
version = go1.18.1
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 1
event_time = 2
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1```
### Operating system and Environment details
OS, Architecture, and any other information you can provide about the environment.
### Log Fragments
Include appropriate Client or Server log fragments. If the log is longer than a few dozen lines, please include the URL to the [gist](https://gist.github.com/) of the log instead of posting it in the issue. Use `-log-level=TRACE` on the client and server to capture the maximum log detail.
### Operating system and Environment details
"Red Hat Enterprise Linux 8.6 (Ootpa)"
Contributor guide
Research direction
Start with the `consul kv put` and `consul kv get` entry points and reproduce the difference between U+0020 and U+00A0 in v1.12.3. Trace how KV key names are handled during the request, then compare the behavior with v0.8.3. Done means keys containing a non-breaking space can be written and imported without the HTTP 400 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100