Proof Portal
jsonparser
ProbeLabs23 findings · 123 requirementsSet with array-index path component under an object parent produces malformed JSON output (silent corruption)
This defect has been fixed and verified.
Description
The issue as recorded. A plain-language impact summary hasn't been written for this finding yet.
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).
- risk area
- Data Integrity
Root cause
What actually went wrong underneath — how it is classified, and the coverage gap that let it slip through.
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.
- Malformed Input on SYS-REQ-009
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. Historical view: authored trace links only — automatically derived links aren't reconstructible for past runs.
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.
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.
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.