Skip to content

Conversation

@ymao1
Copy link
Contributor

@ymao1 ymao1 commented Nov 21, 2025

Resolves #243819

Summary

Adding two auth types to handle pfx and crt certificate authentication. If a connector is configured with custom certificates, we need to regenerate the http and https agents that are used by the axios instance to take into account the custom SSL settings for the connector.

@ymao1 ymao1 changed the title Adding pfx and crt certificate auth [ConnectorsV2] Adding pfx and crt certificate auth types Nov 21, 2025
export type { CustomHostSettings, ProxySettings, SSLSettings } from './utils/types';
export { customHostSettingsSchema } from './utils/types';
export { getNodeSSLOptions, getSSLSettingsFromConfig } from './utils/get_node_ssl_options';
export { getCustomAgents } from './utils/get_custom_agents';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these functions to a package so we could use them from another package.

@ymao1 ymao1 force-pushed the connector-v2-auth-cert branch from 183f1a2 to 0032321 Compare November 25, 2025 18:32
url: string;
}

export function getCustomAgents(opts: GetCustomAgentsOpts): GetCustomAgentsResponse {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the getCustomAgents function from the actions plugin, but with the settings passed in as parameters instead of using actionConfigurationUtilities to retrieve configuration settings.

secret: AuthSchemaType
): AxiosInstance => {
const sslOverrides: SSLSettings = {
cert: Buffer.from(secret.crt, 'base64'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based off our current webhook connector, where the cert and key are base 64 encoded before being passed to the create API. Perhaps we can add a meta designation that a field should be base64 encoded so the form builder knows what to do? cc @jcger

Copy link
Contributor

@jcger jcger Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We render an <input type="file"... /> for this in the webhook connector. Do you think we could use https://zod.dev/api#files ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it could be worth a try

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the docs for z.file and it only allows you to set a mime type, from which the other properties of the file are derived. None of the mime types identify a base 64 encoding. I did see that there's a z.base64 type that validates an input is base 64 encoded, so I switched to using that, but we can probably change it as needed when the form builder part is worked on.

@ymao1 ymao1 self-assigned this Nov 25, 2025
@ymao1
Copy link
Contributor Author

ymao1 commented Nov 25, 2025

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Dec 2, 2025

@elasticmachine run docs-build

@ymao1 ymao1 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Feature:Actions/Framework Issues related to the Actions Framework v9.3.0 labels Dec 3, 2025
@ymao1 ymao1 marked this pull request as ready for review December 3, 2025 01:51
@ymao1 ymao1 requested review from a team as code owners December 3, 2025 01:51
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

/**
* Authenticate with PFX certificate
*/
export const PFX: AuthTypeSpec<AuthSchemaType> = {
Copy link
Contributor

@jcger jcger Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a Kibana config called xpack.actions.webhook.ssl.pfx.enabled, it looks like it should only apply to the webhook connector because of its name, but in FedRAMP's spirit, it should apply to all connectors that have SSL auth type. I'll create an issue to add a more generic option, something like xpack.actions.auth.ssl.pfx.enabled or similar, done: #245079)

Anyways, with this context, now that we will activate SSL auth type as an option to choose from when creating a workflow connector, we should check whether pfx is actually enabled and handle it accordingly

Copy link
Contributor Author

@ymao1 ymao1 Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling that out! Updated in 73f4623

@ymao1
Copy link
Contributor Author

ymao1 commented Dec 3, 2025

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/actions-utils - 24 +24
@kbn/connector-specs 138 142 +4
actions 373 366 -7
total +21

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
stackConnectors 826.5KB 827.5KB +1.0KB
workflowsManagement 4.2MB 4.2MB +934.0B
total +1.9KB
Unknown metric groups

API count

id before after diff
@kbn/actions-utils - 24 +24
@kbn/connector-specs 144 148 +4
actions 379 372 -7
total +21

ESLint disabled line counts

id before after diff
actions 10 11 +1

Total ESLint disabled count

id before after diff
actions 12 13 +1

History

cc @ymao1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Actions/Framework Issues related to the Actions Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ConnectorsV2][Phase 2] Add support for the SSL auth type

4 participants