diff options
author | George Liu <liuxiwei@inspur.com> | 2021-03-22 12:49:39 +0300 |
---|---|---|
committer | George Liu <liuxiwei@inspur.com> | 2021-03-23 05:18:14 +0300 |
commit | 3de8d8ba2880173fac03c949d9fae035442549ee (patch) | |
tree | c602dab277dbd5af95f78588bd45b879049e43d2 /redfish-core/lib/log_services.hpp | |
parent | 8f7e9c194f36a84f4e49ad142110f4f3d0f312be (diff) | |
download | bmcweb-3de8d8ba2880173fac03c949d9fae035442549ee.tar.xz |
log-services: Error return 500(internal error)
- If the server returns 500(internal error) to any of these requests,
the security scanner logs it as an error for followup.
- Sometimes, it is not a real 500(internal error), may be is a 404
(not found) error, and we think that the 404(not found) error is a
benign error, and not actually a real security threat.
- We should handle the 404(not found) error correctly and return it
where appropriate.
- Refer to: https://github.com/openbmc/bmcweb/blob/master/COMMON_ERRORS.md#11-not-responding-to-404
Tested:
curl -k -X DELETE -v https://$bmc/redfish/v1/Systems/system/LogServices/Dump/Entries/198274391874
- Before:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request failed due to an internal service error. The service is still operational.",
"MessageArgs": [],
"MessageId": "Base.1.8.1.InternalError",
"MessageSeverity": "Critical",
"Resolution": "Resubmit the request. If the problem persists, consider resetting the service."
}
],
"code": "Base.1.8.1.InternalError",
"message": "The request failed due to an internal service error. The service is still operational."
}
}
- After:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type systemDumpEntry named 198274391874 was not found.",
"MessageArgs": [
"LogEntry",
"198274391874"
],
"MessageId": "Base.1.8.1.ResourceNotFound",
"MessageSeverity": "Critical",
"Resolution": "Provide a valid resource identifier and resubmit the request."
}
],
"code": "Base.1.8.1.ResourceNotFound",
"message": "The requested resource of type systemDumpEntry named 198274391874 was not found."
}
}
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I84c14f0294cf84606c9850dc4bacbda16e8cfa8e
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 4abf35484a..255c24ee84 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -662,10 +662,16 @@ inline void deleteDumpEntry(const std::shared_ptr<AsyncResp>& asyncResp, const std::string& entryID, const std::string& dumpType) { - auto respHandler = [asyncResp](const boost::system::error_code ec) { + auto respHandler = [asyncResp, + entryID](const boost::system::error_code ec) { BMCWEB_LOG_DEBUG << "Dump Entry doDelete callback: Done"; if (ec) { + if (ec.value() == EBADR) + { + messages::resourceNotFound(asyncResp->res, "LogEntry", entryID); + return; + } BMCWEB_LOG_ERROR << "Dump (DBus) doDelete respHandler got error " << ec; messages::internalError(asyncResp->res); @@ -1681,10 +1687,17 @@ class DBusEventLogEntry : public Node dbus::utility::escapePathForDbus(entryID); // Process response from Logging service. - auto respHandler = [asyncResp](const boost::system::error_code ec) { + auto respHandler = [asyncResp, + entryID](const boost::system::error_code ec) { BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done"; if (ec) { + if (ec.value() == EBADR) + { + messages::resourceNotFound(asyncResp->res, "LogEntry", + entryID); + return; + } // TODO Handle for specific error code BMCWEB_LOG_ERROR << "EventLogEntry (DBus) doDelete respHandler got error " |