Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce deny-by-default approach on the admin listener by matching on…
… exact paths and on GET requests We want to block all requests to the `admin` listener endpoint that are not `GET`. In particular someone know can do `/runtime_modify?key1=value1&key2=value2&keyN=valueN` to change runtime variables such as the max regexp program size This is mostly for security reasons to prevent any potential attacks that could happen by an attacker modifying the `runtime` configuration of Envoy (or any other configuration). Note that since `shutdownmanager.go` uses the admin socket `/admin/admin.sock` to send a `POST` request it should be unaffected by this change. Some manual verifications: ``` curl http://localhost:9001/ready LIVE ``` ``` curl -vv --request POST http://localhost:9001/runtime * Trying [::1]:9001... * Connected to localhost (::1) port 9001 > POST /runtime HTTP/1.1 > Host: localhost:9001 > User-Agent: curl/8.4.0 > Accept: */* > < HTTP/1.1 404 Not Found < date: Wed, 15 May 2024 22:15:56 GMT < server: envoy < content-length: 0 < * Connection #0 to host localhost left intact ``` ``` { "match": { "path": "/stats/prometheus", "headers": [ { "name": ":method", "string_match": { "exact": "GET", "ignore_case": true } } ] }, ``` and then: ``` curl -vv 'http://localhost:9001/stats?usedonly' * Trying [::1]:9001... * Connected to localhost (::1) port 9001 > GET /stats?usedonly HTTP/1.1 > Host: localhost:9001 > User-Agent: curl/8.4.0 > Accept: */* > < HTTP/1.1 200 OK ``` Signed-off-by: Sotiris Nanopoulos <[email protected]>
- Loading branch information