Vault UI console reading field of type array causes javascript to be printed
Describe the bug The Vault Web UI console presents a table of javascript and malformed array content when an array field is discretely read.
To Reproduce Steps to reproduce the behavior:
- Log into Vault Web UI
- Open Interactive Console
- Execute command
read -field=policies auth/token/lookup-self
Expected behavior An array or indexed list of assigned policies
Environment:
- Vault Server Version (retrieve with
vault status):
/ # vault status
Key Value
--- -----
Seal Type shamir
Sealed false
Total Shares 3
Threshold 2
Version 0.11.0
Cluster Name vault-cluster-79ef726b
Cluster ID afb09f0d-68b5-6d86-8126-cad50cc97bbf
HA Enabled true
HA Cluster https://172.31.0.239:8201
HA Mode active
/ #
- Vault CLI Version (retrieve with
vault version): N/A - Server Operating System/Architecture: CentOS 7.6, Kubernetes 1.11
Vault server configuration file(s):
storage "consul" {
address = "---:8443"
scheme = "https"
token = "---"
path = "vault/"
tls_ca_file = "/etc/vault-certs/ca.crt"
check_timeout = "30s"
disable_registration = "true"
}
disable_mlock=true
listener "tcp" {
address = "0.0.0.0:8200"
tls_cert_file = "/etc/vault-certs/vault.crt"
tls_key_file = "/etc/vault-certs/vault.key"
}
default_lease_ttl="1h"
max_lease_ttl="48h"
ui = true
Additional context
We've only encountered two array objects, both are policy lists. The active token mentioned above, and the group policy definition (e.g. read -field=policies "auth/ldap/groups/<groupname>")
Sample output:
read -field=policies auth/token/lookup-self
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Fmt W Loc Camelize Decamelize Dasherize Underscore Classify Capitalize HtmlSafe 17 18
a d - a c c o u n t s - o t h e r function(){var e,r,n function(){return(0,t.w)(this)} function(){var e,r,n function(){return(0,t.camelize)(this)} function(){return(0,t.decamelize)(this)} function(){return(0,t.dasherize)(this)} function(){return(0,t.underscore)(this)} function(){return(0,t.classify)(this)} function(){return(0,t.capitalize)(this)} function(){return(0,d.htmlSafe)(this)}
for(e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n] for(e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n]
return(0,t.fmt)(this,r)} return(0,t.loc)(this,r)}
a d - a c c o u n t s - s y s t e function(){var e,r,n function(){return(0,t.w)(this)} function(){var e,r,n function(){return(0,t.camelize)(this)} function(){return(0,t.decamelize)(this)} function(){return(0,t.dasherize)(this)} function(){return(0,t.underscore)(this)} function(){return(0,t.classify)(this)} function(){return(0,t.capitalize)(this)} function(){return(0,d.htmlSafe)(this)} m s
for(e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n] for(e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n]
return(0,t.fmt)(this,r)} return(0,t.loc)(this,r)}
Thanks for filing this! We'll look into it soon, but as a work around, if you add -format=json, you will get the correct output pretty-printed and syntax highlighted. So the whole command should be: read -field=policies -format=json auth/token/lookup-self