vault icon indicating copy to clipboard operation
vault copied to clipboard

Json secrets not being displayed on UI when a value is null

Open CodeLover254 opened this issue 9 months ago • 1 comments

Describe the bug On Vault 1.16.2 display of json secrets breaks when a value in the json object is null. On inspection of the console, I realized that the javascript code was failing with the error. Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys ()

To Reproduce Steps to reproduce the behavior:

  1. Create a kv secret engine then press the add secret button.
  2. Toggle the json switch to on, give your secret a name and inside the text area add the following json
{
   "key":null,
}
  1. Click the save button. The secret should be saved but cannot be displayed on the //details?version=1 page as long as the json switch is toggled to on.

Expected behavior The json content should display in the details page regardless of a value in the json being null.

Environment:

  • Vault Server Version (retrieve with vault status): 1.16.2
  • Vault CLI Version (retrieve with vault version): Vault v1.16.2 (c6e4c2d4dc3b0d57791881b087c026e2f75a87cb)
  • Server Operating System/Architecture: Ubuntu 20.04 arm64

Vault server configuration file(s):

ui = true
disable_mlock = true

storage "raft" {
  path = "/opt/vault/data"
  node_id="node1"
}

api_addr = "http://127.0.0.1:8200"
cluster_addr="https://127.0.0.1:8201"

listener "tcp" {
  address = "127.0.0.1:8200"
  tls_disable = 1
}

CodeLover254 avatar Apr 30 '24 20:04 CodeLover254

Also reproduced on 1.16.1

timonych avatar May 01 '24 20:05 timonych

Fixed per the linked prs.

Monkeychip avatar May 20 '24 14:05 Monkeychip