Is this a security vulnerability?
No
Issue
Gorouter ignores unknown_route errors for the purpose of metrics. It does handle the request and returns a 404 to the client but it does not count that as a request that's been handled by gorouter, nor does it count the 404 as a responses_4xx value in metrics.
Affected Versions
All
Context
In production, we have HAProxy sitting in front of gorouter for TLS offloading. The 4xx status code metrics between HAProxy differ in that 404s coming from gorouter are recorded as 4xx errors in HAProxy but not in gorouter. There, the 404s are "invisible" on the metrics dashboards. We feel this is wrong, because even though there was no backend app that responded to the request, there still was a request and it should be counted as such.
Steps to Reproduce
- Push some-app.cf-app.com
curl https://some-app.cf-app.com
curl -u <user:pwd> http://gorouter:8082/varz
- Notice how the
requests and responses_2xx metrics have increased
curl https://does-not-exist.cf-app.com
curl -u <user:pwd> http://gorouter:8082/varz
- Notice how the
requests and responses_4xx metrics have not increased
Expected result
requests and responses_4xx metrics should include 404 unknown_route requests.
Note:
By extension, this should also apply to these errors:
- 400
empty_host
- 400
invalid_cf_app_instance_header
- 503
no_endpoints
- 503
Connection Limit Reached
Current result
requests and responses_4xx remain the same
Possible Fix
The request handling is stopped early in the lookup handler if the request cannot be forwarded.
A likely solution will be to also record the correct metrics in this handler.
Is this a security vulnerability?
No
Issue
Gorouter ignores unknown_route errors for the purpose of metrics. It does handle the request and returns a 404 to the client but it does not count that as a request that's been handled by gorouter, nor does it count the 404 as a
responses_4xxvalue in metrics.Affected Versions
All
Context
In production, we have HAProxy sitting in front of gorouter for TLS offloading. The 4xx status code metrics between HAProxy differ in that 404s coming from gorouter are recorded as 4xx errors in HAProxy but not in gorouter. There, the 404s are "invisible" on the metrics dashboards. We feel this is wrong, because even though there was no backend app that responded to the request, there still was a request and it should be counted as such.
Steps to Reproduce
curl https://some-app.cf-app.comcurl -u <user:pwd> http://gorouter:8082/varzrequestsandresponses_2xxmetrics have increasedcurl https://does-not-exist.cf-app.comcurl -u <user:pwd> http://gorouter:8082/varzrequestsandresponses_4xxmetrics have not increasedExpected result
requestsandresponses_4xxmetrics should include 404unknown_routerequests.Note:
By extension, this should also apply to these errors:
empty_hostinvalid_cf_app_instance_headerno_endpointsConnection Limit ReachedCurrent result
requestsandresponses_4xxremain the samePossible Fix
The request handling is stopped early in the lookup handler if the request cannot be forwarded.
A likely solution will be to also record the correct metrics in this handler.