Skip to content

audit: Wave 2 Batch 2 — rule-traversal + rule-sql + rule-crypto#61

Merged
Nelson Spence (Fieldnote-Echo) merged 5 commits intomainfrom
audit/wave-2-batch-2
Mar 14, 2026
Merged

audit: Wave 2 Batch 2 — rule-traversal + rule-sql + rule-crypto#61
Nelson Spence (Fieldnote-Echo) merged 5 commits intomainfrom
audit/wave-2-batch-2

Conversation

@Fieldnote-Echo
Copy link
Copy Markdown
Member

Summary

  • Regex stress test batch: three rules with increasingly complex patterns, testing whether SR-02 (ReDoS safety) evidence production scales to patterns with real backtracking risk
  • Primary target: _PERCENT_SQL and _CONCAT_SQL in rule-sql use .*\b...\b.* structure — the adversarial evidence supports the pattern-safety argument (all pass under 5s timeout with 100K-char inputs)
  • 15/30 units now CURRENT — halfway milestone reached

What changed

Commit 1: Tests (evidence generation)

  • 18 new tests across 3 files (54 total for these rules)
  • ReDoS adversarial tests: 2 for rule-traversal, 4 for rule-sql (including near-miss and keyword-no-trail shapes), 1 for rule-crypto
  • 1MB long-line tolerance tests for all 3 rules
  • SR-01 gap closure for rule-crypto: RC4, ARC4, Blowfish, random.random/choice/getrandbits now tested
  • Safe-negative specificity anchors for rule-crypto: AES-GCM and secrets.token_bytes

Commits 2-4: Scorecards

Unit Score Dim 4 Finding Key observation
rule-traversal 7.4/10 6 F-TRV-001 (LOW): edge-case file types Direct iteration vs ctx.added_lines_for() — design note, not drift
rule-sql 7.4/10 6 F-SQL-001 (LOW): near-miss negatives SR-02 primary stress test passed — .*\b...\b.* does not backtrack
rule-crypto 7.5/10 6 F-CRY-001 (LOW): context-sensitive negatives _in_tests_dir() confirmed as 3-rule convention, not ownership drift

Commit 5: FRESHNESS.md

  • 3 units NEVER → CURRENT
  • Cross-unit audit entry added

Calibration checkpoint

  1. SR-02 transferred cleanly — adversarial evidence supports pattern safety for the hardest regexes in the codebase
  2. Dim 4 stayed honest at 6 — consistent with Batch 1, no inflation despite strong ReDoS suites
  3. SR-09 scored independently — each verdict references full fixture matrix categories, not just ReDoS
  4. _in_tests_dir() grounded — established convention across 3 rules (weak_crypto, secrets, creds), not engine-level concern

Test plan

  • uv run ruff check src/grippy/ tests/ — all clean
  • uv run ruff format --check src/grippy/ tests/ — all clean
  • uv run mypy src/grippy/ — 0 issues
  • uv run pytest tests/ -v — 1075 passed, 0 failures
  • uv run pre-commit run --all-files — all passed
  • FRESHNESS.md unit count = 30 (15 CURRENT + 15 NEVER)

🤖 Generated with Claude Code

Closes SR-02 gaps with Tier A evidence for rule-traversal (3 regexes),
rule-sql (4 patterns incl. _PERCENT_SQL/_CONCAT_SQL primary targets),
and rule-crypto (random pattern). Closes SR-01 gap for rule-crypto
(RC4, ARC4, Blowfish, random.random/choice/getrandbits now tested).
Adds 1MB long-line tolerance tests and safe-negative specificity anchors.

All SQL ReDoS tests pass — no backtracking vulnerability found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SR checklist: 7/9 PASS, 1 N/A (SR-06), 1 Partial (SR-09).
Overall: 7.4/10 Adequate (provisional).
One LOW finding (F-TRV-001): fixture matrix edge-case gaps.
Dim 4 at 6 — ReDoS proven on 2 quantifier-bearing patterns,
_TRAVERSAL_RE structurally immune (no quantifiers).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SR checklist: 7/9 PASS, 1 N/A (SR-06), 1 Partial (SR-09).
Overall: 7.4/10 Adequate (provisional).
One LOW finding (F-SQL-001): fixture matrix missing near-miss negatives.
SR-02 PRIMARY STRESS TEST PASSED: _PERCENT_SQL and _CONCAT_SQL with
.*\b...\b.* structure do not exhibit catastrophic backtracking.
Dim 4 at 6 — strongest adversarial suite in batch (5 tests) but
coverage is narrow (ReDoS only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SR checklist: 7/9 PASS, 1 N/A (SR-06), 1 Partial (SR-09).
Overall: 7.5/10 Adequate (provisional).
One LOW finding (F-CRY-001): missing context-sensitive negatives.
Dim 4 at 6 — all patterns structurally safe.
Dim 5 at 7 — pattern-specific messages with remediation guidance.
Dim 6 at 8 — strongest test coverage in batch (24 tests, all
7 entries + all 6 random variants proven).
_in_tests_dir() confirmed as established convention (3 rules),
not ownership drift — documented as Dim 7 design observation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mark rule-traversal (7.4), rule-sql (7.4), rule-crypto (7.5) as
CURRENT. Add cross-unit audit entry. 15/30 units now CURRENT —
halfway mark reached.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Comment thread docs/internals/audit/rule-traversal/SCORECARD.md
Comment thread docs/internals/audit/rule-sql/SCORECARD.md
Comment thread docs/internals/audit/rule-crypto/SCORECARD.md
@github-actions
Copy link
Copy Markdown
Contributor

✅ Grippy Review — PASS

Score: 94/100 | Findings: 3

Delta: 3 new


Commit: 68e2fd1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All required CI checks passed. Auto-approved by navi-bot.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Fieldnote-Echo Nelson Spence (Fieldnote-Echo) merged commit eeaa205 into main Mar 14, 2026
19 checks passed
@Fieldnote-Echo Nelson Spence (Fieldnote-Echo) deleted the audit/wave-2-batch-2 branch March 14, 2026 12:52
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.

3 participants