WEB UI fails to list secrets when the path contains a % character
Describe the bug the web UI fails to list secrets when a component of the path contains a % character
To Reproduce
- Create a secret with a % character on the title, whether web UI or CLI. eg. 'Test %1'
- Login on ther web UI
- Select Secret 'Test %1' from the list
- 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
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