Skip to content

Commit

Permalink
[Authz] Adjusted forbidden message for new security route configurati…
Browse files Browse the repository at this point in the history
…on (#195368)

## Summary

Adjusted forbidden message for new security route configuration to be
consistent with ES.

__Closes: https://github.com/elastic/kibana/issues/195365__

(cherry picked from commit 2759994)
  • Loading branch information
elena-shostak committed Oct 10, 2024
1 parent d9aeca0 commit d7c5517
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.toUpperCase()} ${
request.url.pathname
}${
request.url.search
}] is unauthorized for user, this action is granted by the Kibana privileges [${missingPrivileges}]`;

logger.warn(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 d7c5517

Please sign in to comment.