I'm working with a basic REST API, through user interaction on the UI, the JSON object is built up, including Arrays and a POST is sent to an endpoint using this object as the request body. For example:
"data": {
"id": "424",
"types": [ "01", "02" ]
}
So this data object is part of the body that will be sent to the endpoint. My concern relates to the types array. My understanding is that it should realistically never exceed five items. In which case, should we add validation to reject when it's over five elements? Or perhaps accept and just throw away anything over the five elements?
My concern is this being used as an attack vector or at least as a nuisance. I wonder if limiting this is safer or given REST request size limits, should we just leave it as it is?