Skip to content

Convert IP spoofing errors into client errors

Nick Thomas requested to merge 218025-xff-is-a-400-error into master

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

Availability and Testing

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

Merge request reports

Loading