Repository navigation
feat: read check evidence through the control API - #1317
Merged
Merged
Conversation
People with view.evidence on a check's model can read the sample rows stored with one of its results. Columns are the rows' keys in sorted order, the order the warehouse stores them in, and a row without a key holds null there. Every read is audited, and a read whose audit cannot be written discloses nothing. The SQL and evidence reads now share one authorize, read and audit path.
kvlonge
enabled auto-merge (squash)
November 6, 2026 03:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The UI's check panel shows the rows a failing check captured. Those rows are warehouse data, so reading them needs its own permission and an audit entry, separate from listing checks and from reading their SQL.
Changes
GET /api/control/locations/{location}/targets/{target}/checks/{binding_key}/results/{event_id}/evidencereturns{columns, rows, truncated}for one recorded result, ornullwhen that result does not belong to the check, target or location.nullfor a missing key. Cells keep their JSON type, including booleans.view.evidenceon the check's attached node, or on every node when that node is not in the current snapshot. No built-in default role grants it.evidence.readaudit entry holding the scope,binding_key,event_idandfound, never the rows. If the audit write fails, nothing is returned.Verification
cargo test -p sqlbuild-orchestration --all-features: endpoint tests on SQLite and PostgreSQL cover the administrator read, developer denial with the narrowed scope, the audit entry, a result from another check returningnull, a failed audit write disclosing nothing, and malformed stored evidence.make check-ci, public-repository scan.check_identity.jsonfixture, extended with captured rows.