Skip to content

Commit

Permalink
Add license check to direct package upload handler. (#79653) (#79677)
Browse files Browse the repository at this point in the history
  • Loading branch information
skh authored Oct 6, 2020
1 parent 9b38890 commit 24b26cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x-pack/plugins/ingest_manager/server/routes/epm/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
} from '../../services/epm/packages';
import { defaultIngestErrorHandler, ingestErrorToResponseOptions } from '../../errors';
import { splitPkgKey } from '../../services/epm/registry';
import { licenseService } from '../../services';

export const getCategoriesHandler: RequestHandler<
undefined,
Expand Down Expand Up @@ -212,6 +213,12 @@ export const installPackageByUploadHandler: RequestHandler<
undefined,
TypeOf<typeof InstallPackageByUploadRequestSchema.body>
> = async (context, request, response) => {
if (!licenseService.isEnterprise()) {
return response.customError({
statusCode: 403,
body: { message: 'Requires Enterprise license' },
});
}
const savedObjectsClient = context.core.savedObjects.client;
const callCluster = context.core.elasticsearch.legacy.client.callAsCurrentUser;
const contentType = request.headers['content-type'] as string; // from types it could also be string[] or undefined but this is checked later
Expand Down

0 comments on commit 24b26cd

Please sign in to comment.