Skip to content

[Connectors] implement support for proxy-authorization - #258443

Closed
pmuellr wants to merge 11 commits into
elastic:mainfrom
pmuellr:106770-proxy-auth
Closed

pmuellr wants to merge 11 commits into
elastic:mainfrom
pmuellr:106770-proxy-auth

Conversation

@pmuellr

@pmuellr pmuellr commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

resolves #106770

Release Note

Adds support for proxy-authorization for connectors with Kibana config settings xpack.actions.proxyUser and xpack.actions.proxyPassword.

Summary

Initial commit generated with Cursor

cursor prompt

Add two new Kibana config settings, xpack.actions.proxyUser and xpack.actions.proxyPassword in the actions plugin. These will be for the authentication of the proxy itself. The file src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker should be updated with these config values. The documentation docs/reference/configuration-reference/alerting-settings.md should be updated. These values should be used when the axios code in the actions plugin, when a proxy is used and has these values set. Jest unit tests should be added. Function tests should be added.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

resolves elastic#106770

Initial commit generated with Cursor

<details><summary>cursor prompt</summary>

Add two new Kibana config settings, `xpack.actions.proxyUser` and `xpack.actions.proxyPassword` in the actions plugin.  These will be for the authentication of the proxy itself.  The file `src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker` should be updated with these config values.  The documentation `docs/reference/configuration-reference/alerting-settings.md` should be updated.  These values should be used when the axios code in the actions plugin, when a proxy is used and has these values set.  Jest unit tests should be added.  Function tests should be added.

</details>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

@github-actions

Copy link
Copy Markdown
Contributor

✅ Vale Linting Results

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide.

To use Vale locally or report issues, refer to Elastic style guide for Vale.

);
let proxyAuth: string | undefined;
if (hasUrlAuth) {
proxyAuth = `${decodeURIComponent(proxyUrl.username)}:${decodeURIComponent(proxyUrl.password)}`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was surprised to learn that the username/password from URL are encoded!

$ node -p 'new URL("https://elas<tic:changeme@example.com")'
URL {
  ...
  username: 'elas%3Ctic',
  ...
}

const withAuth = new URL(proxySettings.proxyUrl);
withAuth.username = proxySettings.proxyUser as string;
withAuth.password = proxySettings.proxyPassword as string;
httpProxyAgentUrl = withAuth.toString();

@pmuellr pmuellr Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This adds the auth info to the URL. Which the http agents we use check for explicitly (I don't remember them doing that when we first started using it), and send the appropriate auth headers for.

You'll also see we set the auth option for the HttpsProxyAgent, to the same value. It looks like the HttpProxyAgent also accepts options now (I think it didn't use to, except maybe timeout?). So seems like these should be aligned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, should we align them with this PR?
Because proxyAuth is decoded but httpProxyAgentUrl is not, they may send different credentials.

@pmuellr

pmuellr commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

As of commit 00c13ed, I've tested the proxy code with mitmproxy - nice tool. Configured it for http proxy with auth, created a webhook pointed to GET kibana's root URL, everything seemed to work as expected, traced it via VSCode debugging.

Just got to get the FT working ...

@pmuellr
pmuellr marked this pull request as ready for review March 30, 2026 13:53
@pmuellr
pmuellr requested review from a team as code owners March 30, 2026 13:53
@pmuellr pmuellr added Feature:Actions Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// release_note:feature Makes this part of the condensed release notes backport:all-open Backport to all branches that could still receive a release labels Mar 30, 2026
@elasticmachine

Copy link
Copy Markdown
Contributor

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

@elasticmachine

elasticmachine commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #8 / getColumns rule column renders rule name as a PreviewLink when hidePreviewLink is false
  • [job] [logs] Jest Tests #8 / getColumns rule column renders rule name as a PreviewLink when hidePreviewLink is false
  • [job] [logs] Jest Tests #8 / getColumns rule column renders rule name as plain text when user cannot read rules
  • [job] [logs] Jest Tests #8 / getColumns rule column renders rule name as plain text when user cannot read rules

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 26 27 +1
@kbn/alerting-api-integration-helpers 28 29 +1
total +2

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/alerting-api-integration-helpers 3 1 -2
Unknown metric groups

API count

id before after diff
@kbn/actions-utils 26 28 +2
@kbn/alerting-api-integration-helpers 28 29 +1
total +3

ESLint disabled line counts

id before after diff
@kbn/alerting-api-integration-helpers 0 2 +2

Total ESLint disabled count

id before after diff
@kbn/alerting-api-integration-helpers 0 2 +2

History

@florent-leborgne florent-leborgne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM for docs - just some quick additions needed to specify the version in which these become available


$$$action-config-proxy-user$$$

`xpack.actions.proxyUser` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
`xpack.actions.proxyUser` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}')
`xpack.actions.proxyUser` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}') {applies_to}`stack: ga 9.4+`


