Skip to content

feat: verified findings backend (S1) - #162

Merged
BaaRai merged 3 commits into
mainfrom
feat/verified-findings
Nov 9, 2026
Merged

BaaRai merged 3 commits into
mainfrom
feat/verified-findings

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

What

Backend for machine-checked finding verification (spec S1). A finding is verified only when:

  1. a proof or verification traffic body is bound,
  2. the agent declares poe_level >= 3,
  3. every evidence_quotes entry of at least 8 runes (after whitespace normalization) appears verbatim in one of those response bodies.

Shorter quotes are ignored; if none remain the finding is unverified with the note evidence quote too short. Everything else is unverified (with a note), or not_assessed when a read fails. The report is always saved; a downgrade is reported in the tool result.

Changes

  • schema: poe_level, verification_status, verification_note on findings (idempotent, no CHECK, no backfill: existing rows stay unverified).
  • db: SetFindingVerification (validates status and POE 0-4); fields scanned with finding rows and exposed in the DTO.
  • update_finding_report: optional poe_level and evidence_quotes; one-time schema upgrade for existing databases.
  • report agent guidance (appended at run time).

Status values

  • verified, unverified, not_assessed are produced by this PR.
  • blocked is accepted by the validator but no path produces it yet; reserved for S1b (external control prevented exploitation).
  • false_positive is accepted but no path produces it, and it duplicates the human disposition findings.status = false_positive. The human disposition stays in status; this column is the machine proof state only.

Known limit

readBoundResponse reads every proof/verification body, up to 4 MiB each. A finding with many large bindings does more I/O than necessary; bounded by the cap, not by the number of bindings.

Not in this PR

  • UI badges and filters.
  • The stored default report prompt is not changed for existing databases (the guidance is appended at run time).
  • Non-HTTP findings stay unverified until S1b.

Verification

  • go build ./..., go vet: pass locally. Non-Postgres tests: pass locally.
  • The TestVerification* server tests need Postgres: they run in CI only.

Do not merge before go, shell and web are green on the exact head SHA.

Add a machine-checked verification state to findings, separate from the
human disposition (status). A finding is verified only when a proof or
verification traffic body is bound, the agent declares POE L3 or higher,
and every evidence quote appears verbatim, after whitespace
normalization, in one of those response bodies.

- schema: poe_level, verification_status, verification_note on findings
  (idempotent ADD COLUMN IF NOT EXISTS, no CHECK, no backfill).
- db: SetFindingVerification validates status and POE 0-4; the three
  fields are scanned with the finding rows and exposed in the DTO.
- update_finding_report: optional poe_level and evidence_quotes. The
  report is always saved; verification only decides the status. Read
  failures give not_assessed, never unverified.
- report agent guidance: declare POE and exact quotes from the bound body.

Not in this change: UI badges and filters, the blocked and false_positive
transitions, and the stored default report prompt for existing databases
(the guidance is appended at run time).
A two-character quote such as "x7" can exist in any body and proves
nothing. Normalized quotes under 8 runes are now ignored; if none remain
the finding is unverified with the note "evidence quote too short".
Check order is unchanged: binding, POE, quote presence, then body.
The quote x7 is now rejected as too short before the store is read, so the
test never reached the not_assessed path. Use a quote long enough to pass
the minimum; the store removal is unchanged.
@BaaRai
BaaRai merged commit 34cbbea into main Nov 9, 2026
3 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.

1 participant