Reject invalid CHC ingestConfiguration.baseURL#196
Conversation
|
In
An end of string anchor $ should be added at the end:
The Adding the $ at the end of the regex would be the cleanest way to fix the bug. In fact, if we fix the regex this way, most of the other changes currently in this PR would become obsolete. However, since this template is located in rt-common-shared and used across multiple repositories, I am unsure about the potential side effects this change might have elsewhere. Additionally, I noticed another issue in the same file:
There is an = in the macro definition. I believe this will cause syntax errors when the macro is used in the C code. |
There was a problem hiding this comment.
I'm a bit confused here. The 422 Unprocessable Entity response was only intended for use with the operation to clear the Content Hosting cache using an invalid regular expression. I see references to the regular expression in #186. However, the main topic of that issue was a malformed base URL in the Content Hosting Configuration. In that error scenario, the appropriate response would be 400 Bad Request with a reason exposed in the ProblemDetails message body.
Thank you @rjb1000, that makes sense. I interpreted the AS response as the status code the AF should also return, because the AS currently rejects the malformed AS: The AS-side reason for the 422 response is: #186 (comment) Currently, the AF accepts the invalid CHC on M1 and forwards it to the AS over M3. The AS then rejects it with 422, which is why I initially thought the AF should also respond with 422.
@rjb1000 Does this approach make sense to you, and are you okay with the steps above? |
|
The definition of 422 Unprocessable Entity in section 15.5.21 of RFC 9110 implies that it is only valid for semantic failures of request bodies that are otherwise syntactically valid. The invalid base URL on this PR is borderline: the JSON document is syntactically fine (in other words, it is a processable entity), but one of the properties contains a URL that isn't syntactically valid. I can see arguments in favour of both 422 Unprocessable Entity and 400 Bad Request. But, for the sake of simplicity, I think that I would go for the latter. Arguably, the 5GMSd AS would also have chosen the latter.
That all sounds fine to me. |
eeba6de to
224b281
Compare
Summary
This PR fixes validation of ingestConfiguration.baseURL in Content Hosting Configuration requests.
Close issue #186