Skip to content

Commit 2160dd1

Browse files
Unauthorized route migration for routes owned by kibana-management (#214782)
### Authz API migration for unauthorized routes This PR migrates last unauthorized routes owned by your team to a 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:** ```ts router.get({ path: '/api/path', ... }, handler); ``` ### **After migration:** ```ts router.get({ path: '/api/path', security: { authz: { enabled: false, reason: 'This route is opted out from authorization because ...', }, }, ... }, handler); ```
1 parent 04cc68a commit 2160dd1

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

x-pack/platform/plugins/private/grokdebugger/server/lib/kibana_framework.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class KibanaFramework {
6060
const routeConfig = {
6161
path: config.path,
6262
validate: config.validate,
63+
security: config.security,
6364
};
6465

6566
switch (config.method) {

x-pack/platform/plugins/shared/license_management/server/routes/api/license/register_start_trial_routes.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,26 @@ export function registerStartTrialRoutes({
3535
}
3636
);
3737

38-
router.post({ path: addBasePath('/start_trial'), validate: false }, async (ctx, req, res) => {
39-
const { client } = (await ctx.core).elasticsearch;
40-
try {
41-
return res.ok({
42-
body: await startTrial({ client, licensing }),
43-
});
44-
} catch (error) {
45-
return handleEsError({ error, response: res });
38+
router.post(
39+
{
40+
path: addBasePath('/start_trial'),
41+
validate: false,
42+
security: {
43+
authz: {
44+
enabled: false,
45+
reason: 'Relies on es client for authorization',
46+
},
47+
},
48+
},
49+
async (ctx, req, res) => {
50+
const { client } = (await ctx.core).elasticsearch;
51+
try {
52+
return res.ok({
53+
body: await startTrial({ client, licensing }),
54+
});
55+
} catch (error) {
56+
return handleEsError({ error, response: res });
57+
}
4658
}
47-
});
59+
);
4860
}

0 commit comments

Comments
 (0)