mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Merge pull request #7528 from Icinga/bugfix/api-put-error-handling
API: Handle permission exceptions soon enough, returning 404
This commit is contained in:
commit
38080405df
@ -98,12 +98,23 @@ void HttpHandler::ProcessRequest(
|
||||
}
|
||||
|
||||
bool processed = false;
|
||||
|
||||
/*
|
||||
* HandleRequest may throw a permission exception.
|
||||
* DO NOT return a specific permission error. This
|
||||
* allows attackers to guess from words which objects
|
||||
* do exist.
|
||||
*/
|
||||
try {
|
||||
for (const HttpHandler::Ptr& handler : handlers) {
|
||||
if (handler->HandleRequest(stream, user, request, url, response, params, yc, server)) {
|
||||
processed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (const std::exception&) {
|
||||
processed = false;
|
||||
}
|
||||
|
||||
if (!processed) {
|
||||
HttpUtility::SendJsonError(response, params, 404, "The requested path '" + boost::algorithm::join(path, "/") +
|
||||
|
Loading…
x
Reference in New Issue
Block a user