Convert IP spoofing errors into client errors
What does this MR do?
Currently, IP spoofing attacks result in a 500 response, which counts towards our error budget. Since they're caused by the properties of the client request, it's appropriate to convert them into 400 errors.
We don't need to be too worried about the format of this response, as only malicious users will see it.
Screenshots
$ curl -D- -H'Client-Ip: 1.2.3.4' http://localhost:3000
HTTP/1.1 400 Bad Request
Content-Type: text/plain
X-Request-Id: o7QfHdW1J08
X-Runtime: 0.000324
Date: Thu, 28 May 2020 12:52:42 GMT
Content-Length: 27
IP spoofing attack detected
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #218025
Edited by Nick Thomas