1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Re-add unknown fields check

This commit is contained in:
JanHoefelmeyer 2025-09-12 09:08:36 +02:00
parent 187d114631
commit 3c790f200d

View file

@ -18,6 +18,8 @@ import (
// while not allowing unknown fields nor trailing data
func StrictJSONParse(jsonData io.Reader, target any) error {
decoder := json.NewDecoder(jsonData)
// Don't allow unknown fields
decoder.DisallowUnknownFields()
if err := decoder.Decode(target); err != nil {
return fmt.Errorf("JSON decoding error: %w", err)