From 000517acec8cfbb33909a65cbaa0c0de3518931b Mon Sep 17 00:00:00 2001 From: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:03:15 +0000 Subject: [PATCH] backport of commit 8f36d0daa4cb9c35a2f6108af2e3ef9bf2d8d307 --- changelog/19216.txt | 3 +++ ui/app/models/mount-config.js | 7 +++++++ ui/app/models/secret-engine.js | 14 ++++++++------ .../vault/cluster/secrets/backend/list.hbs | 9 ++++----- ui/lib/core/addon/helpers/options-for-backend.js | 7 ++++--- .../settings/mount-secret-backend-test.js | 8 ++++---- ui/tests/unit/models/secret-engine-test.js | 10 +++++----- 7 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 changelog/19216.txt diff --git a/changelog/19216.txt b/changelog/19216.txt new file mode 100644 index 000000000000..e03e866e08b4 --- /dev/null +++ b/changelog/19216.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: adds allowed_response_headers as param for secret engine mount config +``` diff --git a/ui/app/models/mount-config.js b/ui/app/models/mount-config.js index 7ef0a9567d42..edc624c2fae4 100644 --- a/ui/app/models/mount-config.js +++ b/ui/app/models/mount-config.js @@ -42,6 +42,13 @@ export default class MountConfigModel extends Model { }) passthroughRequestHeaders; + @attr({ + label: 'Allowed response headers', + helpText: 'Headers to allow, allowing a plugin to include them in the response.', + editType: 'stringArray', + }) + allowedResponseHeaders; + @attr('string', { label: 'Token Type', helpText: diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js index 640296c8f873..b0251c46a32b 100644 --- a/ui/app/models/secret-engine.js +++ b/ui/app/models/secret-engine.js @@ -83,7 +83,9 @@ export default SecretEngineModel.extend({ const fields = ['type', 'path', 'description', 'accessor', 'local', 'sealWrap']; // no ttl options for keymgmt const ttl = type !== 'keymgmt' ? 'defaultLeaseTtl,maxLeaseTtl,' : ''; - fields.push(`config.{${ttl}auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`); + fields.push( + `config.{${ttl}auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}` + ); if (type === 'kv' || type === 'generic') { fields.push('version'); } @@ -105,14 +107,14 @@ export default SecretEngineModel.extend({ optionFields = [ 'version', ...CORE_OPTIONS, - `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`, + `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}`, ]; break; case 'generic': optionFields = [ 'version', ...CORE_OPTIONS, - `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`, + `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}`, ]; break; case 'database': @@ -120,21 +122,21 @@ export default SecretEngineModel.extend({ defaultFields = ['path', 'config.{defaultLeaseTtl}', 'config.{maxLeaseTtl}']; optionFields = [ ...CORE_OPTIONS, - 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}', + 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}', ]; break; case 'keymgmt': // no ttl options for keymgmt optionFields = [ ...CORE_OPTIONS, - 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}', + 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}', ]; break; default: defaultFields = ['path']; optionFields = [ ...CORE_OPTIONS, - `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`, + `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders,allowedResponseHeaders}`, ]; break; } diff --git a/ui/app/templates/vault/cluster/secrets/backend/list.hbs b/ui/app/templates/vault/cluster/secrets/backend/list.hbs index 90768826e79f..e4e314f94da8 100644 --- a/ui/app/templates/vault/cluster/secrets/backend/list.hbs +++ b/ui/app/templates/vault/cluster/secrets/backend/list.hbs @@ -129,10 +129,7 @@ {{else}} {{#if (eq this.baseKey.id "")}} {{#if (and options.firstStep (not this.tab))}} - +