Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7817c76
Fix 2 bugs, remove dead code, add formal verification with ReqProof
buger Apr 19, 2026
b415ee7
Add formal verification section to README
buger Apr 19, 2026
7a51011
Fix reqproof.dev → reqproof.com
buger Apr 19, 2026
0a788ca
Remove internal dogfooding notes from docs/
buger Apr 19, 2026
7e56e26
Remove generated fixtures from repo, add tests/ to .gitignore
buger Apr 19, 2026
b12ab08
Complete traceability: annotate all tests, add documentation links
buger Apr 19, 2026
caf8776
Remove internal research docs from tracked files
buger Apr 19, 2026
e0ff4be
Fix CI: disable audit until public release, update upload-artifact to v4
buger Apr 19, 2026
5526c5c
Fix audit CI: use R2 CDN for proof download, re-enable workflow
buger Apr 19, 2026
2938f97
Fix audit CI: install proof via Homebrew (available on ubuntu-latest)
buger Apr 19, 2026
e2bb97c
Fix audit CI: use downloads.reqproof.com with pinned version
buger Apr 19, 2026
f60ebe9
Use probelabs/proof-action@v1 with version pin and scope=full
buger Apr 19, 2026
2045ad7
Set fail-level to error until next proof release
buger Apr 19, 2026
d3e2307
Use default latest version, fail-level error until next release
buger Apr 19, 2026
f6b4f4c
Pin proof version until latest channel is populated
buger Apr 19, 2026
ee892db
Switch to latest proof with fail-level warn
buger Apr 19, 2026
99f4991
Proper CI setup: Go 1.25 for MC/DC, latest proof, fail-level warn
buger Apr 19, 2026
8c7ce02
Use ubuntu-24.04 for glibc 2.39 compatibility with Z3 solver
buger Apr 19, 2026
47497fa
Trigger CI rebuild with cache-busted proof-action
buger Apr 19, 2026
aac1fbc
Pre-download Z3 solver before audit
buger Apr 19, 2026
1b70ead
Debug Z3 pre-download: remove output suppression
buger Apr 19, 2026
98133b4
Remove manual Z3 pre-download, now handled by proof-action
buger Apr 19, 2026
552e93b
Install Z3 via apt before audit
buger Apr 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
dry-run: false
language: go
- name: Upload Crash
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/reqproof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ReqProof Audit
on:
push:
branches: [main]
pull_request:

jobs:
audit:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Go 1.25+ required for code-level MC/DC instrumentation.
# jsonparser library itself supports Go 1.13+ but the verification
# tooling needs modern Go for source-to-source rewriting.
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Cache ReqProof solvers
uses: actions/cache@v4
with:
path: ~/.proof/solvers
key: proof-solvers-${{ runner.os }}

- name: Cache ReqProof index
uses: actions/cache@v4
with:
path: |
.proof/index.db
.proof/index.db-shm
.proof/index.db-wal
key: proof-index-${{ runner.os }}-${{ hashFiles('specs/**/*.req.yaml') }}
restore-keys: |
proof-index-${{ runner.os }}-

- name: Install Z3 solver
run: sudo apt-get update -qq && sudo apt-get install -y -qq z3

- uses: probelabs/proof-action@v1
with:
fail-level: warn
scope: full
format: markdown
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
vendor/github.com/buger/goterm/
prof.cpu
prof.mem
.proof/
tests/
PROOF_*.md
REQPROOF_*.md
proof-ux-log.md
PROOF_UNDER_MODELED_REQUIREMENTS_PROPOSAL.md
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,25 @@ https://github.com/buger/jsonparser/blob/master/benchmark/benchmark_large_payloa

Also last benchmark did not included `EachKey` test, because in this particular case we need to read lot of Array values, and using `ArrayEach` is more efficient.

## Formal Verification

<!-- Documents: SYS-REQ-001, SYS-REQ-016, SYS-REQ-017, SYS-REQ-018, SYS-REQ-019, SYS-REQ-020, SYS-REQ-021, SYS-REQ-022, SYS-REQ-023, SYS-REQ-024, SYS-REQ-025, SYS-REQ-026, SYS-REQ-027 -->

This project uses [ReqProof](https://reqproof.com) for formal requirements verification, achieving:

- **92 formally specified requirements** covering all public API behavior including edge cases, malformed input, boundary values, and error propagation
- **100% MC/DC coverage** (Modified Condition/Decision Coverage) — every boolean decision in the code is independently proven exercised
- **Kind2 model checking** — mathematical proof that the specification is realizable and consistent
- **Z3 SMT proofs** — data-level properties verified for all possible inputs, not just test samples

ReqProof found **2 real bugs** during the verification process ([see PR #281](https://github.com/buger/jsonparser/pull/281)):
1. `Delete` panic on truncated JSON input — bounds check missing after internal sentinel value
2. `ArrayEach` callback silently swallowing parse errors — the callback's `err` parameter was always nil

It also identified and safely removed **7 dead code blocks** that MC/DC analysis proved unreachable from any input.

The verification runs on every PR via [probelabs/proof-action](https://github.com/probelabs/proof-action).

## Questions and support

All bug-reports and suggestions should go though Github Issues.
Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package benchmark

/*
Small paylod, http log like structure. Size: 190 bytes
Small paylod, http log like structure. Size: 190 bytes
*/
var smallFixture []byte = []byte(`{
"st": 1,
Expand All @@ -28,7 +28,7 @@ type SmallPayload struct {
}

/*
Medium payload (based on Clearbit API response)
Medium payload (based on Clearbit API response)
*/
type CBAvatar struct {
Url string
Expand Down
Loading
Loading