-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using vertical bar in node name messes up consul members pretty output #3951
Comments
Interesting! We may need to filter or validate from the input or output here to avoid this. I'm going to tag this as a bug, and as a "good first issue" as we would happily accept a PR. I am also adding the security tag as there could be a way to craft output here that is related. |
For pretty-printing, the column values are first appended with | Link. The string split and formatted with the columnize library, which uses strings.split function. I tried to escape the character | with \| and | in strings.split but it doesn't seem to work.
|
@shireeshaBongarala It would be great if you could submit a PR here. There a two options we would suggest:
The second option is preferable to the first since it would avoid using delimiters altogether. However, it is a larger commitment so feel free to start wherever you feel comfortable. Looking forward to your contributions to Consul and let me know if you have any other questions! |
@surferL We suggest using the characters As specified in RFC-952 and RFC-1123, hostnames should only include ASCII letters Using invalid characters and whitespaces prevents that node from being discovered via DNS (though it can still be discovered via the HTTP API). |
When node name contains vertical bar symbol `consul member` output is garbled because `|` is used as a delimiter in `columnize.SimpleFormat`. This commit changes format string to use `|##|` as a delimiter and also adds test to cover this case. Fixes hashicorp#3951.
When node name contains vertical bar symbol some commands output is garbled because `|` is used as a delimiter in `columnize.SimpleFormat`. This commit changes format string to use `\x1f` - ASCII unit separator[1] as a delimiter and also adds test to cover this case. Affected commands: * `consul catalog nodes` * `consul members` * `consul operator raft list-peers` * `consul intention get` Fixes hashicorp#3951. [1]: https://en.wikipedia.org/wiki/Delimiter#Solutions
When node name contains vertical bar symbol some commands output is garbled because `|` is used as a delimiter in `columnize.SimpleFormat`. This commit changes format string to use `\x1f` - ASCII unit separator[1] as a delimiter and also adds test to cover this case. Affected commands: * `consul catalog nodes` * `consul members` * `consul operator raft list-peers` * `consul intention get` Fixes #3951. [1]: https://en.wikipedia.org/wiki/Delimiter#Solutions
When node name contains vertical bar symbol some commands output is garbled because `|` is used as a delimiter in `columnize.SimpleFormat`. This commit changes format string to use `\x1f` - ASCII unit separator[1] as a delimiter and also adds test to cover this case. Affected commands: * `consul catalog nodes` * `consul members` * `consul operator raft list-peers` * `consul intention get` Fixes #3951. [1]: https://en.wikipedia.org/wiki/Delimiter#Solutions
Description of the Issue
Created consul agent with node name:
test | 2D33AE
(everything works fine), but when runningconsul members
, the2D33AE
is pushed into theAddress
Column, and everything else is shifted one a long.EG:
consul version
for both Client and ServerClient:
[1.0.6]
Server:
[1.0.6]
Operating system and Environment details
Tested on macOS 10.12 and Ubuntu 16.04
The text was updated successfully, but these errors were encountered: