Plugins: Requests validator (#30445) (#30877)

* Introduce PluginRequestValidator abstraction with a NoOp implementation

* Update PluginRequestValidator abstraction to use the dsURL instead

* Inject PluginRequestValidator into the HTTPServer and validate requests going through data source proxy

* Inject PluginRequestValidator into the BackendPluginManager and validate requests going through it

* Validate requests going through QueryMetrics & QueryMetricsV2

* Validate BackendPluginManager health requests

* Fix backend plugins manager tests

* Validate requests going through alerting service

* Fix tests

* fix tests

* goimports

Co-authored-by: Leonard Gram <leo@xlson.com>
(cherry picked from commit 6415d2802e)

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
This commit is contained in:
Leonard Gram
2021-02-04 08:05:18 +01:00
committed by GitHub
co-authored by Joan López de la Franca Beltran
parent 87cb290cbd
commit fdf52dd45c
26 changed files with 224 additions and 102 deletions
+12
View File
@@ -0,0 +1,12 @@
package models
import (
"net/http"
)
type PluginRequestValidator interface {
// Validate performs a request validation based
// on the data source URL and some of the request
// attributes (headers, cookies, etc).
Validate(dsURL string, req *http.Request) error
}