From 2a11d75ccf77ebe6a51b8448697840a6830c3083 Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Fri, 26 May 2023 14:14:58 -0400 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20serializing=20c?= =?UTF-8?q?lient=20secrets=20in=20oidc=20auth=20methods=20(#1698)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/addon/generated/models/auth-method.js | 2 +- .../unit/serializers/auth-method-test.js | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/addons/api/addon/generated/models/auth-method.js b/addons/api/addon/generated/models/auth-method.js index 85ef9fe24..eeef31ec0 100644 --- a/addons/api/addon/generated/models/auth-method.js +++ b/addons/api/addon/generated/models/auth-method.js @@ -61,7 +61,7 @@ export default class GeneratedAuthMethodModel extends BaseModel { @attr('string', { isNestedAttribute: true }) client_id; - @attr('string', { isNestedAttribute: true }) client_secret; + @attr('string', { isNestedAttribute: true, isSecret: true }) client_secret; @attr('string', { readOnly: true, isNestedAttribute: true }) client_secret_hmac; diff --git a/addons/api/tests/unit/serializers/auth-method-test.js b/addons/api/tests/unit/serializers/auth-method-test.js index f9989a5f3..c38bd0e56 100644 --- a/addons/api/tests/unit/serializers/auth-method-test.js +++ b/addons/api/tests/unit/serializers/auth-method-test.js @@ -89,6 +89,55 @@ module('Unit | Serializer | auth method', function (hooks) { }); }); + test("it doesn't serialize client secrets when not set", function (assert) { + assert.expect(1); + let store = this.owner.lookup('service:store'); + let record = store.createRecord('auth-method', { + type: TYPE_AUTH_METHOD_OIDC, + name: 'OIDC Auth Method', + state: 'foo', + account_claim_maps: [{ from: 'foo', to: 'bar' }], + claims_scopes: [{ value: 'profile' }, { value: 'email' }], + signing_algorithms: [{ value: 'RS256' }, { value: 'RS384' }], + allowed_audiences: [ + { value: 'www.alice.com' }, + { value: 'www.alice.com/admin' }, + ], + idp_ca_certs: [ + { value: 'certificate-1234' }, + { value: 'certificate-5678' }, + ], + api_url_prefix: 'protocol://host:port/foo', + client_id: 'id123', + client_secret: null, + disable_discovered_config_validation: true, + dry_run: true, + issuer: 'http://www.example.net', + max_age: 500, + }); + + let serializedRecord = record.serialize(); + + assert.deepEqual(serializedRecord, { + type: TYPE_AUTH_METHOD_OIDC, + name: 'OIDC Auth Method', + description: null, + attributes: { + account_claim_maps: ['foo=bar'], + claims_scopes: ['profile', 'email'], + signing_algorithms: ['RS256', 'RS384'], + allowed_audiences: ['www.alice.com', 'www.alice.com/admin'], + idp_ca_certs: ['certificate-1234', 'certificate-5678'], + api_url_prefix: 'protocol://host:port/foo', + client_id: 'id123', + disable_discovered_config_validation: true, + dry_run: true, + issuer: 'http://www.example.net', + max_age: 500, + }, + }); + }); + test('it serializes OIDC records with only state and version when `adapterOptions.state` is passed', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); From 9d7a23fcc4db76c3c4f8da3ca4b85d060c57d73d Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Wed, 31 May 2023 10:00:28 -0700 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=F0=9F=90=9B=20radio=20card=20group?= =?UTF-8?q?=20name=20(#1701)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/host-catalog/aws/index.hbs | 2 +- .../form/host-catalog/azure/index.hbs | 2 +- .../form/host-catalog/static/index.hbs | 26 ------------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index ceb9c1838..abfbb5401 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -69,7 +69,7 @@ {{/each}} - + {{t 'titles.provider'}} {{t 'titles.choose-a-provider'}} {{t 'descriptions.choose-a-provider'}} diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index 51f1bc29c..238a3e334 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -68,7 +68,7 @@ {{/each}} - + {{t 'titles.provider'}} {{t 'titles.choose-a-provider'}} {{concat diff --git a/ui/admin/app/components/form/host-catalog/static/index.hbs b/ui/admin/app/components/form/host-catalog/static/index.hbs index 42ea38589..23bed2624 100644 --- a/ui/admin/app/components/form/host-catalog/static/index.hbs +++ b/ui/admin/app/components/form/host-catalog/static/index.hbs @@ -71,32 +71,6 @@ {{/each}} - - {{#if @model.isPlugin}} - - - {{t 'titles.provider'}} - {{t 'titles.choose-a-provider'}} - {{t 'descriptions.choose-a-provider'}} - - {{#each-in this.mapResourceTypeWithIcon as |pluginType|}} - - {{t - (concat 'resources.host-catalog.types.' pluginType) - }} - {{t - (concat 'resources.host-catalog.help.' pluginType) - }} - - {{/each-in}} - - {{/if}} {{/if}} {{#if (can 'save model' @model)}} From 963b5d465d99cf7116e98e798bd5555dfaa6a2a8 Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Wed, 31 May 2023 18:33:27 -0400 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Add=20default=20clie?= =?UTF-8?q?nt=20port=20to=20targets=20(#1700)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 Add default client port to targets ✅ Closes: ICU-9299 --- addons/api/addon/generated/models/target.js | 13 +++++++++ addons/api/addon/models/target.js | 6 ----- .../api/mirage/generated/factories/target.js | 1 + .../api/tests/unit/serializers/target-test.js | 5 ++++ addons/core/translations/form/en-us.yaml | 3 --- addons/core/translations/resources/en-us.yaml | 6 +++++ .../components/form/target/details/index.hbs | 27 +++++++++++++++++-- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/addons/api/addon/generated/models/target.js b/addons/api/addon/generated/models/target.js index 2c7e3ae14..4cc169731 100644 --- a/addons/api/addon/generated/models/target.js +++ b/addons/api/addon/generated/models/target.js @@ -83,4 +83,17 @@ export default class GeneratedTargetModel extends BaseModel { 'An IP address or DNS name for the session to connect to. Cannot be used in conjunction with host sources.', }) address; + + @attr('number', { + isNestedAttribute: true, + description: 'The default port a target should use if present.', + }) + default_port; + + @attr('number', { + isNestedAttribute: true, + description: + "The default port that will be listened on by the client's local proxy.", + }) + default_client_port; } diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 79a784e5e..1d8073371 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -18,12 +18,6 @@ export default class TargetModel extends GeneratedTargetModel { // =attributes - @attr('number', { - isNestedAttribute: true, - description: 'The default port a target should use if present.', - }) - default_port; - /** * @type Array */ diff --git a/addons/api/mirage/generated/factories/target.js b/addons/api/mirage/generated/factories/target.js index cf868541a..f551efda2 100644 --- a/addons/api/mirage/generated/factories/target.js +++ b/addons/api/mirage/generated/factories/target.js @@ -17,5 +17,6 @@ export default Factory.extend({ updated_time: () => faker.date.recent(), disabled: () => faker.datatype.boolean(), default_port: () => faker.datatype.number(), + default_client_port: () => faker.datatype.number(), version: () => faker.datatype.number(), }); diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index c531a311a..447a863e7 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -31,6 +31,7 @@ module('Unit | Serializer | target', function (hooks) { type: 'org', }, default_port: 1234, + default_client_port: 4321, version: 1, type: TYPE_TARGET_TCP, address: '0.0.0.0', @@ -51,6 +52,7 @@ module('Unit | Serializer | target', function (hooks) { ingress_worker_filter: null, attributes: { default_port: 1234, + default_client_port: 4321, }, address: '0.0.0.0', }); @@ -157,6 +159,7 @@ module('Unit | Serializer | target', function (hooks) { ingress_worker_filter: null, attributes: { default_port: 1234, + default_client_port: null, }, address: null, }); @@ -192,6 +195,7 @@ module('Unit | Serializer | target', function (hooks) { ingress_worker_filter: null, attributes: { default_port: 1234, + default_client_port: null, }, address: null, }); @@ -227,6 +231,7 @@ module('Unit | Serializer | target', function (hooks) { ingress_worker_filter: 'ingress worker', attributes: { default_port: 1234, + default_client_port: null, }, address: null, }); diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 9d76fa1f4..11af2b1fd 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -33,9 +33,6 @@ grant: address: label: Address help: An IP, host name, or other routable address -default_port: - label: Default Port - help: The default port on which to connect current_password: label: Current Password new_password: diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index c57556183..281fd20ca 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -326,6 +326,12 @@ target: worker_filter: label: Worker Filter help: Deprecated. Boolean expression to filter the workers that are allowed to satisfy this request. + default_port: + label: Default Port + help: The default port on which to connect. + default_client_port: + label: Default Client Port + help: The local proxy port on which to listen by default when a session is started on a client. questions: delete-host-sources: title: Remove associated host sources? diff --git a/ui/admin/app/components/form/target/details/index.hbs b/ui/admin/app/components/form/target/details/index.hbs index 5b7f672ff..685358d9f 100644 --- a/ui/admin/app/components/form/target/details/index.hbs +++ b/ui/admin/app/components/form/target/details/index.hbs @@ -122,9 +122,9 @@ as |F| > {{t - 'form.default_port.label' + 'resources.target.form.default_port.label' }} - {{t 'form.default_port.help'}} + {{t 'resources.target.form.default_port.help'}} {{#if @model.errors.default_port}} {{#each @model.errors.default_port as |error|}} @@ -134,6 +134,29 @@ {{/if}} + + {{t 'resources.target.form.default_client_port.label'}} + {{t + 'resources.target.form.default_client_port.help' + }} + {{#if @model.errors.default_client_port}} + + {{#each @model.errors.default_client_port as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + Date: Thu, 1 Jun 2023 11:07:57 -0500 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20remove=20type=20?= =?UTF-8?q?column=20from=20Workers=20table=20in=20Admin=20UI=20(#1702)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: ICU-9539 --- ui/admin/app/templates/scopes/scope/workers/index.hbs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/workers/index.hbs b/ui/admin/app/templates/scopes/scope/workers/index.hbs index 442d00cbb..66b7d8fa6 100644 --- a/ui/admin/app/templates/scopes/scope/workers/index.hbs +++ b/ui/admin/app/templates/scopes/scope/workers/index.hbs @@ -95,7 +95,6 @@ {{t 'resources.worker.title'}} {{t 'form.id.label'}} - {{t 'form.type.label'}} {{t 'resources.worker.table.session_count' }} @@ -143,9 +142,8 @@ @acknowledgeText={{t 'states.copied'}} > {{worker.id}} - - - {{worker.type}} + + {{worker.active_connection_count}} {{worker.release_version}} {{worker.address}} From b94f3d164e4c9600e0fd985e45bbf7691d0ca1df Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Corvo Date: Thu, 1 Jun 2023 10:13:03 -0700 Subject: [PATCH 5/5] =?UTF-8?q?style:=20=F0=9F=92=84=20Delete=20old=20comm?= =?UTF-8?q?ent=20code=20(#1699)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete old comment code, seems isn't used for a couple of years --- ui/admin/app/templates/scopes/scope.hbs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope.hbs b/ui/admin/app/templates/scopes/scope.hbs index 380ea8fe9..2c72e7ddd 100644 --- a/ui/admin/app/templates/scopes/scope.hbs +++ b/ui/admin/app/templates/scopes/scope.hbs @@ -73,24 +73,7 @@ {{t 'resources.project.title_plural'}} - {{! TODO: after scope awareness refactor, update groups and roles - to support project scopes }} - {{!-- - - - - {{t "resources.group.title_plural"}} - - - - {{t "resources.role.title_plural"}} - - - --}} + {{#if (can 'navigate model' @model collection='sessions')}}