Skip to content

chore: remove unused native connector secrets code - #4524

Merged
Jan-Kazlouski-elastic merged 1 commit into
elastic:mainfrom
ShivamSharma43:cleanup/2990-native-connector-secrets
Oct 7, 2026
Merged

Jan-Kazlouski-elastic merged 1 commit into
elastic:mainfrom
ShivamSharma43:cleanup/2990-native-connector-secrets

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Part of #2990

#2989 removed _update_native_connector_authentication(), the only place the framework read a connector secret, and set native_connector_api_keys_enabled to False. Several pieces it relied on were left behind with no remaining callers. This PR removes those:

  • ESManagementClient.get_connector_secret()
  • the Connector.api_key_secret_id property
  • ApiKeyNotFoundError in sync_job_runner.py
  • Features.native_connector_api_keys_enabled() and the Features.NATIVE_CONNECTOR_API_KEYS constant in connectors_sdk

Their tests are removed with them, along with a leftover native_connector_api_keys_enabled mock in test_sync_job_runner.py.

Nothing here changes what is written to Elasticsearch or what Kibana sees. The following are deliberately left in place because removing them would be observable outside the framework, and are for a separate PR if that is wanted:

  • the native_connector_api_keys entry in BaseDataSource.features(), which is written into the connector doc
  • create_connector_secret(), which connectors connector create --native still uses to store an API key and set api_key_secret_id on the connector doc
  • api_key_secret_id in docs/CONNECTOR_PROTOCOL.md

Features.native_connector_api_keys_enabled() and NATIVE_CONNECTOR_API_KEYS are public in the published connectors_sdk package. Nothing in this repo uses them, but external code calling them would break.

Tests: make lint and make test pass in both app/connectors_service (2504 passed, 92.01% coverage) and libs/connectors_sdk (343 passed, 84.21% coverage).

Checklists

Pre-Review Checklist

  • this PR does NOT contain credentials of any kind, such as API keys or username/passwords (double check config.yml.example)
  • this PR has a meaningful title
  • this PR links to all relevant github issues that it fixes or partially addresses
  • Covered the changes with automated tests
  • Tested the changes locally (ran make lint and make test; not tested against a live cluster)

Related Pull Requests

Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 27, 2026 13:23
@ShivamSharma43
ShivamSharma43 requested a review from a team as a code owner September 27, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Jan-Kazlouski-elastic

Copy link
Copy Markdown
Contributor

buildkite test this

@Jan-Kazlouski-elastic

Copy link
Copy Markdown
Contributor

Thank you @ShivamSharma43
Taking a look.

the pieces it left with no remaining callers: get_connector_secret(),
the Connector.api_key_secret_id property, ApiKeyNotFoundError, and
Features.native_connector_api_keys_enabled() / NATIVE_CONNECTOR_API_KEYS,
along with their tests.

The native_connector_api_keys features entry, create_connector_secret()
and the CLI's use of it are left in place.

Part of elastic#2990

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShivamSharma43
ShivamSharma43 force-pushed the cleanup/2990-native-connector-secrets branch from 7b9a7d5 to a04844a Compare October 6, 2026 19:01

@Jan-Kazlouski-elastic Jan-Kazlouski-elastic 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.

LGTM

@Jan-Kazlouski-elastic

Copy link
Copy Markdown
Contributor

buildkite test this

@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic enabled auto-merge (squash) October 7, 2026 12:36
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic enabled auto-merge (squash) October 7, 2026 12:43
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit 8ade9c4 into elastic:main Oct 7, 2026
2 checks passed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

💔 Failed to create backport PR(s)

Status Branch Result
❌ 8.19 Commit could not be cherrypicked due to conflicts
✅ 9.5 #4575
✅ 9.4 #4576

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
backport --pr 4524 --autoMerge --autoMergeMethod squash

Jan-Kazlouski-elastic pushed a commit that referenced this pull request Oct 7, 2026
Backports the following commits to 9.5:
 - chore: remove unused native connector secrets code (#4524)

Co-authored-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Jan-Kazlouski-elastic pushed a commit that referenced this pull request Oct 7, 2026
Backports the following commits to 9.4:
 - chore: remove unused native connector secrets code (#4524)

Co-authored-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Jan-Kazlouski-elastic added a commit that referenced this pull request Oct 7, 2026
)

## Closes #2990

Follow-up to #4524. Since 9.0 (#2989) the framework never reads
connector secrets, but `connectors connector create --native` still
stored the connector API key in a connector secret and wrote its id to
`api_key_secret_id`. Nothing consumes that secret.

Changes:
- CLI no longer creates a connector secret; `api_key_secret_id` is
written as `null`
- Remove `ESManagementClient.create_connector_secret()` (CLI was the
only caller) and its test
- Remove `test_get_index_or_alias`, a copy of the secret test that never
called `get_index_or_alias` (covered by `test_extract_index_or_alias_*`)
- `CONNECTOR_PROTOCOL.md`: note `api_key_secret_id` is not read by the
framework since 9.0

Deliberately kept:
- `native_connector_api_keys` in `BaseDataSource.features()`: part of
the ES `ConnectorFeatures` schema; removing it would make native
connector docs be rewritten on every scheduler poll, because the key
sets would never match
- `api_key_secret_id` field: still part of the ES Connector API and
written by Kibana

Not for 8.19: 8.19 still reads connector secrets during native syncs.

## Checklists

#### Pre-Review Checklist
- [x] this PR does NOT contain credentials of any kind, such as API keys
or username/passwords (double check `config.yml.example`)
- [x] this PR has a meaningful title
- [x] this PR links to all relevant github issues that it fixes or
partially addresses
- [x] Covered the changes with automated tests
- [x] Tested the changes locally (`make clean install autoformat lint
test`)
- [x] Added a label for each target release version (example: `v7.13.2`,
`v7.14.0`, `v8.0.0`)

## Release Note

The `connectors connector create --native` CLI command no longer stores
the connector API key in a connector secret.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants