[Entity Analytics][Privmon] Remove the GET user route (#223618)

This PR removes the current GET user route as it works with IDs and we
do not use IDs in privmon.
We'd rather remove this before it gets documented and pushed out. We can
revert this PR later if needed

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Mark Hopkin <mark.hopkin@elastic.co>
This commit is contained in:
Tiago Vila Verde 2025-06-20 19:23:06 +02:00 committed by GitHub
parent bad1717168
commit 33a6307b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 0 additions and 233 deletions

View file

@ -11271,24 +11271,6 @@ paths:
summary: Delete a monitored user
tags:
- Security Entity Analytics API
get:
operationId: GetPrivMonUser
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Security_Entity_Analytics_API_MonitoredUserDoc'
description: User details retrieved
summary: Retrieve a monitored user by ID
tags:
- Security Entity Analytics API
put:
operationId: UpdatePrivMonUser
parameters:

View file

@ -13430,24 +13430,6 @@ paths:
summary: Delete a monitored user
tags:
- Security Entity Analytics API
get:
operationId: GetPrivMonUser
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Security_Entity_Analytics_API_MonitoredUserDoc'
description: User details retrieved
summary: Retrieve a monitored user by ID
tags:
- Security Entity Analytics API
put:
operationId: UpdatePrivMonUser
parameters:

View file

@ -1,28 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Privileged User Monitoring API
* version: 2023-10-31
*/
import { z } from '@kbn/zod';
import { MonitoredUserDoc } from './common.gen';
export type GetPrivMonUserRequestParams = z.infer<typeof GetPrivMonUserRequestParams>;
export const GetPrivMonUserRequestParams = z.object({
id: z.string(),
});
export type GetPrivMonUserRequestParamsInput = z.input<typeof GetPrivMonUserRequestParams>;
export type GetPrivMonUserResponse = z.infer<typeof GetPrivMonUserResponse>;
export const GetPrivMonUserResponse = MonitoredUserDoc;

View file

@ -1,25 +0,0 @@
openapi: 3.0.0
info:
title: Privileged User Monitoring API
version: "2023-10-31"
paths:
/api/entity_analytics/monitoring/users/{id}:
get:
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: GetPrivMonUser
summary: Retrieve a monitored user by ID
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: User details retrieved
content:
application/json:
schema:
$ref: "./common.schema.yaml#/components/schemas/MonitoredUserDoc"

View file

@ -273,10 +273,6 @@ import type {
DeletePrivMonUserRequestParamsInput,
DeletePrivMonUserResponse,
} from './entity_analytics/privilege_monitoring/users/delete.gen';
import type {
GetPrivMonUserRequestParamsInput,
GetPrivMonUserResponse,
} from './entity_analytics/privilege_monitoring/users/get.gen';
import type {
ListPrivMonUsersRequestQueryInput,
ListPrivMonUsersResponse,
@ -1431,18 +1427,6 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
async getPrivMonUser(props: GetPrivMonUserProps) {
this.log.info(`${new Date().toISOString()} Calling API GetPrivMonUser`);
return this.kbnClient
.request<GetPrivMonUserResponse>({
path: replaceParams('/api/entity_analytics/monitoring/users/{id}', props.params),
headers: {
[ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
},
method: 'GET',
})
.catch(catchAxiosErrorFormatAndThrow);
}
async getProtectionUpdatesNote(props: GetProtectionUpdatesNoteProps) {
this.log.info(`${new Date().toISOString()} Calling API GetProtectionUpdatesNote`);
return this.kbnClient
@ -2724,9 +2708,6 @@ export interface GetNotesProps {
export interface GetPolicyResponseProps {
query: GetPolicyResponseRequestQueryInput;
}
export interface GetPrivMonUserProps {
params: GetPrivMonUserRequestParamsInput;
}
export interface GetProtectionUpdatesNoteProps {
params: GetProtectionUpdatesNoteRequestParamsInput;
}

View file

@ -430,24 +430,6 @@ paths:
summary: Delete a monitored user
tags:
- Security Entity Analytics API
get:
operationId: GetPrivMonUser
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoredUserDoc'
description: User details retrieved
summary: Retrieve a monitored user by ID
tags:
- Security Entity Analytics API
put:
operationId: UpdatePrivMonUser
parameters:

View file

@ -430,24 +430,6 @@ paths:
summary: Delete a monitored user
tags:
- Security Entity Analytics API
get:
operationId: GetPrivMonUser
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoredUserDoc'
description: User details retrieved
summary: Retrieve a monitored user by ID
tags:
- Security Entity Analytics API
put:
operationId: UpdatePrivMonUser
parameters:

View file

@ -12,7 +12,6 @@ import { monitoringEntitySourceRoute } from './monitoring_entity_source';
import { searchPrivilegeMonitoringIndicesRoute } from './search_indices';
import {
getUserRoute,
createUserRoute,
deleteUserRoute,
listUsersRoute,
@ -29,7 +28,6 @@ export const registerPrivilegeMonitoringRoutes = ({
healthCheckPrivilegeMonitoringRoute(router, logger, config);
searchPrivilegeMonitoringIndicesRoute(router, logger, config);
monitoringEntitySourceRoute(router, logger, config);
getUserRoute(router, logger);
createUserRoute(router, logger);
deleteUserRoute(router, logger);
listUsersRoute(router, logger);

View file

@ -1,54 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { IKibanaResponse, Logger } from '@kbn/core/server';
import { buildSiemResponse } from '@kbn/lists-plugin/server/routes/utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { GetPrivMonUserRequestParams } from '../../../../../../common/api/entity_analytics/privilege_monitoring/users/get.gen';
import type { GetPrivMonUserResponse } from '../../../../../../common/api/entity_analytics/privilege_monitoring/users/get.gen';
import { API_VERSIONS, APP_ID } from '../../../../../../common/constants';
import type { EntityAnalyticsRoutesDeps } from '../../../types';
export const getUserRoute = (router: EntityAnalyticsRoutesDeps['router'], logger: Logger) => {
router.versioned
.get({
access: 'public',
path: '/api/entity_analytics/monitoring/users/{id}',
security: {
authz: {
requiredPrivileges: ['securitySolution', `${APP_ID}-entity-analytics`],
},
},
})
.addVersion(
{
version: API_VERSIONS.public.v1,
validate: {
request: {
params: GetPrivMonUserRequestParams,
},
},
},
async (context, request, response): Promise<IKibanaResponse<GetPrivMonUserResponse>> => {
const siemResponse = buildSiemResponse(response);
try {
const secSol = await context.securitySolution;
const body = await secSol.getPrivilegeMonitoringDataClient().getUser(request.params.id);
return response.ok({ body });
} catch (e) {
const error = transformError(e);
logger.error(`Error retrieving user: ${error.message}`);
return siemResponse.error({
statusCode: error.statusCode,
body: error.message,
});
}
}
);
};

View file

@ -6,7 +6,6 @@
*/
export * from './create';
export * from './get';
export * from './list';
export * from './update';
export * from './delete';

View file

@ -84,7 +84,6 @@ import { GetEntityEngineRequestParamsInput } from '@kbn/security-solution-plugin
import { GetEntityStoreStatusRequestQueryInput } from '@kbn/security-solution-plugin/common/api/entity_analytics/entity_store/status.gen';
import { GetNotesRequestQueryInput } from '@kbn/security-solution-plugin/common/api/timeline/get_notes/get_notes_route.gen';
import { GetPolicyResponseRequestQueryInput } from '@kbn/security-solution-plugin/common/api/endpoint/policy/policy_response.gen';
import { GetPrivMonUserRequestParamsInput } from '@kbn/security-solution-plugin/common/api/entity_analytics/privilege_monitoring/users/get.gen';
import { GetProtectionUpdatesNoteRequestParamsInput } from '@kbn/security-solution-plugin/common/api/endpoint/protection_updates_note/protection_updates_note.gen';
import {
GetRuleExecutionEventsRequestQueryInput,
@ -962,18 +961,6 @@ finalize it.
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query);
},
getPrivMonUser(props: GetPrivMonUserProps, kibanaSpace: string = 'default') {
return supertest
.get(
routeWithNamespace(
replaceParams('/api/entity_analytics/monitoring/users/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getProtectionUpdatesNote(
props: GetProtectionUpdatesNoteProps,
kibanaSpace: string = 'default'
@ -2014,9 +2001,6 @@ export interface GetNotesProps {
export interface GetPolicyResponseProps {
query: GetPolicyResponseRequestQueryInput;
}
export interface GetPrivMonUserProps {
params: GetPrivMonUserRequestParamsInput;
}
export interface GetProtectionUpdatesNoteProps {
params: GetProtectionUpdatesNoteRequestParamsInput;
}

View file

@ -44,22 +44,6 @@ export default ({ getService }: FtrProviderContext) => {
expect(res.body);
});
it('should retrieve a user', async () => {
log.info(`retrieving a user`);
const { body } = await api.createPrivMonUser({
body: { user: { name: 'test_user2' } },
});
const res = await api.getPrivMonUser({ params: { id: body.id } });
if (res.status !== 200) {
log.error(`Retrieving privmon user failed`);
log.error(JSON.stringify(res.body));
}
expect(res.status).eql(200);
});
it('should update a user', async () => {
log.info(`updating a user`);
const { body } = await api.createPrivMonUser({