Skip to content

Commit

Permalink
[Authz] Adjusted forbidden message for new security route configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
elena-shostak committed Oct 8, 2024
1 parent faa74d2 commit b9cb0d3
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ export function initAPIAuthorization(
const missingPrivileges = Object.keys(kibanaPrivileges).filter(
(key) => !kibanaPrivileges[key]
);
logger.warn(
`User not authorized for "${request.url.pathname}${
request.url.search
}", responding with 403: missing privileges: ${missingPrivileges.join(', ')}`
);
const forbiddenMessage = `API [${request.route.method.toLocaleUpperCase('en')} ${
request.url.pathname
}${
request.url.search
}] is unauthorized for user, this action is granted by the Kibana privileges [${missingPrivileges}]`;

logger.warn(`Responding with 403: ${forbiddenMessage}}`);

return response.forbidden({
body: {
message: `User not authorized for ${request.url.pathname}${
request.url.search
}, missing privileges: ${missingPrivileges.join(', ')}`,
message: forbiddenMessage,
},
});
}
Expand Down

0 comments on commit b9cb0d3

Please sign in to comment.