Skip to content

[WorkplaceAI][PerUserAuth] Implement Encrypted Saved Objects recommendations#252104

Merged
lorenabalan merged 20 commits intoconnectors-auth-code-grantfrom
lb/fix-eso
Feb 26, 2026
Merged

[WorkplaceAI][PerUserAuth] Implement Encrypted Saved Objects recommendations#252104
lorenabalan merged 20 commits intoconnectors-auth-code-grantfrom
lb/fix-eso

Conversation

@lorenabalan
Copy link
Copy Markdown
Contributor

@lorenabalan lorenabalan commented Feb 6, 2026

Summary

Addressing #246655 (review) & #251873 (comment)

Changes:

  • Reduced the AAD footprint of the oauth_state SO (this SO was first introduced in the feature branch, so we don't need to issue a migration for it, we can just iterate directly)
  • Used createModelVersion wrapper (as per docs) for connector_token SO. In the feature branch we had enhanced the object by adding refreshTokenExpiresAt as a new AAD and refreshToken as a new encrypted field. expiresAt was also turned into an optional field.

Testing

Tests run by default with the oauth_authorization_code feature flag disabled. In order to check the tests with it enabled you need to modify x-pack/platform/plugins/shared/encrypted_saved_objects/integration_tests/ci_checks/check_registered_types.test.ts :

  • bump ESO_TYPES_COUNT to 21 (the extra models registered are oauth_state and user_connector_token)
  • then update beforeAll() to contain
        root = createRootWithCorePlugins(
          { xpack: { actions: { auth: { oauth_authorization_code: { enabled: true } } } } },
          { oss: false }
        );

Run both

node scripts/jest_integration x-pack/platform/plugins/shared/encrypted_saved_objects/integration_tests/ci_checks/check_registered_types.test.ts -u

and

node scripts/jest_integration src/core/server/integration_tests/ci_checks/saved_objects/check_registered_types.test.ts -u        

You should see updates to toMatchInlineSnapshot in the tests like

-"connector_token": "16ca2154c13c5ee3d3a45b55d4ea6cd33aeaceaef3dc229b002d25470bfc9b3b",
+ "connector_token": "e446f5ff0fbf516f63398e474f126332b4c31e316daa613c6cb8c863400110c5",
...
+ "oauth_state": "b01289e5c133db9d4d802a2b838e43cce4a8399566dedb21de551da57c88894a",
...
+ "user_connector_token": "b443b022b46b79c0ff9fa674aecc64176a5fcbd09c2db2d9f050a6a88435732e",

⚠️⚠️⚠️ When we enable the feature by default, we'll probably also have to update this test file (uncomment)

Misc

Old question
What's not entirely clear to me is release strategy for the connectors-auth-code-grant feature branch, given https://docs.elastic.dev/kibana-dev-docs/key-concepts/encrypted-saved-objects-intro#serverless-considerations

This will require 2 Serverless release stages.
Release 1: Add the attribute to the ESO's attributesToIncludeInAAD. Do not yet populate or use the new attribute. Release 2: Implement a Model Version and wrap it in a call to createModelVersion, providing the former EncryptedSavedObjectTypeRegistration as the input type, and the new EncryptedSavedObjectTypeRegistration as the output type. Implement a Model Version backfill change as needed. The attribute can safely be populated in this release.

Do we need to first merge a small PR to main that adds the refreshTokenExpiresAt field to the connector_token SO, then wait a day and merge the rest of the feature branch?

Answer: #252735 (review)

@lorenabalan lorenabalan marked this pull request as ready for review February 10, 2026 13:52
@lorenabalan lorenabalan requested review from a team as code owners February 10, 2026 13:52
// redirectUri: {
// type: 'keyword',
// },
// authorizationUrl: {
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 field doesn't actually look like it exists anymore looking at the schema, must've been a leftover from a refactoring.

@jcger jcger force-pushed the connectors-auth-code-grant branch from 20719b9 to e7e0dd0 Compare February 25, 2026 09:40
jeramysoucy added a commit that referenced this pull request Feb 25, 2026
## Summary

Closes elastic/kibana-team#2867

The `Check Saved Objects` CI check performs automated upgrade and
rollback testing for any updated SO types.
None of the Encrypted Saved Objects had been updated since the check was
put in place, up until recently.

To add support for ESOs, the `KibanaMigratorTestKit` must accept an
_encryptedSavedObjects_ service, so that the underlying SOR can be built
with the encryption extension.

This PR adds a workaround to support encryption / decryption in the
`KibanaMigratorTestKit`, unblocking
#252104.

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner February 25, 2026 14:34
@lorenabalan lorenabalan merged commit e3bb9cd into connectors-auth-code-grant Feb 26, 2026
11 of 13 checks passed
@lorenabalan lorenabalan deleted the lb/fix-eso branch February 26, 2026 11:24
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 26, 2026

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] x-pack/platform/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts / alerting api integration security and spaces enabled - Group 2 Connectors Jira Jira - Action Creation should return 200 when creating a jira action successfully
  • [job] [logs] x-pack/platform/test/alerting_api_integration/security_and_spaces/group2/config.ts / alerting api integration security and spaces enabled - Group 2 Connectors Jira Jira - Action Creation should return 200 when creating a jira action successfully
  • [job] [logs] x-pack/platform/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts / alerting api integration security and spaces enabled - Group 2 Connectors Jira Jira - Action Creation should return 200 when creating a jira action successfully

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [bc79bda]

History

qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
…53470)

## Summary

Closes elastic/kibana-team#2867

The `Check Saved Objects` CI check performs automated upgrade and
rollback testing for any updated SO types.
None of the Encrypted Saved Objects had been updated since the check was
put in place, up until recently.

To add support for ESOs, the `KibanaMigratorTestKit` must accept an
_encryptedSavedObjects_ service, so that the underlying SOR can be built
with the encryption extension.

This PR adds a workaround to support encryption / decryption in the
`KibanaMigratorTestKit`, unblocking
elastic#252104.

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
jcger added a commit that referenced this pull request Mar 18, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- #246655
- #251873
- #251717
- #252566
- #252104
- #252307
- #252262
- #252501
- #253606
- #254589
- #254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 18, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- elastic#246655
- elastic#251873
- elastic#251717
- elastic#252566
- elastic#252104
- elastic#252307
- elastic#252262
- elastic#252501
- elastic#253606
- elastic#254589
- elastic#254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- elastic#246655
- elastic#251873
- elastic#251717
- elastic#252566
- elastic#252104
- elastic#252307
- elastic#252262
- elastic#252501
- elastic#253606
- elastic#254589
- elastic#254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants