Skip to content

Commit

Permalink
[Authz] Explicitly added superuser privileges for security/session/_i…
Browse files Browse the repository at this point in the history
…nvalidate route
  • Loading branch information
elena-shostak committed Jan 21, 2025
1 parent 8d2a43a commit 93f987d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { ObjectType } from '@kbn/config-schema';
import type { RequestHandler, RouteConfig } from '@kbn/core/server';
import { kibanaResponseFactory } from '@kbn/core/server';
import { httpServerMock } from '@kbn/core/server/mocks';
import { ReservedPrivilegesSet } from '@kbn/core-http-server';
import type { PublicMethodsOf } from '@kbn/utility-types';

import { defineInvalidateSessionsRoutes } from './invalidate';
Expand Down Expand Up @@ -48,7 +49,9 @@ describe('Invalidate sessions routes', () => {
summary: 'Invalidate user sessions',
});

expect(routeConfig.security?.authz).toEqual({ requiredPrivileges: ['sessionManagement'] });
expect(routeConfig.security?.authz).toEqual({
requiredPrivileges: [ReservedPrivilegesSet.superuser],
});

const bodySchema = (routeConfig.validate as any).body as ObjectType;
expect(() => bodySchema.validate({})).toThrowErrorMatchingInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { ReservedPrivilegesSet } from '@kbn/core-http-server';

import type { RouteDefinitionParams } from '..';

Expand Down Expand Up @@ -39,7 +40,7 @@ export function defineInvalidateSessionsRoutes({
},
security: {
authz: {
requiredPrivileges: ['sessionManagement'],
requiredPrivileges: [ReservedPrivilegesSet.superuser],
},
},
options: {
Expand Down

0 comments on commit 93f987d

Please sign in to comment.