From bef153a25a451a753dccf22cd98efe1be43e7cfa Mon Sep 17 00:00:00 2001 From: Kyra Cho Date: Thu, 28 Nov 2024 03:59:23 -0800 Subject: [PATCH] [Core] Migrate SO `_migrate` route authorization to the new system (#200111) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Hi! 😊 this PR deals with #198181 ```diff router.post({ path: '/_migrate', - options: { - tags: ['access:migrateSavedObjects'], + security: { + authz: { + requiredPrivileges: ['migrateSavedObjects'], + }, ... }, handler); ``` ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [n/a] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [n/a] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [n/a] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [n/a] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [n/a] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [n/a] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [n/a] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine Co-authored-by: Alejandro Fernández Haro (cherry picked from commit c2c6f56aa823edf01db551a24815059a57709c9c) --- .../src/routes/migrate.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts index 9fe591d9c5214..f8a50d39271d6 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts @@ -19,8 +19,10 @@ export const registerMigrateRoute = ( { path: '/_migrate', validate: false, - options: { - tags: ['access:migrateSavedObjects'], + security: { + authz: { + requiredPrivileges: ['migrateSavedObjects'], + }, }, }, catchAndReturnBoomErrors(async (context, req, res) => {