Skip to content

Commit 20076c3

Browse files
elena-shostakcqliu1
authored andcommitted
Unauthorized route migration for routes owned by search-kibana (elastic#214786)
### 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 ae43396 commit 20076c3

File tree

3 files changed

+36
-0
lines changed
  • x-pack/solutions/search
    • packages/kbn-search-api-keys-server/src/routes
    • plugins

3 files changed

+36
-0
lines changed

x-pack/solutions/search/packages/kbn-search-api-keys-server/src/routes/routes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export function registerSearchApiKeysRoutes(router: IRouter, logger: Logger) {
2020
router.post(
2121
{
2222
path: APIRoutes.API_KEY_VALIDITY,
23+
security: {
24+
authz: {
25+
enabled: false,
26+
reason: 'This route delegates authorization to the scoped ES client',
27+
},
28+
},
2329
validate: {
2430
body: schema.object({
2531
id: schema.string(),
@@ -60,6 +66,12 @@ export function registerSearchApiKeysRoutes(router: IRouter, logger: Logger) {
6066
router.post(
6167
{
6268
path: APIRoutes.API_KEYS,
69+
security: {
70+
authz: {
71+
enabled: false,
72+
reason: 'This route delegates authorization to the scoped ES client',
73+
},
74+
},
6375
validate: {},
6476
options: {
6577
access: 'internal',

x-pack/solutions/search/plugins/search_inference_endpoints/server/routes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export function defineRoutes({ logger, router }: { logger: Logger; router: IRout
1818
router.get(
1919
{
2020
path: APIRoutes.GET_INFERENCE_ENDPOINTS,
21+
security: {
22+
authz: {
23+
enabled: false,
24+
reason: 'This route delegates authorization to the scoped ES client',
25+
},
26+
},
2127
validate: {},
2228
},
2329
errorHandler(logger)(async (context, request, response) => {
@@ -39,6 +45,12 @@ export function defineRoutes({ logger, router }: { logger: Logger; router: IRout
3945
router.delete(
4046
{
4147
path: APIRoutes.INFERENCE_ENDPOINT,
48+
security: {
49+
authz: {
50+
enabled: false,
51+
reason: 'This route delegates authorization to the scoped ES client',
52+
},
53+
},
4254
validate: {
4355
params: schema.object({
4456
type: schema.string(),

x-pack/solutions/search/plugins/search_notebooks/server/routes/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ export function defineRoutes({ config, notebooksCache, logger, router }: RouteDe
1616
router.get(
1717
{
1818
path: '/internal/search_notebooks/notebooks',
19+
security: {
20+
authz: {
21+
enabled: false,
22+
reason: 'This route delegates authorization to the notebook service',
23+
},
24+
},
1925
validate: {
2026
query: schema.object({
2127
list: schema.maybe(schema.string()),
@@ -44,6 +50,12 @@ export function defineRoutes({ config, notebooksCache, logger, router }: RouteDe
4450
router.get(
4551
{
4652
path: '/internal/search_notebooks/notebooks/{notebookId}',
53+
security: {
54+
authz: {
55+
enabled: false,
56+
reason: 'This route delegates authorization to the notebook service',
57+
},
58+
},
4759
validate: {
4860
params: schema.object({
4961
notebookId: schema.string(),

0 commit comments

Comments
 (0)