$$$action-config-proxy-password$$$

`xpack.actions.proxyPassword` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
`xpack.actions.proxyPassword` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}')
`xpack.actions.proxyPassword` ![logo cloud](https://doc-icons.s3.us-east-2.amazonaws.com/logo_cloud.svg 'Supported on {{ech}}') {applies_to}`stack: ga 9.4+`

If your proxy is using the https protocol (vs the http protocol), the setting `xpack.actions.ssl.proxyVerificationMode: none` will likely be needed, unless your proxy’s certificates are signed using a publicly available certificate authority.

There is currently no support for using basic authentication with a proxy (authentication for the proxy itself, not the URL being requested through the proxy).
You can supply proxy credentials in the URL (`http://user:password@proxy-host:8080`) or use [`xpack.actions.proxyUser`](#action-config-proxy-user) and [`xpack.actions.proxyPassword`](#action-config-proxy-password). If the URL already includes a username and password, those take precedence over the separate settings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
You can supply proxy credentials in the URL (`http://user:password@proxy-host:8080`) or use [`xpack.actions.proxyUser`](#action-config-proxy-user) and [`xpack.actions.proxyPassword`](#action-config-proxy-password). If the URL already includes a username and password, those take precedence over the separate settings.
{applies_to}`stack: ga 9.4+` You can supply proxy credentials in the URL (`http://user:password@proxy-host:8080`) or use [`xpack.actions.proxyUser`](#action-config-proxy-user) and [`xpack.actions.proxyPassword`](#action-config-proxy-password). If the URL already includes a username and password, those take precedence over the separate settings.

@darnautov
darnautov requested a review from ersin-erdal April 1, 2026 09:02

@ersin-erdal ersin-erdal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good but I asked some question, if we think they are OK or we can address with separate PRs I can approve.

headers: proxySettings.proxyHeaders,
...(proxyUrl.username &&
proxyUrl.password && { auth: `${proxyUrl.username}:${proxyUrl.password}` }),
...(proxyAuth && { auth: proxyAuth }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be a breaking change for the existing users if they have special characters in their creds?

proxySettings.proxyUser &&
proxySettings.proxyPassword &&
proxySettings.proxyUser !== '' &&
proxySettings.proxyPassword !== ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: Boolean('') is already false.

expect(proxyAuthHeader).to.eql(BasicAuthHeader);
});
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe a negative test too?

proxyServer.web(req, res);
});
server.listen(proxyPort);
return server as unknown as httpProxy;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would changing the return type to httpProxy | http.Server fix this?

const withAuth = new URL(proxySettings.proxyUrl);
withAuth.username = proxySettings.proxyUser as string;
withAuth.password = proxySettings.proxyPassword as string;
httpProxyAgentUrl = withAuth.toString();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, should we align them with this PR?
Because proxyAuth is decoded but httpProxyAgentUrl is not, they may send different credentials.

@pmuellr

pmuellr commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

We have another proxy package upgrade in the works, so will pick this up again when it merges: #267282

@florent-leborgne

Copy link
Copy Markdown
Member

Not moving, turning into draft to stop getting the review reminders

@pmuellr

pmuellr commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Support for this was added in #256491 , and there is still a doc issue open to document the new capability: elastic/docs-content#5731 (comment)

@pmuellr pmuellr closed this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release Feature:Actions release_note:feature Makes this part of the condensed release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Connectors] Implement support for Proxy-Authorization.

6 participants