mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-09-18 06:14:32 +02:00
Be more strict, when parsing json
This commit is contained in:
@@ -272,8 +272,10 @@ func NewHttpSink(name string, config json.RawMessage) (Sink, error) {
|
||||
|
||||
// Read config
|
||||
if len(config) > 0 {
|
||||
err := json.Unmarshal(config, &s.config)
|
||||
if err != nil {
|
||||
d := json.NewDecoder(bytes.NewReader(config))
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&s.config); err != nil {
|
||||
cclog.ComponentError(s.name, "Error reading config:", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user