Skip to content

fix: let a validator prove only the kinds it declares - #144

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
fix/validator-kinds
Sep 25, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
fix/validator-kinds

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Closes #143. This fixes a soundness bug found while designing enterprise-validators, before release 0.8.0 (#142, held until this lands).

Problem

The refutation accepted a Validator as a proof for every kind, whatever the kinds it declares. A redirect validator guarding os.system(target) refuted the command injection, and the finding was dropped. No bundled model was affected (re.fullmatch declares all kinds). But user-declared validators would each have silently refuted every other kind.

Change

  • What a proof covers. recognise() returns, with each proof, the kinds it covers. Built-in checks (string validators, constant allowlists, equality with a constant) cover every kind, as before; a Validator covers the kinds it declares.
  • When a proof counts. A proof counts for a flow only when it covers every kind the flow carries into the sink. Otherwise the guard is an unproven one, and the flow is a hotspot.

Verification

  • pytest: 1082 passed. ruff check src tests and mypy are clean.
  • pytest -m regression under Python 3.12: 19 passed, no snapshot changed.
  • The new test, red before the fix, pins four cases:
    • REDIRECT validator on a COMMAND flow: hotspot;
    • COMMAND validator on a COMMAND flow: refuted;
    • COMMAND validator on a COMMAND|SQL sink: hotspot;
    • COMMAND|SQL validator on a COMMAND|SQL sink: refuted.
  • Mutation check. Ignoring the kinds again fails that test.

@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 25, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit f93684d into main Sep 25, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the fix/validator-kinds branch September 25, 2026 01:00
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.

Refutation: a validator proves only the kinds it declares

1 participant