From 3278d229e8db6b96e0f908a766bf0bb1feea7a4a Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 23 Jun 2021 11:58:48 -0400 Subject: [PATCH 01/14] chore: Update components in connect dialog to latest --- addons/core/translations/resources/en-us.yaml | 5 ++ .../scopes/scope/projects/targets.hbs | 62 +++++++++++++++++-- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 888cb980b..fc4fa2c65 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -147,6 +147,11 @@ session: description: No active sessions available to display yet. actions: connect: Connect + credential: + title: Credential + title_plural: Credentials + actions: + detail: Credential library details org: title: Org title_plural: Orgs diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index fb0d61f56..f4fb6811a 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -19,7 +19,8 @@ > <:body>

{{t 'resources.target.messages.proxy_url.title'}} - ({{t 'resources.target.types.tcp'}})

+ {{!-- ({{t 'resources.target.types.tcp'}}) --}} + ({{t 'resources.target.types.tcp'}})

- {{!-- + + + {{!-- TODO: Conditional for when credentials aren't available + older versions of cli --}} +

{{t 'resources.session.credential.title_plural'}}

+ + <:header> + + + <:key>{{t 'form.id.label'}} + <:value>cl_nbv9375hLHs + + + <:key>{{t 'form.name.label'}} + <:value>Key/Value + + + <:key>{{t 'form.description.label'}} + <:value>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ut nobis, nemo cum omnis saepe reprehenderit eaque non odit iste magni quod voluptatem soluta dolor beatae libero consequatur, perferendis rem molestias. + + + + <:body> + {{!-- TODO: Iterate through all credentials --}} + + + + Key + Value + + + + + foo + Value + + + ttl + Test + + + + + + {{!--

Credentials

@@ -94,13 +144,13 @@
- {{! - - }} + View sessions + --}}
From f0926cba870ef34c040225ef6433675c2287644c Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Wed, 23 Jun 2021 11:37:28 -0700 Subject: [PATCH 02/14] Change flex CSS in card header --- ui/desktop/app/styles/app.scss | 2 +- .../scopes/scope/projects/targets.hbs | 44 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 00313f9ea..5aa212672 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -422,7 +422,7 @@ $chevron-down: url("data:image/svg+xml;utf-8,{{t 'resources.session.credential.title_plural'}} <:header> - - - <:key>{{t 'form.id.label'}} - <:value>cl_nbv9375hLHs - - - <:key>{{t 'form.name.label'}} - <:value>Key/Value - - - <:key>{{t 'form.description.label'}} - <:value>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ut nobis, nemo cum omnis saepe reprehenderit eaque non odit iste magni quod voluptatem soluta dolor beatae libero consequatur, perferendis rem molestias. - + @dropdownRight={{true}} + as |dropdown| + > + + <:key>{{t 'form.id.label'}} + <:value>cl_nbv9375hLHs + + + <:key>{{t 'form.name.label'}} + <:value>Key/Value + + + <:key>{{t 'form.description.label'}} + <:value>Lorem ipsum dolor, sit amet consectetur adipisicing + elit. Ut nobis, nemo cum omnis saepe reprehenderit eaque + non odit iste magni quod voluptatem soluta dolor beatae + libero consequatur, perferendis rem molestias. + <:body> - {{!-- TODO: Iterate through all credentials --}} + {{! TODO: Iterate through all credentials }} @@ -144,13 +150,13 @@
- {{!-- View sessions - --}} + }}
From 1f20e2c40c787bdd345492d8100ff22ead444fe9 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Wed, 23 Jun 2021 11:55:15 -0700 Subject: [PATCH 03/14] Fix padding proportions --- ui/desktop/app/styles/app.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 5aa212672..7e2357988 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -423,7 +423,7 @@ $chevron-down: url("data:image/svg+xml;utf-8, session.addCredential(cred)); + } } catch(e) { this.confirm.confirm(e.message, { isConnectError: true }) // Retry diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index fb0d61f56..d9066001a 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -109,4 +109,4 @@ {{/each}} {{/each}} -{{outlet}} \ No newline at end of file +{{outlet}} From 48cc8596dcb5cd8710269fab795b6c563ab7febc Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Wed, 23 Jun 2021 13:48:51 -0700 Subject: [PATCH 05/14] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Finish=20up=20som?= =?UTF-8?q?e=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Finish up some styles. Deleted old commented code and add a temporary lint ignore comment for no-bare-strings in targets.hbs --- ui/desktop/app/styles/app.scss | 10 +++- .../scopes/scope/projects/targets.hbs | 57 ++----------------- 2 files changed, 13 insertions(+), 54 deletions(-) diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 7e2357988..4abf9c368 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -395,14 +395,20 @@ $chevron-down: url("data:image/svg+xml;utf-8, - - {{!-- - -

Credentials

- - - <:header> - - - - <:body> - - - - Key - Value - - - - - foo - Value - - - ttl - Test - - - - <:footer>
                     
-  {
-    "auth": null,
-    "lease_duration": 3600,
-    "lease_id": "",
-    "renewable": false
-  }
+                      { "auth": null, "lease_duration": 3600, "lease_id": "",
+                      "renewable": false }
                     
                   
-
--}} - + <:footer>
@@ -149,15 +111,6 @@ {{t 'actions.close'}}
-
- {{! - View sessions - }} -
{{/unless}} From a83e6af6de52e6e87e304a3e96ba69be2d1e87f8 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Wed, 23 Jun 2021 14:08:01 -0700 Subject: [PATCH 06/14] Comment code with plain strings --- ui/desktop/app/templates/scopes/scope/projects/targets.hbs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index cf3eddfc4..5da77108f 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -1,5 +1,3 @@ -{{! template-lint-disable no-bare-strings }} - {{page-title (t 'resources.target.title_plural')}} {{#each @model as |target|}} @@ -38,7 +36,7 @@ {{! TODO: Conditional for when credentials aren't available older versions of cli }}

{{t 'resources.session.credential.title_plural'}}

- @@ -100,7 +98,7 @@ - + --}} <:footer>
From 1f328e54ee0a6741a817dc34bfdfa24cc65bc1cf Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 23 Jun 2021 22:12:20 -0400 Subject: [PATCH 07/14] feat: Update connect dialog with credentials api response --- addons/api/mirage/scenarios/ipc.js | 46 ++--- addons/core/translations/form/en-us.yaml | 6 + addons/core/translations/resources/en-us.yaml | 5 + ui/desktop/app/styles/app.scss | 6 + .../scopes/scope/projects/targets.hbs | 176 +++++++++++------- 5 files changed, 147 insertions(+), 92 deletions(-) diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 0920fd963..729b9fa25 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -65,10 +65,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -76,16 +76,18 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'ingress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, { credential_library: { @@ -93,10 +95,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -104,18 +106,20 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'egress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, - ] + ], }; } diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 5d2a58567..9442c73fc 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -62,6 +62,8 @@ client_secret: help: The client secret is set-only and may not be unset. client_secret_hmac: label: Client Secret HMAC +secret: + label: Secret max_age: label: Maximum Age help: The OIDC "max_age" parameter sent to the Authorization Server indicating a maximum acceptable time in seconds since the user's last authentication before requiring the user to reauthenticate. 0 indicates an immediate need to reauthenticate. @@ -108,3 +110,7 @@ email: label: Email full_name: label: Full Name +key: + label: Key +value: + label: Value diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index fc4fa2c65..2a8bb2b67 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -150,8 +150,13 @@ session: credential: title: Credential title_plural: Credentials + secret: + label: Secret actions: detail: Credential library details + raw-api: + show: View raw API output + hide: Hide raw API output org: title: Org title_plural: Orgs diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 4abf9c368..a58be8b4d 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -451,4 +451,10 @@ $chevron-down: url("data:image/svg+xml;utf-8, <:body> -

