fix(02): reject trailing JSON after the first decoded value (WR-03)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-17 14:41:59 +02:00
parent 5cb2defe0f
commit d3d202e0e2
2 changed files with 18 additions and 0 deletions

View File

@@ -130,6 +130,9 @@ func decodeJSON(raw []byte) (any, error) {
if err := dec.Decode(&v); err != nil {
return nil, err
}
if dec.More() {
return nil, fmt.Errorf("trailing JSON after first value")
}
return v, nil
}