client_python
client_python copied to clipboard
Reject invalid HTTP methods and resources
This change addresses issue #1018 (currently, any HTTP method is handled by returning success and metrics data, which causes network scanners to report issues).
Note, this needs careful review w.r.t.:
- Does Prometheus issue any HTTP requests that are now rejected.
- Does HEAD need to be supported.
- Does the
/metricsresource for which metrics are returned, need to be configurable by the users of this package. - Does the strict handling need to be enabled/disabled by the users of this package.
- Are unit tests needed.
Note, the pinning of asgiref==3.6.0 removes a test error in the py3.8 tox environment (same fix that already existed for the pypy3.8 tox environment). I don't know why the error on py3.8 comes up in the first place. I guess someone more experienced than me needs to look at that.
For details, see the commit message.