{{t 'resources.target.messages.proxy_url.title'}} - {{!-- ({{t 'resources.target.types.tcp'}})

--}} - ({{t 'resources.target.types.tcp'}}) +

+ {{t 'resources.target.messages.proxy_url.title'}} + ({{t 'resources.target.types.tcp'}}) +

- {{session.proxy_address}}:{{session.proxy_port}} + {{session.proxy}}

- + {{#if session.credentials}} + - {{! TODO: Conditional for when credentials aren't available - older versions of cli }} -

{{t 'resources.session.credential.title_plural'}}

- {{!-- - <:header> - {{t 'resources.session.credential.title_plural'}} + + {{#each session.credentials as |credential|}} + - - <:key>{{t 'form.id.label'}} - <:value>cl_nbv9375hLHs - - - <:key>{{t 'form.name.label'}} - <:value>Key/Value - - - <:key>{{t 'form.description.label'}} - <:value>Lorem ipsum dolor, sit amet consectetur adipisicing - elit. Ut nobis, nemo cum omnis saepe reprehenderit eaque - non odit iste magni quod voluptatem soluta dolor beatae - libero consequatur, perferendis rem molestias. - - - - <:body> - {{! TODO: Iterate through all credentials }} - - - - Key - Value - - - - - foo - Value - - - ttl - Test - - - - - <:footer> - -
-                    
-                      { "auth": null, "lease_duration": 3600, "lease_id": "",
-                      "renewable": false }
-                    
-                  
-
- -
--}} + <:header> + + + <:key>{{t 'form.id.label'}} + <:value> + + {{credential.credential_library_id}} + + + + + <:key>{{t 'form.type.label'}} + <:value>{{credential.credential_library_type}} + + + <:key>{{t 'form.name.label'}} + <:value>{{credential.credential_library_name}} + + + <:key>{{t 'form.description.label'}} + <:value + >{{credential.credential_library_description}} + + + + <:body> + + + + {{t + 'form.key.label' + }} + {{t + 'form.value.label' + }} + + + + {{#if credential.secret}} + + {{t + 'form.secret.label' + }} + + + {{credential.secret}} + + + + {{/if}} + + + + <:footer> + +
+                        
+                          {{credential.rawCredential}}
+                        
+                      
+
+ + + {{/each}} + {{/if}} <:footer>
@@ -116,4 +150,4 @@ {{/each}} {{/each}} -{{outlet}} +{{outlet}} \ No newline at end of file From db4964c985e22ef028911096618a347e35939918 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 24 Jun 2021 10:59:11 -0400 Subject: [PATCH 08/14] chore: tweak cred card styles --- ui/desktop/app/styles/app.scss | 2 +- ui/desktop/app/templates/scopes/scope/projects/targets.hbs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index a58be8b4d..a8cd2be48 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -429,7 +429,7 @@ $chevron-down: url("data:image/svg+xml;utf-8, <:header> Date: Thu, 24 Jun 2021 13:40:54 -0400 Subject: [PATCH 09/14] fix: Show raw json when viewing raw api output in connect dia --- ui/desktop/app/helpers/raw-json.js | 8 ++++ ui/desktop/app/styles/app.scss | 5 +++ .../scopes/scope/projects/targets.hbs | 8 +--- .../integration/helpers/raw-json-test.js | 19 +++++++++ yarn.lock | 39 ++++++++++++------- 5 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 ui/desktop/app/helpers/raw-json.js create mode 100644 ui/desktop/tests/integration/helpers/raw-json-test.js diff --git a/ui/desktop/app/helpers/raw-json.js b/ui/desktop/app/helpers/raw-json.js new file mode 100644 index 000000000..e457ebfd1 --- /dev/null +++ b/ui/desktop/app/helpers/raw-json.js @@ -0,0 +1,8 @@ +import { helper } from '@ember/component/helper'; + +/** + * Helper to convert json object to string for display purposes. + */ +export default helper(function rawJson([json]) { + return JSON.stringify(json, null, ' '); +}); diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index a8cd2be48..93cd35719 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -414,6 +414,11 @@ $chevron-down: url("data:image/svg+xml;utf-8, -
-                        
-                          {{credential.rawCredential}}
-                        
-                      
+
{{raw-json credential.rawCredential}}
@@ -150,4 +146,4 @@ {{/each}} {{/each}} -{{outlet}} +{{outlet}} \ No newline at end of file diff --git a/ui/desktop/tests/integration/helpers/raw-json-test.js b/ui/desktop/tests/integration/helpers/raw-json-test.js new file mode 100644 index 000000000..34574a8a5 --- /dev/null +++ b/ui/desktop/tests/integration/helpers/raw-json-test.js @@ -0,0 +1,19 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Helper | raw-json', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + this.set('inputValue', {}); + await render(hbs`{{raw-json inputValue}}`); + assert.equal(this.element.textContent.trim(), '{}'); + this.set('inputValue', { key: 'value', nestedKey: { key: 'value' } }); + assert.equal( + this.element.textContent.trim(), + `{\n "key": "value",\n "nestedKey": {\n "key": "value"\n }\n}` + ); + }); +}); diff --git a/yarn.lock b/yarn.lock index ac5c10ef8..2c78436b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3671,7 +3671,7 @@ agent-base@4, agent-base@^4.3.0: dependencies: es6-promisify "^5.0.0" -agent-base@6: +agent-base@6, agent-base@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== @@ -6360,9 +6360,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001157, caniuse-lite@^1.0.30001219: - version "1.0.30001235" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001235.tgz#ad5ca75bc5a1f7b12df79ad806d715a43a5ac4ed" - integrity sha512-zWEwIVqnzPkSAXOUlQnPW2oKoYb2aLQ4Q5ejdjBcnH63rfypaW34CxaeBn1VMya2XaEU3P/R2qHpWyj+l0BT1A== + version "1.0.30001239" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001239.tgz#66e8669985bb2cb84ccb10f68c25ce6dd3e4d2b8" + integrity sha512-cyBkXJDMeI4wthy8xJ2FvDU6+0dtcZSJW3voUF8+e9f1bBeuvyZfc3PNbkOETyhbR+dGCPzn9E7MA3iwzusOhQ== capture-exit@^2.0.0: version "2.0.0" @@ -15671,7 +15671,16 @@ npm-package-arg@^7.0.0: semver "^5.6.0" validate-npm-package-name "^3.0.0" -npm-package-arg@^8.0.0, npm-package-arg@^8.1.0: +npm-package-arg@^8.0.0: + version "8.1.5" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.5.tgz#3369b2d5fe8fdc674baa7f1786514ddc15466e44" + integrity sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q== + dependencies: + hosted-git-info "^4.0.1" + semver "^7.3.4" + validate-npm-package-name "^3.0.0" + +npm-package-arg@^8.1.0: version "8.1.4" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.4.tgz#8001cdbc4363997b8ef6c6cf7aaf543c5805879d" integrity sha512-xLokoCFqj/rPdr3LvcdDL6Kj6ipXGEDHD/QGpzwU6/pibYUOXmp5DBmg76yukFyx4ZDbrXNOTn+BPyd8TD4Jlw== @@ -19098,11 +19107,11 @@ socks-proxy-agent@^4.0.0: socks "~2.3.2" socks-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz#7c0f364e7b1cf4a7a437e71253bed72e9004be60" - integrity sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA== + version "5.0.1" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz#032fb583048a29ebffec2e6a73fca0761f48177e" + integrity sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ== dependencies: - agent-base "6" + agent-base "^6.0.2" debug "4" socks "^2.3.3" @@ -21634,9 +21643,9 @@ write@^0.2.1: mkdirp "^0.5.1" ws@^7.4.5, ws@^7.4.6, ws@~7.4.2: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + version "7.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.0.tgz#0033bafea031fb9df041b2026fc72a571ca44691" + integrity sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw== x-is-string@^0.1.0: version "0.1.0" @@ -21744,9 +21753,9 @@ yaml@^1.10.0, yaml@^1.7.2: integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== yargs-parser@20.2.4, yargs-parser@^15.0.1, yargs-parser@^18.1.2, yargs-parser@^20.0.0, yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^7.0.0, yargs-parser@^9.0.2, yargs-parser@~20.2.7: - version "20.2.7" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" - integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs-unparser@2.0.0: version "2.0.0" From 14f9635af44e322ab99c9e3c271ff58d58e94ef2 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 24 Jun 2021 12:06:25 -0700 Subject: [PATCH 10/14] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Add=20hidden=20se?= =?UTF-8?q?cret=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add first iteration of hidden secret component. --- addons/api/mirage/scenarios/ipc.js | 46 ++++++++++--------- addons/core/translations/resources/en-us.yaml | 1 + .../app/components/hidden-secret/index.hbs | 11 +++++ ui/desktop/app/styles/app.scss | 11 +++++ .../scopes/scope/projects/targets.hbs | 6 ++- .../components/hidden-secret-test.js | 21 +++++++++ 6 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 ui/desktop/app/components/hidden-secret/index.hbs create mode 100644 ui/desktop/tests/integration/components/hidden-secret-test.js diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 0920fd963..729b9fa25 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -65,10 +65,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -76,16 +76,18 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'ingress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, { credential_library: { @@ -93,10 +95,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -104,18 +106,20 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'egress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, - ] + ], }; } diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index fc4fa2c65..c5f48f0c8 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -261,3 +261,4 @@ target: add: title: Add Host Sets description: Select host sets to assign to this target. + secret: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ diff --git a/ui/desktop/app/components/hidden-secret/index.hbs b/ui/desktop/app/components/hidden-secret/index.hbs new file mode 100644 index 000000000..6bdd9972e --- /dev/null +++ b/ui/desktop/app/components/hidden-secret/index.hbs @@ -0,0 +1,11 @@ +
+ {{! TODO: The span wrap within a div because later we will add the toggle secret icon/button}} +
+ {{t 'resources.target.host-set.secret'}} +
+ +
\ No newline at end of file diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 4abf9c368..a35ab2cb9 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -452,3 +452,14 @@ $chevron-down: url("data:image/svg+xml;utf-8, + ttl @@ -116,4 +118,4 @@ {{/each}} {{/each}} -{{outlet}} +{{outlet}} \ No newline at end of file diff --git a/ui/desktop/tests/integration/components/hidden-secret-test.js b/ui/desktop/tests/integration/components/hidden-secret-test.js new file mode 100644 index 000000000..87e33a329 --- /dev/null +++ b/ui/desktop/tests/integration/components/hidden-secret-test.js @@ -0,0 +1,21 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render, find } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | hidden-secret', function (hooks) { + setupRenderingTest(hooks); + + test('it renders with a secret', async function (assert) { + assert.expect(2); + await render(hbs` + + `); + + assert.ok(find('.hidden-secret')); + assert.equal( + find('.hidden-secret > div > span').textContent.trim(), + '■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■' + ); + }); +}); From 4daa09ca7b496a7dd5a76fcbf2187c8f5d466739 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 24 Jun 2021 12:15:34 -0700 Subject: [PATCH 11/14] Revert "Comment code with plain strings" This reverts commit a83e6af6de52e6e87e304a3e96ba69be2d1e87f8. --- ui/desktop/app/templates/scopes/scope/projects/targets.hbs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index d62990141..6f146c374 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -1,3 +1,5 @@ +{{! template-lint-disable no-bare-strings }} + {{page-title (t 'resources.target.title_plural')}} {{#each @model as |target|}} @@ -36,7 +38,7 @@ {{! TODO: Conditional for when credentials aren't available older versions of cli }}

{{t 'resources.session.credential.title_plural'}}

- {{!-- @@ -100,7 +102,7 @@ - --}} + <:footer>
From 1a3dc72d57c690263664503fadd7d38dd16e15dc Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 24 Jun 2021 16:26:51 -0400 Subject: [PATCH 12/14] chore: tweak credential secrets format --- addons/api/addon/models/session.js | 69 ++++++++++++++++++++++++------ addons/api/mirage/scenarios/ipc.js | 30 ++++++------- 2 files changed, 70 insertions(+), 29 deletions(-) diff --git a/addons/api/addon/models/session.js b/addons/api/addon/models/session.js index ab2511f2f..7ec468630 100644 --- a/addons/api/addon/models/session.js +++ b/addons/api/addon/models/session.js @@ -3,31 +3,73 @@ import { computed } from '@ember/object'; import { equal } from '@ember/object/computed'; import { tracked } from '@glimmer/tracking'; import { A } from '@ember/array'; +import { typeOf } from '@ember/utils'; +/** + * + */ class SessionCredential { + // =classes + + /** + * + */ + static Library = class Library { + id; + name; + description; + type; + + constructor(id, name, description, type) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + } + }; + + /** + * + */ + static SecretItem = class SecretItem { + key; + value; + + constructor(key, value) { + this.key = key; + this.value = value; + } + }; + // =attributes rawCredential; - credential_library_id; - credential_library_name; - credential_library_description; - credential_library_type; + library; purpose; - #secret; + #rawSecretValue; - get secret() { - return atob(this.#secret); + /** + * The credential secret as an array of key/value objects. + * @type {SessionCredential.SecretItem[]} + */ + get secrets() { + if (typeOf(this.#rawSecretValue) === 'object') { + return Object.keys(this.#rawSecretValue).map( + (key) => + new SessionCredential.SecretItem(key, this.#rawSecretValue[key]) + ); + } else { + return [new SessionCredential.SecretItem('secret', this.#rawSecretValue)]; + } } // =methods constructor(cred) { + const { id, name, description, type } = cred.credential_library; + this.library = new SessionCredential.Library(id, name, description, type); + this.#rawSecretValue = cred.secret; this.rawCredential = cred; - this.credential_library_id = cred.credential_library.id; - this.credential_library_name = cred.credential_library.name; - this.credential_library_description = cred.credential_library.description; - this.credential_library_type = cred.credential_library.type; this.purpose = cred.purpose; - this.#secret = cred.secret; } } @@ -75,6 +117,9 @@ export default class SessionModel extends GeneratedSessionModel { // =methods + /** + * + */ addCredential(cred) { this.credentials.pushObject(new SessionCredential(cred)); } diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 0920fd963..86ffbe83e 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -65,10 +65,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: 'just-a-random-string', }, { credential_library: { @@ -76,16 +76,14 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'ingress', - secret: btoa(JSON.stringify({ + secret: { key1: 'value 1', key2: true, - key3: { - description: 'nested values' - } - })) + key3: 'test', + }, }, { credential_library: { @@ -93,10 +91,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: 'just-a-random-string', }, { credential_library: { @@ -104,18 +102,16 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'egress', - secret: btoa(JSON.stringify({ + secret: { key1: 'value 1', key2: true, - key3: { - description: 'nested values' - } - })) + key3: 'test', + }, }, - ] + ], }; } From a5359911745f9ec93fad5b34cb2b56dfeb1f0614 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 24 Jun 2021 18:09:53 -0400 Subject: [PATCH 13/14] fix: Use library and secret objects in connect dialog --- addons/core/translations/form/en-us.yaml | 2 - .../scopes/scope/projects/targets.hbs | 67 +++++++++---------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 9442c73fc..ba8252614 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -62,8 +62,6 @@ client_secret: help: The client secret is set-only and may not be unset. client_secret_hmac: label: Client Secret HMAC -secret: - label: Secret max_age: label: Maximum Age help: The OIDC "max_age" parameter sent to the Authorization Server indicating a maximum acceptable time in seconds since the user's last authentication before requiring the user to reauthenticate. 0 indicates an immediate need to reauthenticate. diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index 65f577345..b4c0f1a7e 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -61,60 +61,59 @@ <:key>{{t 'form.id.label'}} <:value> - {{credential.credential_library_id}} + {{credential.library.id}} <:key>{{t 'form.type.label'}} - <:value>{{credential.credential_library_type}} + <:value>{{credential.library.type}} <:key>{{t 'form.name.label'}} - <:value>{{credential.credential_library_name}} + <:value>{{credential.library.name}} <:key>{{t 'form.description.label'}} - <:value - >{{credential.credential_library_description}} + <:value>{{credential.library.description}} <:body> - - - - {{t - 'form.key.label' - }} - {{t - 'form.value.label' - }} - - - - {{#if credential.secret}} - + {{#if credential.secrets}} + + + {{t - 'form.secret.label' + 'form.key.label' }} - - - {{credential.secret}} - - - - {{/if}} - - + {{t + 'form.value.label' + }} + + + + {{#each credential.secrets as |secret|}} + + {{secret.key}} + + + {{secret.value}} + + + + {{/each}} + + + {{/if}} <:footer> Date: Fri, 25 Jun 2021 10:12:56 -0400 Subject: [PATCH 14/14] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Conditionally=20sho?= =?UTF-8?q?w=20credential=20library=20name=20and=20desc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/core/translations/resources/en-us.yaml | 3 ++- .../scopes/scope/projects/targets.hbs | 26 +++++++++++-------- ui/desktop/electron-app/config/cli.js | 4 +++ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index a23b80821..dd7ea9359 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -152,8 +152,9 @@ session: title_plural: Credentials secret: label: Secret + credential_library: + title: Credential Library actions: - detail: Credential library details raw-api: show: View raw API output hide: Hide raw API output diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index b4c0f1a7e..e26742ea1 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -1,5 +1,3 @@ -{{! template-lint-disable no-bare-strings }} - {{page-title (t 'resources.target.title_plural')}} {{#each @model as |target|}} @@ -51,7 +49,9 @@ > <:header> {{t 'form.type.label'}} <:value>{{credential.library.type}} - - <:key>{{t 'form.name.label'}} - <:value>{{credential.library.name}} - - - <:key>{{t 'form.description.label'}} - <:value>{{credential.library.description}} - + {{#if credential.library.name}} + + <:key>{{t 'form.name.label'}} + <:value>{{credential.library.name}} + + {{/if}} + {{#if credential.library.description}} + + <:key>{{t 'form.description.label'}} + <:value>{{credential.library.description}} + + {{/if}} <:body> diff --git a/ui/desktop/electron-app/config/cli.js b/ui/desktop/electron-app/config/cli.js index 22092de64..9af356e9e 100644 --- a/ui/desktop/electron-app/config/cli.js +++ b/ui/desktop/electron-app/config/cli.js @@ -48,6 +48,10 @@ const extract = (artifactPath, destination) => { module.exports = { setup: async () => { + if (process.env.BYPASS_CLI_SETUP) { + console.warn('WARNING: Bypassing cli setup'); + return; + } const artifactPath = await downloadArtifact(artifactVersion); await extract(artifactPath, artifactDestination); }