Skip to content

Commit 05eae0a

Browse files
Re-add unknown fields check (gocsaf#681)
1 parent e3d2a58 commit 05eae0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/misc/json.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
// while not allowing trailing data
1919
func StrictJSONParse(jsonData io.Reader, target any) error {
2020
decoder := json.NewDecoder(jsonData)
21+
// Don't allow unknown fields
22+
decoder.DisallowUnknownFields()
2123

2224
if err := decoder.Decode(target); err != nil {
2325
return fmt.Errorf("JSON decoding error: %w", err)

0 commit comments

Comments
 (0)