-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Response Ops] Fix single file connector auth type on edit #244635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Response Ops] Fix single file connector auth type on edit #244635
Conversation
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…b.com/jcger/kibana into issue-ro-479-connector-form-generator
…b.com/jcger/kibana into issue-ro-479-connector-form-generator
…b.com/jcger/kibana into issue-ro-479-connector-form-generator
…479-connector-form-generator
…479-connector-form-generator
…b.com/jcger/kibana into issue-ro-479-connector-form-generator
…b.com/jcger/kibana into issue-244390-discriminator-on-edit
…390-discriminator-on-edit
|
Pinging @elastic/response-ops (Team:ResponseOps) |
|
I tried it with the existing single file webhook connector I had locally and it did not seem to work 🙈. I created a webhook with basic auth and edited it and it defaulted to The only difference I saw was that in your PR summary webhook definition, you have authType in the
Is that a requirement for this to work? |
|
@ymao1 yes, sorry, I forgot to mention that in order to make this work we need the I'll try include it automatically (done in ed26d81)
|
ymao1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Works as described!
| expect(result.config.authType).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('should preserve existing config.authType if secrets.authType exists', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this test be called should overwrite existing config.authType...? the naming doesn't seem to match the outcome
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
|
Summary
Closes #244390
QA
Webhook.patch
diff --git a/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts b/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts index fefd2a67514e..534be6c8c3f5 100644 --- a/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts +++ b/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts @@ -13,3 +13,4 @@ export * from './specs/greynoise'; export * from './specs/shodan'; export * from './specs/urlvoid'; export * from './specs/virustotal'; +export * from './specs/webhook'; diff --git a/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts b/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts new file mode 100644 index 000000000000..b5f1e6375ae2 --- /dev/null +++ b/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { z } from '@kbn/zod/v4'; +import type { ConnectorSpec } from '../connector_spec'; + +export const SingleFileWebhookConnector: ConnectorSpec = { + metadata: { + id: '.sf-webhook', + displayName: 'Single File Webhook', + description: 'demo', + minimumLicense: 'gold', + supportedFeatureIds: ['workflows'], + }, + + schema: z.object({ + method: z + .enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']) + .meta({ + label: 'Method', + }) + .default('POST'), + url: z.url().meta({ label: 'URL', placeholder: 'https://...' }), + }), + + authTypes: ['none', 'basic', 'bearer'], + + actions: { + submit: { + isTool: true, + input: z.object({ + body: z.string(), + }), + handler: async (ctx, input) => { + try { + ctx.client.request({ + method, + url, + data: input.body, + }); + + return { + ok: true, + message: 'Successfully connected to Single File Webhook', + }; + } catch (error) { + return { + ok: false, + message: `Failed to connect: ${error}`, + }; + } + }, + }, + }, + + test: { + handler: async (ctx) => { + try { + await ctx.client.get(''); + return { + ok: true, + message: 'Successfully connected to Single File Webhook', + }; + } catch (error) { + return { + ok: false, + message: `Failed to connect: ${error}`, + }; + } + }, + description: 'Verifies webhook connection alive', + }, +};