-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.x] Authorized route migration for routes owned by kibana-security (#198380) #198657
[8.x] Authorized route migration for routes owned by kibana-security (#198380) #198657
Conversation
…ic#198380) ### Authz API migration for authorized routes This PR migrates `access:<privilege>` tags used in route definitions to new security configuration. Please refer to the documentation for more information: [Authorization API](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization) ### **Before migration:** Access control tags were defined in the `options` object of the route: ```ts router.get({ path: '/api/path', options: { tags: ['access:<privilege_1>', 'access:<privilege_2>'], }, ... }, handler); ``` ### **After migration:** Tags have been replaced with the more robust `security.authz.requiredPrivileges` field under `security`: ```ts router.get({ path: '/api/path', security: { authz: { requiredPrivileges: ['<privilege_1>', '<privilege_2>'], }, }, ... }, handler); ``` ### What to do next? 1. Review the changes in this PR. 2. You might need to update your tests to reflect the new security configuration: - If you have tests that rely on checking `access` tags. - If you have snapshot tests that include the route definition. - If you have FTR tests that rely on checking unauthorized error message. The error message changed to also include missing privileges. ## Any questions? If you have any questions or need help with API authorization, please reach out to the `@elastic/kibana-security` team. --------- Co-authored-by: Elena Shostak <[email protected]> (cherry picked from commit 20989b6) # Conflicts: # x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.test.ts # x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.ts # x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.test.ts # x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.ts
💚 Build Succeeded
Metrics [docs]
|
@@ -37,14 +37,19 @@ export function defineInvalidateSessionsRoutes({ | |||
), | |||
}), | |||
}, | |||
security: { | |||
authz: { | |||
requiredPrivileges: ['sessionManagement'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: just for my understanding, I see we renamed access:manageSpaces
to manage_spaces
, but access:sessionManagement
stayed as sessionManagement
, is it intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, we just forgot to rename it too, there should consistency between naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue for that #198716
Backport
This will backport the following commits from
main
to8.x
:Questions ?
Please refer to the Backport tool documentation