Unauthorized route migration for routes owned by response-ops (#214785)

### 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);
```
This commit is contained in:
Elena Shostak 2025-03-17 17:08:59 +01:00 committed by GitHub
parent f82949698a
commit 229dca52a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 35 additions and 0 deletions

View file

@ -22,6 +22,12 @@ export const fillGapByIdRoute = (
router.post(
{
path: `${INTERNAL_ALERTING_GAPS_FILL_BY_ID_API_PATH}`,
security: {
authz: {
enabled: false,
reason: 'This route delegates authorization to the scoped ES client',
},
},
validate: {
query: fillGapByIdQuerySchemaV1,
},

View file

@ -23,6 +23,12 @@ export const findGapsRoute = (
router.post(
{
path: INTERNAL_ALERTING_GAPS_FIND_API_PATH,
security: {
authz: {
enabled: false,
reason: 'This route delegates authorization to the scoped ES client',
},
},
validate: {
body: findGapsBodySchemaV1,
},

View file

@ -23,6 +23,12 @@ export const getGapsSummaryByRuleIdsRoute = (
router.post(
{
path: `${INTERNAL_ALERTING_GAPS_GET_SUMMARY_BY_RULE_IDS_API_PATH}`,
security: {
authz: {
enabled: false,
reason: 'This route delegates authorization to the scoped ES client',
},
},
validate: {
body: getGapsSummaryByRuleIdsBodySchemaV1,
},

View file

@ -23,6 +23,12 @@ export const getRuleIdsWithGapsRoute = (
router.post(
{
path: `${INTERNAL_ALERTING_GAPS_GET_RULES_API_PATH}`,
security: {
authz: {
enabled: false,
reason: 'This route delegates authorization to the scoped ES client',
},
},
validate: {
body: getRuleIdsWithGapBodySchemaV1,
},

View file

@ -59,6 +59,7 @@ export const getCaseRoute = () =>
export const resolveCaseRoute = createCasesRoute({
method: 'get',
path: `${CASE_DETAILS_URL}/resolve`,
security: DEFAULT_CASES_ROUTE_SECURITY,
routerOptions: {
access: 'internal',
},

View file

@ -10,10 +10,12 @@ import { INTERNAL_CASE_SIMILAR_CASES_URL } from '../../../../common/constants';
import { createCaseError } from '../../../common/error';
import { createCasesRoute } from '../create_cases_route';
import type { caseApiV1 } from '../../../../common/types/api';
import { DEFAULT_CASES_ROUTE_SECURITY } from '../constants';
export const similarCaseRoute = createCasesRoute({
method: 'post',
path: INTERNAL_CASE_SIMILAR_CASES_URL,
security: DEFAULT_CASES_ROUTE_SECURITY,
params: {
params: schema.object({
case_id: schema.string(),

View file

@ -12,6 +12,7 @@ import type { attachmentApiV1, userActionApiV1 } from '../../../../common/types/
import { INTERNAL_CASE_FIND_USER_ACTIONS_URL } from '../../../../common/constants';
import { createCaseError } from '../../../common/error';
import { createCasesRoute } from '../create_cases_route';
import { DEFAULT_CASES_ROUTE_SECURITY } from '../constants';
const params = {
params: schema.object({
@ -22,6 +23,7 @@ const params = {
export const findUserActionsRoute = createCasesRoute({
method: 'get',
path: INTERNAL_CASE_FIND_USER_ACTIONS_URL,
security: DEFAULT_CASES_ROUTE_SECURITY,
params,
routerOptions: {
access: 'public',

View file

@ -9,10 +9,12 @@ import { schema } from '@kbn/config-schema';
import { INTERNAL_CASE_OBSERVABLES_DELETE_URL } from '../../../../common/constants';
import { createCaseError } from '../../../common/error';
import { createCasesRoute } from '../create_cases_route';
import { DEFAULT_CASES_ROUTE_SECURITY } from '../constants';
export const deleteObservableRoute = createCasesRoute({
method: 'delete',
path: INTERNAL_CASE_OBSERVABLES_DELETE_URL,
security: DEFAULT_CASES_ROUTE_SECURITY,
params: {
params: schema.object({
case_id: schema.string(),

View file

@ -10,10 +10,12 @@ import { INTERNAL_CASE_OBSERVABLES_PATCH_URL } from '../../../../common/constant
import { createCaseError } from '../../../common/error';
import { createCasesRoute } from '../create_cases_route';
import type { observableApiV1 } from '../../../../common/types/api';
import { DEFAULT_CASES_ROUTE_SECURITY } from '../constants';
export const patchObservableRoute = createCasesRoute({
method: 'patch',
path: INTERNAL_CASE_OBSERVABLES_PATCH_URL,
security: DEFAULT_CASES_ROUTE_SECURITY,
params: {
params: schema.object({
case_id: schema.string(),

View file

@ -10,10 +10,12 @@ import { INTERNAL_CASE_OBSERVABLES_URL } from '../../../../common/constants';
import { createCaseError } from '../../../common/error';
import { createCasesRoute } from '../create_cases_route';
import type { observableApiV1 } from '../../../../common/types/api';
import { DEFAULT_CASES_ROUTE_SECURITY } from '../constants';
export const postObservableRoute = createCasesRoute({
method: 'post',
path: INTERNAL_CASE_OBSERVABLES_URL,
security: DEFAULT_CASES_ROUTE_SECURITY,
params: {
params: schema.object({
case_id: schema.string(),