Forcing 422 Unprocessable Content
Per RFC 9110 §15.5.21, a server returns 422 when the payload fails semantic validation.
Implemented
Mechanism: Per RFC 9110 §15.5.21, a server returns 422 when the payload fails semantic validation. The server must find the resource and load its schema before it can validate.
Isolated Variable: The Content-Type remains valid. Only the body values are made semantically invalid.
Oracle Signal: 422 (exists) vs 404 (does not exist).
PUT — Existing Resource (Missing Required Field)
PUT /api/users/1001 HTTP/1.1
Host: target.com
Content-Type: application/json
Content-Length: 2
{}
HTTP/1.1 422 Unprocessable Content
Content-Type: application/json
{"error": "Validation Failed", "detail": [{"field": "name", "message": "required"}]}PUT — Non-Existing Resource (Missing Required Field)
PUT /api/users/9999 HTTP/1.1
Host: target.com
Content-Type: application/json
Content-Length: 2
{}
HTTP/1.1 404 Not Found
Content-Type: application/json
{"error": "Not Found"}Mitigation: Perform resource existence checks before body validation.