[9.0] Unauthorized route migration for routes owned by kibana-presentation (#214783) (#214845)

# Backport

This will backport the following commits from `main` to `9.0`:
- [Unauthorized route migration for routes owned by kibana-presentation
(#214783)](https://github.com/elastic/kibana/pull/214783)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Elena
Shostak","email":"165678770+elena-shostak@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-17T17:34:43Z","message":"Unauthorized
route migration for routes owned by kibana-presentation (#214783)\n\n###
Authz API migration for unauthorized routes\n\nThis PR migrates last
unauthorized routes owned by your team to a new\nsecurity
configuration.\nPlease refer to the documentation for more information:
[Authorization\nAPI](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization)\n\n###
**Before migration:**\n```ts\nrouter.get({\n path: '/api/path',\n
...\n}, handler);\n```\n\n### **After
migration:**\n```ts\nrouter.get({\n path: '/api/path',\n security: {\n
authz: {\n enabled: false,\n reason: 'This route is opted out from
authorization because ...',\n },\n },\n ...\n},
handler);\n```","sha":"e5e42a87ea22d957000fe77a9e09929d9d45b5ff","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["enhancement","Team:Presentation","release_note:skip","Feature:Security/Authorization","backport:prev-minor","backport:version","Authz:
API migration","v9.1.0","v8.19.0"],"title":"Unauthorized route migration
for routes owned by
kibana-presentation","number":214783,"url":"https://github.com/elastic/kibana/pull/214783","mergeCommit":{"message":"Unauthorized
route migration for routes owned by kibana-presentation (#214783)\n\n###
Authz API migration for unauthorized routes\n\nThis PR migrates last
unauthorized routes owned by your team to a new\nsecurity
configuration.\nPlease refer to the documentation for more information:
[Authorization\nAPI](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization)\n\n###
**Before migration:**\n```ts\nrouter.get({\n path: '/api/path',\n
...\n}, handler);\n```\n\n### **After
migration:**\n```ts\nrouter.get({\n path: '/api/path',\n security: {\n
authz: {\n enabled: false,\n reason: 'This route is opted out from
authorization because ...',\n },\n },\n ...\n},
handler);\n```","sha":"e5e42a87ea22d957000fe77a9e09929d9d45b5ff"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214783","number":214783,"mergeCommit":{"message":"Unauthorized
route migration for routes owned by kibana-presentation (#214783)\n\n###
Authz API migration for unauthorized routes\n\nThis PR migrates last
unauthorized routes owned by your team to a new\nsecurity
configuration.\nPlease refer to the documentation for more information:
[Authorization\nAPI](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization)\n\n###
**Before migration:**\n```ts\nrouter.get({\n path: '/api/path',\n
...\n}, handler);\n```\n\n### **After
migration:**\n```ts\nrouter.get({\n path: '/api/path',\n security: {\n
authz: {\n enabled: false,\n reason: 'This route is opted out from
authorization because ...',\n },\n },\n ...\n},
handler);\n```","sha":"e5e42a87ea22d957000fe77a9e09929d9d45b5ff"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Shostak <165678770+elena-shostak@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2025-03-17 20:22:32 +01:00 committed by GitHub
parent 9ea96f353a
commit 1864c03e60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,6 +57,12 @@ export function registerAPIRoutes({
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
});
createRoute.addVersion(
@ -130,6 +136,12 @@ export function registerAPIRoutes({
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
});
updateRoute.addVersion(
@ -192,6 +204,12 @@ export function registerAPIRoutes({
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
});
listRoute.addVersion(
@ -266,6 +284,12 @@ export function registerAPIRoutes({
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
});
getRoute.addVersion(
@ -327,6 +351,12 @@ export function registerAPIRoutes({
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
});
deleteRoute.addVersion(