vault icon indicating copy to clipboard operation
vault copied to clipboard

WEB UI fails to list secrets when the path contains a % character

Open AjmalH-G opened this issue 5 years ago • 1 comments

Describe the bug the web UI fails to list secrets when a component of the path contains a % character

To Reproduce

  1. Create a secret with a % character on the title, whether web UI or CLI. eg. 'Test %1'
  2. Login on ther web UI
  3. Select Secret 'Test %1' from the list
  4. Got 404 error

I've noticed the URL is well encoded : http://localhost:8200/ui/vault/secrets/secret/show/Test %251

Expected behavior

The secret is correctly shown in the web UI.

Environment:

  • Vault Server Version: 1.7.1
  • Vault CLI Version: 1.7.1
  • Server Operating System/Architecture: CentOS 8

Additional context The secert is displayed via CLI. The secret is listed : http://localhost:8200/ui/vault/secrets/secret/list

AjmalH-G avatar May 16 '21 12:05 AjmalH-G

This is caused by normalizePath() from route-recognizer package which will not revert escaped % character. This causes the % character to be escaped for the 2nd time later in the code. Should we just use the decodeURIComponent() instead?

See:

https://github.com/hashicorp/vault/blob/de13b64143f8824d0c2b7f61a731fbd00146388c/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js#L14

https://github.com/hashicorp/vault/blob/de13b64143f8824d0c2b7f61a731fbd00146388c/ui/app/utils/path-encoding-helpers.js#L16

balent avatar Jul 03 '21 00:07 balent