From 942be7ede0efa859b5e20c488b2ffdabfc676952 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 12 Mar 2019 11:40:29 -0700 Subject: [PATCH 1/2] GDNS Provider - remove secret key param if null or empty string https://github.com/rancherlabs/rancher-security/issues/78 --- .../addon/global-dns/providers/new/controller.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/global-admin/addon/global-dns/providers/new/controller.js b/lib/global-admin/addon/global-dns/providers/new/controller.js index 02d4c8e76..95cfe9051 100644 --- a/lib/global-admin/addon/global-dns/providers/new/controller.js +++ b/lib/global-admin/addon/global-dns/providers/new/controller.js @@ -57,6 +57,19 @@ export default Controller.extend(ViewNewEdit, { } }), + validate() { + const providerConfig = get(this, `config.${ this.activeProvider }ProviderConfig`); + const { mode } = this; + + if (mode === 'edit' && providerConfig && providerConfig.hasOwnProperty('secretKey')) { + if (providerConfig.secretKey === '' || providerConfig.secretKey === null) { + delete providerConfig.secretKey; + } + } + + return this._super(...arguments); + }, + doneSaving() { this.send('cancel'); }, From 54d4b94c440094a9f66256b77c314c53d2f8c318 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 12 Mar 2019 12:21:49 -0700 Subject: [PATCH 2/2] clarify secret key not required on edit --- .../addon/templates/-alidns-dns-provider.hbs | 15 ++++++++++++++- .../addon/templates/-route53-dns-provider.hbs | 15 ++++++++++++++- translations/en-us.yaml | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/global-admin/addon/templates/-alidns-dns-provider.hbs b/lib/global-admin/addon/templates/-alidns-dns-provider.hbs index face30396..0c288aed5 100644 --- a/lib/global-admin/addon/templates/-alidns-dns-provider.hbs +++ b/lib/global-admin/addon/templates/-alidns-dns-provider.hbs @@ -45,7 +45,20 @@ class="acc-label" for="alidns-api-key" > - {{t "globalDnsPage.providersPage.config.secretKey.label"}}{{field-required}} + {{t "globalDnsPage.providersPage.config.secretKey.label"}} + {{#if (eq mode "edit")}} + {{#tooltip-element + type="tooltip-basic" + model=(t "globalDnsPage.providersPage.config.secretKey.info") + tooltipTemplate="tooltip-static" + aria-describedby="tooltip-base" + tooltipFor="tooltipSecretKey" + }} + + {{/tooltip-element}} + {{else}} + {{field-required}} + {{/if}} {{input classNames="form-control" diff --git a/lib/global-admin/addon/templates/-route53-dns-provider.hbs b/lib/global-admin/addon/templates/-route53-dns-provider.hbs index 1f39c403e..26fc5103a 100644 --- a/lib/global-admin/addon/templates/-route53-dns-provider.hbs +++ b/lib/global-admin/addon/templates/-route53-dns-provider.hbs @@ -45,7 +45,20 @@ class="acc-label" for="route53-secret-key" > - {{t "globalDnsPage.providersPage.config.secretKey.label"}}{{field-required}} + {{t "globalDnsPage.providersPage.config.secretKey.label"}} + {{#if (eq mode "edit")}} + {{#tooltip-element + type="tooltip-basic" + model=(t "globalDnsPage.providersPage.config.secretKey.info") + tooltipTemplate="tooltip-static" + aria-describedby="tooltip-base" + tooltipFor="tooltipSecretKey" + }} + + {{/tooltip-element}} + {{else}} + {{field-required}} + {{/if}} {{input classNames="form-control" diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 2c7d73053..0f571a411 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1176,6 +1176,7 @@ globalDnsPage: secretKey: label: Secret Key placeholder: Your secret key + info: Secret key already provided. It is only required when updating the keys themselves. apiEmail: label: API Email placeholder: Your API Email