Skip to content

test: add fast-check property-based tests (sanitizers, LineBuffer, DAP framing)#162

Merged
debugmcpdev merged 4 commits into
mainfrom
fix/scorecard-fuzzing
Jul 9, 2026
Merged

test: add fast-check property-based tests (sanitizers, LineBuffer, DAP framing)#162
debugmcpdev merged 4 commits into
mainfrom
fix/scorecard-fuzzing

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Summary

Adds fast-check and 12 property-based tests in 3 files — genuine coverage for the recently-hardened security-sensitive paths, and the integration OpenSSF Scorecard's Fuzzing check recognizes for JS/TS (currently 0/10, +0.51 aggregate expected):

Verification

  • All 12 properties pass; full unit suite: 154 files / 2491 tests green (~11s, no runtime impact worth noting).
  • Mutation check: weakening a sanitizer regex (AKIA[0-9A-Z]{16}{99}) fails the properties within ~10 generated cases; reverting restores green.

🤖 Generated with Claude Code

cynarlab and others added 2 commits July 9, 2026 09:47
…tadata, untrack Go example binary

Three OpenSSF Scorecard fixes:

- Token-Permissions (currently 0/10): move 'security-events: write' in
  codeql.yml and 'contents: write' + 'pull-requests: write' in
  dependabot-auto-merge.yml from the workflow top level down to the
  single job that needs them; top level becomes 'contents: read'.
  Top-level write permissions zero this check; job-level writes are
  accepted least-privilege.

- Pinned-Dependencies: pin dependabot/fetch-metadata to the v3.1.0
  commit SHA -- the only remaining non-SHA 'uses:' across all seven
  workflows.

- Binary-Artifacts (9/10): untrack examples/go/hello_world/hello_world,
  a 2.4 MB compiled Go ELF that slipped into the index before the
  .gitignore rule (line 203) existed. The example builds from source.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ing, and DAP framing

Three new property test files (12 properties total):

- env-sanitizer: generated secret shapes (ghp_/github_pat_/sk-/xox*/
  AKIA/PEM) never survive sanitizeStderr or sanitizeStderrTail; env
  objects at any payload depth are always redacted; key-set/structure
  preservation and idempotency of sanitizeEnvForLogging.
- LineBuffer: chunking invariance (any split of any input produces the
  same lines as the unsplit input -- the exact guarantee the stderr
  redaction path depends on, issue #151), plus the maxPendingLength
  memory bound with no data loss.
- MinimalDapClient framing: generated DAP event streams survive
  arbitrary byte-level chunk splits (including mid-UTF-8-character)
  losslessly and in order; any two chunkings agree.

Mutation-verified: weakening a sanitizer regex fails the properties
within ~10 generated cases.

fast-check is also what the OpenSSF Scorecard Fuzzing check recognizes
for JS/TS (currently 0/10).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

cynarlab and others added 2 commits July 9, 2026 10:07
…und by property tests

The first CI run of the new fast-check properties generated an env key
named '__proto__' and caught a real bug: 'sanitized[key] = value' routes
through the Object.prototype setter, so the entry silently vanishes from
sanitizeEnvForLogging output -- and in redactEnvDeep an object value
would replace the output object's prototype instead of being copied.

Assign via Object.defineProperty (own, enumerable, writable) in both
sanitizers. The property generators now always include '__proto__',
'constructor', 'hasOwnProperty' and 'toString' in the key pool, plus an
example-based regression test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@debugmcpdev

Copy link
Copy Markdown
Collaborator Author

The first CI run of these property tests caught a real bug: fast-check generated an env key named __proto__, which sanitizeEnvForLogging silently dropped (plain obj[key] = value routes through the prototype setter; in redactEnvDeep an object value would have replaced the output's prototype). Fixed in 9c64a8c by assigning via Object.defineProperty, with __proto__/constructor/hasOwnProperty/toString now permanently in the generator key pool plus an example-based regression test. Full unit suite green (154 files / 2492 tests).

@debugmcpdev debugmcpdev merged commit 7f7aa6e into main Jul 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants