From 7d07806bd597c5a4305666a7e125e2d9438865d1 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 4 Dec 2023 14:02:40 +0100 Subject: [PATCH 1/5] enable feature flags --- x-pack/plugins/fleet/common/experimental_features.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/fleet/common/experimental_features.ts b/x-pack/plugins/fleet/common/experimental_features.ts index 233173263c129..3ac7abb927b95 100644 --- a/x-pack/plugins/fleet/common/experimental_features.ts +++ b/x-pack/plugins/fleet/common/experimental_features.ts @@ -23,8 +23,8 @@ export const allowedExperimentalValues = Object.freeze>( agentTamperProtectionEnabled: true, secretsStorage: true, kafkaOutput: true, - outputSecretsStorage: false, - remoteESOutput: false, + outputSecretsStorage: true, + remoteESOutput: true, }); type ExperimentalConfigKeys = Array; From f2c86ad1febdf85dee7399b0314dde0ef9516c06 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 4 Dec 2023 16:16:49 +0100 Subject: [PATCH 2/5] fix cypress tests --- x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts | 4 ++-- x-pack/plugins/fleet/cypress/screens/fleet.ts | 2 +- x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts b/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts index c5cf05bc1edd3..af88e89d564ef 100644 --- a/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts +++ b/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts @@ -204,7 +204,7 @@ describe('Outputs', () => { cy.contains('Name is required'); cy.contains('Host is required'); cy.contains('Username is required'); - cy.contains('Password is required'); + // cy.contains('Password is required'); // TODO cy.contains('Default topic is required'); cy.contains('Topic is required'); cy.contains( @@ -213,7 +213,7 @@ describe('Outputs', () => { cy.contains('Must be a key, value pair i.e. "http.response.code: 200"'); shouldDisplayError(SETTINGS_OUTPUTS.NAME_INPUT); shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_USERNAME_INPUT); - shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_PASSWORD_INPUT); + // shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_PASSWORD_INPUT); // TODO shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.TOPICS_DEFAULT_TOPIC_INPUT); shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.TOPICS_CONDITION_INPUT); shouldDisplayError(SETTINGS_OUTPUTS_KAFKA.TOPICS_TOPIC_INPUT); diff --git a/x-pack/plugins/fleet/cypress/screens/fleet.ts b/x-pack/plugins/fleet/cypress/screens/fleet.ts index af799b6066600..fa623389e7c92 100644 --- a/x-pack/plugins/fleet/cypress/screens/fleet.ts +++ b/x-pack/plugins/fleet/cypress/screens/fleet.ts @@ -144,7 +144,7 @@ export const SETTINGS_OUTPUTS_KAFKA = { AUTHENTICATION_SSL_OPTION: 'kafkaAuthenticationSSLRadioButton', AUTHENTICATION_KERBEROS_OPTION: 'kafkaAuthenticationKerberosRadioButton', AUTHENTICATION_USERNAME_INPUT: 'settingsOutputsFlyout.kafkaUsernameInput', - AUTHENTICATION_PASSWORD_INPUT: 'settingsOutputsFlyout.kafkaPasswordInput', + AUTHENTICATION_PASSWORD_INPUT: 'settingsOutputsFlyout.kafkaPasswordSecretInput', AUTHENTICATION_VERIFICATION_MODE_INPUT: 'settingsOutputsFlyout.kafkaVerificationModeInput', AUTHENTICATION_CONNECTION_TYPE_SELECT: 'settingsOutputsFlyout.kafkaConnectionTypeRadioInput', AUTHENTICATION_CONNECTION_TYPE_PLAIN_OPTION: 'kafkaConnectionTypePlaintextRadioButton', diff --git a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts index 8e7121877b8bf..bc025dd3d1b03 100644 --- a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts +++ b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts @@ -176,7 +176,6 @@ export const resetKafkaOutputForm = () => { cy.getBySel(kafkaOutputFormValues.name.selector).clear(); cy.get('[placeholder="Specify host"').clear(); cy.getBySel(kafkaOutputFormValues.username.selector).clear(); - cy.getBySel(kafkaOutputFormValues.password.selector).clear(); cy.getBySel(kafkaOutputFormValues.defaultTopic.selector).clear(); cy.getBySel(SETTINGS_OUTPUTS_KAFKA.COMPRESSION_SWITCH).click(); }; From a9711fc9f72d044cc04c21958248463c661aafa2 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 4 Dec 2023 16:34:52 +0100 Subject: [PATCH 3/5] fix cypress tests --- x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts index bc025dd3d1b03..718c613858f86 100644 --- a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts +++ b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts @@ -184,7 +184,6 @@ export const fillInKafkaOutputForm = () => { cy.getBySel(kafkaOutputFormValues.name.selector).type(kafkaOutputFormValues.name.value); cy.get('[placeholder="Specify host"').clear().type('localhost:5000'); cy.getBySel(kafkaOutputFormValues.username.selector).type(kafkaOutputFormValues.username.value); - cy.getBySel(kafkaOutputFormValues.password.selector).type(kafkaOutputFormValues.password.value); cy.getBySel(kafkaOutputFormValues.verificationMode.selector).select( kafkaOutputFormValues.verificationMode.value ); @@ -262,6 +261,9 @@ export const fillInKafkaOutputForm = () => { export const validateSavedKafkaOutputForm = () => { Object.keys(kafkaOutputFormValues).forEach((key: string) => { const { selector, value } = kafkaOutputFormValues[key as keyof typeof kafkaOutputFormValues]; + if (selector === SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_PASSWORD_INPUT) { + return; + } cy.getBySel(selector).should('have.value', value); }); From d21aa8d135161094e0ccc8afce2a73838c866fb8 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 4 Dec 2023 16:39:11 +0100 Subject: [PATCH 4/5] exclude secrets from AAD --- x-pack/plugins/fleet/server/saved_objects/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index c470140d8ac23..b1fa2c0e462ee 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -697,6 +697,7 @@ export function registerEncryptedSavedObjects( 'timeout', 'broker_timeout', 'required_acks', + 'secrets', ]), }); // Encrypted saved objects From 9e9086559a3d66d913e44c4caabcfdd667379adf Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 4 Dec 2023 16:51:58 +0100 Subject: [PATCH 5/5] fix cypress tests --- .../plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts | 2 +- x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts b/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts index af88e89d564ef..3b312241fb70f 100644 --- a/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts +++ b/x-pack/plugins/fleet/cypress/e2e/fleet_settings_outputs.cy.ts @@ -271,7 +271,7 @@ describe('Outputs', () => { it('saves the output', () => { selectKafkaOutput(); - fillInKafkaOutputForm(); + fillInKafkaOutputForm(true); cy.intercept('POST', '**/api/fleet/outputs').as('saveOutput'); diff --git a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts index 718c613858f86..5b3b0f8d4af16 100644 --- a/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts +++ b/x-pack/plugins/fleet/cypress/screens/fleet_outputs.ts @@ -180,10 +180,13 @@ export const resetKafkaOutputForm = () => { cy.getBySel(SETTINGS_OUTPUTS_KAFKA.COMPRESSION_SWITCH).click(); }; -export const fillInKafkaOutputForm = () => { +export const fillInKafkaOutputForm = (create?: boolean) => { cy.getBySel(kafkaOutputFormValues.name.selector).type(kafkaOutputFormValues.name.value); cy.get('[placeholder="Specify host"').clear().type('localhost:5000'); cy.getBySel(kafkaOutputFormValues.username.selector).type(kafkaOutputFormValues.username.value); + if (create) { + cy.getBySel(kafkaOutputFormValues.password.selector).type(kafkaOutputFormValues.password.value); + } cy.getBySel(kafkaOutputFormValues.verificationMode.selector).select( kafkaOutputFormValues.verificationMode.value ); @@ -290,7 +293,7 @@ export const validateOutputTypeChangeToKafka = (outputId: string) => { cy.getBySel(SETTINGS_OUTPUTS.TYPE_INPUT).select('kafka'); cy.getBySel(SETTINGS_OUTPUTS_KAFKA.AUTHENTICATION_USERNAME_PASSWORD_OPTION).click(); - fillInKafkaOutputForm(); + fillInKafkaOutputForm(true); cy.intercept('PUT', '**/api/fleet/outputs/**').as('saveOutput'); cy.getBySel(SETTINGS_SAVE_BTN).click();