Proof Portal

Projects

jsonparser

ProbeLabs23 findings · 123 requirements

The fastest JSON parser for Go — formally verified with ReqProof (real library, master).

Back to findings
Problem reportDEFECT-260726-MFPA

Set with array-index path component under an object parent produces malformed JSON output (silent corruption)

FixedFixedHigh

This defect has been fixed and verified.

Closure: Hazard class closed
Verified by 2 regression tests

Introduced

When and where this issue first entered the codebase — the commit it traces back to, and the audit run that first flagged it.

Inception (latent from the first version)
Origin
Audit Finding

Change history

Every recorded revision of this finding's source file — when it was added, edited, or re-classified, with the diff for each change.

Every recorded revision of this object's source — newest first, each with the commit message and its file-level diff.

What this means for you

Plain-language impact — what this issue could mean for your users and your system, before any of the technical detail.

When `Set` is called with a key path that contains an array-index component `[N]` whose parent in the addressed JSON is an OBJECT rather than an array, the implementation emits **malformed JSON output** and returns it with a **nil error**. The caller has no signal that the returned bytes cannot be re-parsed by any JSON consumer. Reproducer (filed as KI-3, locked by tripwire `set_spec_test.go:TestSetArrayIndexUnderObjectMalformedJSON_KI3`): Set(`{"a":{"b":1}}`, `9`, "a", "[5]") -> `{"a":{"b":1,9}}` (INVALID) Set(`{"a":{"b":1}}`, `9`, "a", "[0]", "x") -> `{"a":{"b":1,{"x":9}}}` (INVALID) Set(`{"a":1}`, `9`, "[0]") -> `{"a":1,9}` (INVALID) Each output is rejected by `encoding/json.Unmarshal` with "invalid character '9' looking for beginning of object key string" or similar. Root cause: `createInsertComponent` (parser.go:756) with `isIndex=true, comma=true, object=false` emits only `,<value>` (no quoted object key), so the value is spliced into the object body where JSON requires a `"key":value` pair. `Set` (parser.go:1018-1038) does not reject the cross-type path before invoking `createInsertComponent`. The symmetric case (object-key component under an array parent) is handled by auto-vivification, so the bug is specifically `[N]`-under-object. Hazard class: this is the same family as PR #286 (silent data corruption on underspecified `Set` partitions). The partition "path component kind mismatches its parent container kind" was not covered by SYS-REQ-009's fretish. The catalog obligation `malformed_input` is now attached to SYS-REQ-009 so the audit enforces this failure mode henceforth.

Severity, explained

Why this is rated the way it is — and the scoring signals behind the rating (each ⓘ explains the term).

HighRated severity — the impact if this issue is exploited or hit.
risk area
Data Integrity

Root cause

What actually went wrong underneath — how it is classified, and the coverage gap that let it slip through.

defect class: Missing Validation
Why this escaped

Disposition: Covered by a requirement

Proof it's fixed

The tests, tightened requirements and new obligations that prove this defect is gone — and can't quietly return.

Covered by a requirement.

verified by
regression tests
strengthened requirements
New proof obligations

Blast radius

If you touch this issue, what else may need re-checking — the requirements it affects and the code and tests that hang off them.

Nothing to trace into

This finding links no requirements, so there is no dependency graph to follow. Everything we know about it is in the evidence above.

Discussions

Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.

Sign in to discuss this with the proof team.Sign in