From 3e4229206589f9854b3f9ecca7862dfd28072cbc Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:40:19 +1100 Subject: [PATCH] [8.x] Updates auth access model for dynamic_index_pattern endpoint (#204472) (#204489) # Backport This will backport the following commits from `main` to `8.x`: - [Updates auth access model for dynamic_index_pattern endpoint (#204472)](https://github.com/elastic/kibana/pull/204472) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Jason Rhodes --- .../observability/server/routes/rules/route.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x-pack/solutions/observability/plugins/observability/server/routes/rules/route.ts b/x-pack/solutions/observability/plugins/observability/server/routes/rules/route.ts index 909b11cb713a9..a7d03e11b9890 100644 --- a/x-pack/solutions/observability/plugins/observability/server/routes/rules/route.ts +++ b/x-pack/solutions/observability/plugins/observability/server/routes/rules/route.ts @@ -11,10 +11,14 @@ import { createObservabilityServerRoute } from '../create_observability_server_r const alertsDynamicIndexPatternRoute = createObservabilityServerRoute({ endpoint: 'GET /api/observability/rules/alerts/dynamic_index_pattern 2023-10-31', - options: { - tags: [], - access: 'public', + security: { + authz: { + enabled: false, + reason: + 'This endpoint returns alert index names for a set of registration contexts and has traditionally required no specific authorization', + }, }, + options: { access: 'public' }, params: t.type({ query: t.type({ registrationContexts: t.array(t.string), @@ -24,6 +28,7 @@ const alertsDynamicIndexPatternRoute = createObservabilityServerRoute({ handler: async ({ dependencies, params }) => { const { namespace, registrationContexts } = params.query; const { ruleDataService } = dependencies; + const indexNames = registrationContexts.flatMap((registrationContext) => { const indexName = ruleDataService .findIndexByName(registrationContext, Dataset.alerts)