Proof Portal

Projects

jsonparser

ProbeLabs23 findings · 123 requirements

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

All requirements
RequirementSYS-REQ-062SystemApproved

When ParseString encounters a UTF-16 high surrogate escape followed by a second unicode escape whose value is below the low surrogate range (e.g., '\uD800\u0041'), the parser shall substitute U+FFFD (replacement character) for the malformed surrogate sequence and continue parsing, matching encoding/json behavior, rather than producing corrupted output or returning an error.

Automated checks pass.
PriorityshallTypeguaranteeCategoryfunctionalComponentparserAssuranceEFindingsnone open

Specification

The requirement exactly as authored — its complete prose text and, where present, the formal FRETish sentence it compiles to.

Description

When ParseString encounters a UTF-16 high surrogate escape followed by a second unicode escape whose value is below the low surrogate range (e.g., '\uD800\u0041'), the parser shall substitute U+FFFD (replacement character) for the malformed surrogate sequence and continue parsing, matching encoding/json behavior, rather than producing corrupted output or returning an error.

FRETish formula
the parser shall always satisfy !raw_string_has_invalid_low_surrogate | substitutes_replacement_for_invalid_low_surrogate
View full formal model

Rationale & tags

Why this requirement exists, and how it is categorised.

An invalid low surrogate (valid unicode escape but wrong range) exercises a different branch in decodeUnicodeEscape than a completely missing second escape.

parsestringunicodesurrogate

Verification & provenance

How this requirement was checked: the review trail, edit history, and the machine-analysis status terms (each ⓘ explains what it means).

Assurance levelE
Formalizationvalid
Realizabilityrealizable
Vacuitychecked_ok
Strategyfretish

Review

Status
approved
Reviewer
Buger · lead_engineer
Reviewed
Jul 27, 2026, 11:43 UTC
Surrogate-bug hardening: motivation linked to DEFECT-260727-SNGT

History

Created
Apr 14, 2026, 18:00 UTC · Claude · AI agent
Modified
Jul 27, 2026, 11:43 UTC · Buger

Change history

Every recorded revision of this requirement's source file — newest first, each with its commit message and the diff for that change.

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

Obligations

What this requirement must witness to be considered satisfied — the required evidence, and the tests that discharge each one.

No obligations recorded for this requirement

Proof obligations are recorded once evidence is generated. None have been captured here yet — this is expected, not a gap in the requirement itself. A required class of evidence the requirement must witness — the bridge between the requirement existing and it being proven.

Formula evidence

The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).

FRETish formula

the parser shall always satisfy !raw_string_has_invalid_low_surrogate | substitutes_replacement_for_invalid_low_surrogate

Variables

NameTypeDirectionDescription
raw_string_has_invalid_low_surrogateTrue when ParseString encounters a UTF-16 high surrogate followed by a unicode escape whose value is below the low surrogate range.
substitutes_replacement_for_invalid_low_surrogateTrue when ParseString substitutes U+FFFD for a high surrogate followed by an invalid low surrogate, matching encoding/json behavior.

Witnesses· 2 scenarios total

  • TestMCDC_SYS_REQ_062_Row1_TriggerFalse
    exercises 1 condition scenario
  • TestMCDC_SYS_REQ_062_Row3_InvalidLowSurrogateError
    exercises 1 condition scenario

MC/DC truth table· 3 rows

Each row assigns the formula's conditions (T/F) and shows the Result— the formula's value for that input row, not a test pass/fail. A row proves a condition when flipping only that condition flips the outcome. The test that covers each row is linked.

Covereda test exercises this rowExempteda reviewed mcdc:ignoreNo-actionfalse-result row satisfied by designUncoveredneeds a covering test
#raw_string_has_invalid_low_surrogatesubstitutes_replacement_for_invalid_low_surrogateResultProvesCovering test
1FFTraw_string_has_invalid_low_surrogate
2TFFraw_string_has_invalid_low_surrogateExempted · defensive — Unreachable in the correct build: the escape.go fix (DEFECT-260727-SNGT) always substitutes U+FFFD for a high surrogate followed by an invalid low surrogate, so when raw_string_has_invalid_low_surrogate=T the substitutes_replacement_for_invalid_low_surrogate output is always T (witnessed by Row 3 below). The (T,F) violation row can only occur in the pre-fix build that returned an error. Positive path Row 1 (F,F) and the substitution-when-triggered Row 3 (T,T) are both witnessed. (reviewed: human:buger)
3TTTsubstitutes_replacement_for_invalid_low_surrogate

Its place

This requirement shown inside its trace neighbourhood — the parents it satisfies, the code and tests attached to it, and its findings.

Loading graph…

Trace evidence

The concrete artifacts linked to this requirement — implementing code, verifying tests, documents, and the findings raised against it.

No implementation linked

No source files are traced to this requirement yet.

Impact

Blast radius — if you change this requirement, what else may need re-checking, and what it in turn depends on.

If you change this

Requirements
0
Files
0
Tests
2
At-risk contracts
0

Tests to re-run (2)

  • deep_spec_test.godeep_spec_test.go
  • mcdc_spec_witnesses_test.gomcdc_spec_witnesses_test.go

What this rests on

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