From 63d021f7d00bebfaf6bd195cce178f6313827624 Mon Sep 17 00:00:00 2001 From: Ashokaditya <1849116+ashokaditya@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:40:30 +0200 Subject: [PATCH] [8.10] [Security Solution] ensure fleetfilenotfound is reported as a 404 (#164738) (#164836) # Backport This will backport the following commits from `main` to `8.10`: - [[Security Solution] ensure fleetfilenotfound is reported as a 404 (#164738)](https://github.com/elastic/kibana/pull/164738) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Dan Panzarella Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../security_solution/server/endpoint/routes/error_handler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/error_handler.ts b/x-pack/plugins/security_solution/server/endpoint/routes/error_handler.ts index f7ffa856d6f6c..a14303e0004ee 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/error_handler.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/error_handler.ts @@ -6,6 +6,7 @@ */ import type { IKibanaResponse, KibanaResponseFactory, Logger } from '@kbn/core/server'; +import { FleetFileNotFound } from '@kbn/fleet-plugin/server/errors'; import { CustomHttpRequestError } from '../../utils/custom_http_request_error'; import { NotFoundError } from '../errors'; import { EndpointHostUnEnrolledError, EndpointHostNotFoundError } from '../services/metadata'; @@ -38,7 +39,7 @@ export const errorHandler = ( }); } - if (error instanceof NotFoundError) { + if (error instanceof NotFoundError || error instanceof FleetFileNotFound) { return res.notFound({ body: error }); }