summaryrefslogtreecommitdiff
path: root/redfish-core/include
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2021-10-07 00:51:16 +0300
committerEd Tanous <edtanous@google.com>2023-06-01 22:42:45 +0300
commit600af5f1ee6f3a589d5c1a7be31579ca705eef71 (patch)
tree0c1bd7bf285a4d9cd78e58890efdb95254183f67 /redfish-core/include
parent75ec825c9aa030568fc97b47dd34fee5c9405d73 (diff)
downloadbmcweb-600af5f1ee6f3a589d5c1a7be31579ca705eef71.tar.xz
Input parameter validation for Event Subscription
User input must be validated to avoid the out-of-memory issue. This commit adds the size check on input parameters such as Context, Destination and Header field while create or update the EventDestination. Added a generic error message "PropertySizeExceeded" in message registry which is used as response when size limit is exceeded. Tested - Validated using POST on Event Subscription. - When Context, Destination and Headers were too long, received a error message denoting the same. Change-Id: Ibab847ce0c99f445a76e6d3aee8074428bb7d30f Signed-off-by: AppaRao Puli <apparao.puli@intel.com> Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'redfish-core/include')
-rw-r--r--redfish-core/include/error_messages.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index e45ea45701..f55a6bbc5b 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -1070,6 +1070,25 @@ nlohmann::json operationNotAllowed();
void operationNotAllowed(crow::Response& res);
+/**
+ * @brief Formats ArraySizeTooLong message into JSON
+ * Message body: "Indicates that a string value passed to the given resource
+ * exceeded its length limit."
+ * @returns Message ArraySizeTooLong formatted to JSON */
+nlohmann::json arraySizeTooLong(std::string_view property, uint64_t length);
+
+void arraySizeTooLong(crow::Response& res, std::string_view property,
+ uint64_t length);
+/**
+ * @brief Formats StringValueTooLong message into JSON
+ * Message body: "Indicates that a string value passed to the given resource
+ * exceeded its length limit."
+ * @returns Message StringValueTooLong formatted to JSON */
+nlohmann::json stringValueTooLong(std::string_view property, uint64_t length);
+
+void stringValueTooLong(crow::Response& res, std::string_view property,
+ uint64_t length);
+
} // namespace messages
} // namespace redfish