From 8632d90cf21cc49deb80a540bb2e9bbca86c8404 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Nov 2023 17:22:41 +0100 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 18345a9..b17c9ce 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Deployer Backend This server allows to automatically deploy applications on the server. - +The API works in combination with the [ndb-setup](https://github.com/Aam-Digital/ndb-setup) scripts, for instructions to integrate this API deployment service, see https://github.com/Aam-Digital/ndb-setup/tree/master/deployer From 451d0a02d2b68d37304f530857cbc8b4d43d3442 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Nov 2023 17:42:11 +0100 Subject: [PATCH 2/6] Update app.module.ts --- src/app.module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.module.ts b/src/app.module.ts index 548d632..20e7061 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -44,7 +44,7 @@ const lowSeverityLevels: SeverityLevel[] = ['log', 'info']; dsn: configService.get('SENTRY_DSN'), debug: true, environment: 'prod', - release: 'backend@' + process.env.npm_package_version, + release: 'deployer-backend@' + process.env.npm_package_version, whitelistUrls: [/https?:\/\/(.*)\.?aam-digital\.com/], initialScope: { tags: { From 9fe4fc67eedde2bddb2ccfd9bfde8291f341740d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Nov 2023 17:45:16 +0100 Subject: [PATCH 3/6] Update app.controller.spec.ts --- src/app.controller.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts index b720a11..1ace8f0 100644 --- a/src/app.controller.spec.ts +++ b/src/app.controller.spec.ts @@ -53,6 +53,7 @@ describe('AppController', () => { it('should throw bad request exception if data has wrong format', (done) => { const invalidData = { ...deploymentData, name: 'with space' }; + // TODO: add an extensive list of invalid formats including attempts someone could pass to try and inject code? controller.deployApp(invalidData).subscribe({ error: (err) => { From e56b4d295914b9c0de357d0800ad3fd5d692ae7f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Nov 2023 17:52:37 +0100 Subject: [PATCH 4/6] Update deployment-info.dto.ts --- src/deployment-info.dto.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/deployment-info.dto.ts b/src/deployment-info.dto.ts index 9d9fdee..1e2f547 100644 --- a/src/deployment-info.dto.ts +++ b/src/deployment-info.dto.ts @@ -1,11 +1,46 @@ export class DeploymentInfo { + @ApiProperty({ + description: 'Name of the system to be created. Must not contain whitespaces.', + }) name: string; + + @ApiProperty({ + description: 'Language for the system (and keycloak).', + }) locale?: string; + + @ApiProperty({ + description: 'Username of the initial user account created as site admin.', + }) username: string; + + @ApiProperty({ + description: 'Email for the initial user account.', + }) email: string; + + @ApiProperty({ + description: 'Whether the permission backend (replication-backend) should be set up.', + }) backend: boolean; + + @ApiProperty({ + description: 'Whether the new system should be added to uptime monitoring.', + }) monitor: boolean; + + @ApiProperty({ + description: '???', + }) client: string; + + @ApiProperty({ + description: '???', + }) clientKey: string; + + @ApiProperty({ + description: '???', + }) base: string; } From 19e8587bc9c756d1dcd0cc1e00262da258e4f69f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Nov 2023 17:57:45 +0100 Subject: [PATCH 5/6] Update aam-deploy.php --- integrations/elementor-plugin/form-actions/aam-deploy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/elementor-plugin/form-actions/aam-deploy.php b/integrations/elementor-plugin/form-actions/aam-deploy.php index ff9018a..8ce01d7 100644 --- a/integrations/elementor-plugin/form-actions/aam-deploy.php +++ b/integrations/elementor-plugin/form-actions/aam-deploy.php @@ -140,7 +140,7 @@ public function register_settings_section( $widget ) { [ 'label' => esc_html__( 'Client name', 'elementor-forms-aam-deploy' ), 'type' => \Elementor\Controls_Manager::TEXT, - 'description' => esc_html__( 'Enter you client name.', 'elementor-forms-aam-deploy' ), + 'description' => esc_html__( 'Enter your client name (i.e. ???).', 'elementor-forms-aam-deploy' ), ] ); @@ -149,7 +149,7 @@ public function register_settings_section( $widget ) { [ 'label' => esc_html__( 'Client key', 'elementor-forms-aam-deploy' ), 'type' => \Elementor\Controls_Manager::TEXT, - 'description' => esc_html__( 'Enter you secret client key.', 'elementor-forms-aam-deploy' ), + 'description' => esc_html__( 'Enter your secret client key (API token).', 'elementor-forms-aam-deploy' ), ] ); @@ -158,7 +158,7 @@ public function register_settings_section( $widget ) { [ 'label' => esc_html__( 'Language', 'elementor-forms-aam-deploy' ), 'type' => \Elementor\Controls_Manager::TEXT, - 'description' => esc_html__( 'Enter the default language for the deployed app ("en", "de",...).', 'elementor-forms-aam-deploy' ), + 'description' => esc_html__( 'Enter the default language for the deployed app ("en", "de", ...).', 'elementor-forms-aam-deploy' ), 'default' => 'en' ] ); @@ -209,4 +209,4 @@ public function on_export( $element ) { return $element; } -} \ No newline at end of file +} From 096d9b8dc92905097e01f30d0b158cdbbeda7f0e Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 11 Dec 2023 10:40:53 +0100 Subject: [PATCH 6/6] improved doc --- .../form-actions/aam-deploy.php | 2 +- src/deployment-info.dto.ts | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/integrations/elementor-plugin/form-actions/aam-deploy.php b/integrations/elementor-plugin/form-actions/aam-deploy.php index 8ce01d7..dbc2a85 100644 --- a/integrations/elementor-plugin/form-actions/aam-deploy.php +++ b/integrations/elementor-plugin/form-actions/aam-deploy.php @@ -140,7 +140,7 @@ public function register_settings_section( $widget ) { [ 'label' => esc_html__( 'Client name', 'elementor-forms-aam-deploy' ), 'type' => \Elementor\Controls_Manager::TEXT, - 'description' => esc_html__( 'Enter your client name (i.e. ???).', 'elementor-forms-aam-deploy' ), + 'description' => esc_html__( 'Enter your client name.', 'elementor-forms-aam-deploy' ), ] ); diff --git a/src/deployment-info.dto.ts b/src/deployment-info.dto.ts index 1e2f547..01d6177 100644 --- a/src/deployment-info.dto.ts +++ b/src/deployment-info.dto.ts @@ -1,6 +1,9 @@ +import { ApiProperty } from '@nestjs/swagger'; + export class DeploymentInfo { @ApiProperty({ - description: 'Name of the system to be created. Must not contain whitespaces.', + description: + 'Name of the system to be created. Must not contain whitespaces.', }) name: string; @@ -13,34 +16,36 @@ export class DeploymentInfo { description: 'Username of the initial user account created as site admin.', }) username: string; - + @ApiProperty({ description: 'Email for the initial user account.', }) email: string; - + @ApiProperty({ - description: 'Whether the permission backend (replication-backend) should be set up.', + description: + 'Whether the permission backend (replication-backend) should be set up.', }) backend: boolean; - + @ApiProperty({ description: 'Whether the new system should be added to uptime monitoring.', }) monitor: boolean; - + @ApiProperty({ - description: '???', + description: 'Name of the Keycloak confidential client.', }) client: string; - + @ApiProperty({ - description: '???', + description: 'Credentials for the Keycloak confidential client.', }) clientKey: string; - + @ApiProperty({ - description: '???', + description: + 'The prebuilt configuration which should be used as a basis for this app.', }) base: string; }