Skip to content

Commit

Permalink
Merge branch 'main' into entity-risk-scoring-new-doc-link
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 6, 2023
2 parents d5f5842 + 9f3f22a commit 56e545e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ describe('restrictInternal post-auth handler', () => {
name: 'my-server-name',
restrictInternalApis: true,
});

it('returns a bad request if called without internal origin header for internal API', () => {
const handler = createRestrictInternalRoutesPostAuthHandler(config as HttpConfig);
const request = createForgeRequest('internal');
Expand All @@ -310,8 +311,8 @@ describe('restrictInternal post-auth handler', () => {
const result = handler(request, responseFactory, toolkit);

expect(toolkit.next).not.toHaveBeenCalled();
expect(responseFactory.badRequest.mock.calls[0][0]?.body).toMatch(
/uri \[.*\/internal\/some-path\] with method \[get\] exists but is not available with the current configuration/
expect(responseFactory.badRequest.mock.calls[0][0]?.body).toMatchInlineSnapshot(
`"uri [/internal/some-path] with method [get] exists but is not available with the current configuration"`
);
expect(result).toBe('badRequest');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const createRestrictInternalRoutesPostAuthHandler = (
if (isRestrictionEnabled && isInternalRoute && !request.isInternalApiRequest) {
// throw 400
return response.badRequest({
body: `uri [${request.url}] with method [${request.route.method}] exists but is not available with the current configuration`,
body: `uri [${request.url.pathname}] with method [${request.route.method}] exists but is not available with the current configuration`,
});
}
return toolkit.next();
Expand Down

0 comments on commit 56e545e

Please sign in to comment.