Skip to content

Secret Copy JSON button does not copy to clipboard #31657

@cpotteck

Description

@cpotteck

Describe the bug
A clear and concise description of what the bug is.

Attempting to copy a kv v2 secret JSON using Copy > Copy JSON does not copy to clipboard

To Reproduce
Steps to reproduce the behavior:

  1.  docker run -it --rm -p 8200:8200 hashicorp/vault:1.21
    
  2. Open http://localhost:8200/, log in with root token
  3. Create a secret in the default kv v2 engine http://localhost:8200/ui/vault/secrets/secret/kv/create, e.g. with key: "foo", value: "bar"
  4. Open secret details tab, e.g. http://localhost:8200/ui/vault/secrets/secret/kv/test/details
  5. Clip on "Copy" dropdown > "Copy JSON"
  6. A green toast with "Success" "JSON Copied!" appears on the bottom right
  7. Secret is not copied to clipboard (trying to paste shows that nothing is in the clipboard)

Expected behavior

Note that the alternative method to copy the secret JSON works as expected to copy to clipboard:

  1. Toggle JSON view on secret details tab
  2. Click on clipboard icon in JSON view

The expected behavior happens when running with the latest 1.20.x release:

  1.  docker run -it --rm -p 8200:8200 hashicorp/vault:1.20
  2. Open http://localhost:8200/, log in with root token
  3. Create a secret in the default kv v2 engine http://localhost:8200/ui/vault/secrets/secret/kv/create, e.g. with key: "foo", value: "bar"
  4. Open secret details tab, e.g. http://localhost:8200/ui/vault/secrets/secret/kv/test/details
  5. Clip on "Copy" dropdown > "Copy JSON"
  6. A green toast with "Success JSON Copied!" appears on the bottom right
  7. Secret is actually copied to clipboard

Environment:

  • Vault Server Version (retrieve with vault status): 1.21.1
  • Vault CLI Version (retrieve with vault version): v1.20.4
  • Server Operating System/Architecture: Reproduced on Mac M1, MacOS 15, Edge browser

Vault server configuration file(s):

This is reproducible with hashicorp/vault:1.21 without additional configuration.

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUsed to indicate a potential bugui

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions