From feca115ef49074c795740a89467bc60acfbae92f Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 4 Jan 2021 09:32:52 -0700 Subject: [PATCH] Bug: Fix issue with double encoding on space in secret history route (#10596) * setup for concept it works, but probably not the best solution * add comment and remove console and test var * use normalize path higher up to fix issu * add test for bug that fixing * forgot a couple of changes * changelog --- changelog/10596.txt | 4 +++ .../vault/cluster/secrets/backend/versions.js | 4 ++- ui/app/templates/components/secret-edit.hbs | 3 +- ui/app/templates/components/secret-link.hbs | 2 ++ .../cluster/secrets/backend/versions.hbs | 1 + .../secrets/backend/kv/secret-test.js | 32 +++++++++++++++++-- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 changelog/10596.txt diff --git a/changelog/10596.txt b/changelog/10596.txt new file mode 100644 index 000000000..492f972bb --- /dev/null +++ b/changelog/10596.txt @@ -0,0 +1,4 @@ +```release-note:bug +ui: Fix bug that double encodes secret route when there are spaces in the path and makes you unable to view the version history. +``` + diff --git a/ui/app/routes/vault/cluster/secrets/backend/versions.js b/ui/app/routes/vault/cluster/secrets/backend/versions.js index da1d44097..7604ea952 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/versions.js +++ b/ui/app/routes/vault/cluster/secrets/backend/versions.js @@ -1,6 +1,7 @@ import Route from '@ember/routing/route'; import utils from 'vault/lib/key-utils'; import UnloadModelRoute from 'vault/mixins/unload-model-route'; +import { normalizePath } from 'vault/utils/path-encoding-helpers'; export default Route.extend(UnloadModelRoute, { templateName: 'vault/cluster/secrets/backend/versions', @@ -22,6 +23,7 @@ export default Route.extend(UnloadModelRoute, { model(params) { let { secret } = params; const { backend } = this.paramsFor('vault.cluster.secrets.backend'); - return this.store.queryRecord('secret-v2', { id: secret, backend }); + let id = normalizePath(secret); + return this.store.queryRecord('secret-v2', { id, backend }); }, }); diff --git a/ui/app/templates/components/secret-edit.hbs b/ui/app/templates/components/secret-edit.hbs index 9de3ec4d8..cefe55f43 100644 --- a/ui/app/templates/components/secret-edit.hbs +++ b/ui/app/templates/components/secret-edit.hbs @@ -45,7 +45,7 @@ as |D| > @@ -56,6 +56,7 @@