Skip to content

Commit

Permalink
Unauthorized route migration for routes owned by security-defend-work…
Browse files Browse the repository at this point in the history
…flows (#198375)

### Authz API migration for unauthorized routes

Fix unauthorized routes
  • Loading branch information
kibanamachine authored Nov 18, 2024
1 parent 020acbe commit dbab221
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ export const createLiveQueryRoute = (router: IRouter, osqueryContext: OsqueryApp
.addVersion(
{
version: API_VERSIONS.public.v1,
security: {
authz: {
enabled: false,
reason:
'We do the check for 2 different scenarios below (const isInvalid): writeLiveQueries and runSavedQueries with saved_query_id, or pack_id',
},
},
validate: {
request: {
body: buildRouteValidation<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export function registerEndpointRoutes(
.addVersion(
{
version: '2023-10-31',
security: {
authz: {
requiredPrivileges: ['securitySolution'],
},
},
validate: {
request: GetMetadataRequestSchema,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export function registerPolicyRoutes(
.addVersion(
{
version: '2023-10-31',
security: {
authz: {
requiredPrivileges: ['securitySolution'],
},
},
validate: {
request: GetPolicyResponseSchema,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const registerResolverRoutes = (
router.post(
{
path: '/api/endpoint/resolver/tree',
security: {
authz: {
requiredPrivileges: ['securitySolution'],
},
},
validate: validateTree,
options: { authRequired: true },
},
Expand All @@ -44,6 +49,11 @@ export const registerResolverRoutes = (
router.post(
{
path: '/api/endpoint/resolver/events',
security: {
authz: {
requiredPrivileges: ['securitySolution'],
},
},
validate: validateEvents,
options: { authRequired: true },
},
Expand All @@ -56,6 +66,11 @@ export const registerResolverRoutes = (
router.get(
{
path: '/api/endpoint/resolver/entity',
security: {
authz: {
requiredPrivileges: ['securitySolution'],
},
},
validate: validateEntities,
options: { authRequired: true },
},
Expand Down

0 comments on commit dbab221

Please sign in to comment.