diff --git a/x-pack/plugins/actions/server/actions_client.ts b/x-pack/plugins/actions/server/actions_client.ts index 8974b73cf28a6..25730bfd4c949 100644 --- a/x-pack/plugins/actions/server/actions_client.ts +++ b/x-pack/plugins/actions/server/actions_client.ts @@ -148,8 +148,8 @@ export class ActionsClient { } const actionType = this.actionTypeRegistry.get(actionTypeId); - let validatedActionTypeConfig = validateConfig(actionType, config); - let validatedActionTypeSecrets = validateSecrets(actionType, secrets); + const validatedActionTypeConfig = validateConfig(actionType, config); + const validatedActionTypeSecrets = validateSecrets(actionType, secrets); if (actionType.validate?.connector) { validateConnector(actionType, { config, secrets }); } @@ -221,8 +221,8 @@ export class ActionsClient { const { actionTypeId } = attributes; const { name, config, secrets } = action; const actionType = this.actionTypeRegistry.get(actionTypeId); - let validatedActionTypeConfig = validateConfig(actionType, config); - let validatedActionTypeSecrets = validateSecrets(actionType, secrets); + const validatedActionTypeConfig = validateConfig(actionType, config); + const validatedActionTypeSecrets = validateSecrets(actionType, secrets); if (actionType.validate?.connector) { validateConnector(actionType, { config, secrets }); } diff --git a/x-pack/plugins/actions/server/lib/action_executor.test.ts b/x-pack/plugins/actions/server/lib/action_executor.test.ts index ce1baa9802f59..549e721ffcdd4 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.test.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.test.ts @@ -282,14 +282,9 @@ test('throws an error when connector is invalid', async () => { config: schema.object({ param1: schema.string(), }), - connector: schema.object({ - config: schema.object({ - param1: schema.string(), - }), - secrets: schema.object({ - param2: schema.string(), - }), - }), + connector: () => { + return 'error'; + }, }, executor: jest.fn(), }; diff --git a/x-pack/plugins/actions/server/lib/action_executor.ts b/x-pack/plugins/actions/server/lib/action_executor.ts index 44291acfe6349..5da4d4c4e6c55 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.ts @@ -152,18 +152,10 @@ export class ActionExecutor { validatedConfig = validateConfig(actionType, config as Record); validatedSecrets = validateSecrets(actionType, secrets as Record); if (actionType.validate?.connector) { - const validateActionTypeConnector = validateConnector(actionType, { + validateConnector(actionType, { config: config as Record, secrets: secrets as Record, }); - validatedConfig = { - ...validatedConfig, - ...(validateActionTypeConnector.config as Record), - }; - validatedSecrets = { - ...validatedSecrets, - ...(validateActionTypeConnector.secrets as Record), - }; } } catch (err) { span?.setOutcome('failure'); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts index c353ae7b9ebae..d7716c5f30f66 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts @@ -284,6 +284,7 @@ export default function emailTest({ getService }: FtrProviderContext) { config: { service: '__json', from: 'jim@example.com', + hasAuth: false, }, }) .expect(200);