Repository navigation
feat(evidence): show the device state, UI tree and logs behind a verdict - #406
Merged
Merged
Conversation
Evidence schema v4 adds a capture record to every state and tree, log and report artifacts with a named origin and capture time. Unobserved values read unknown. Text artifacts are redacted with the existing evidence redaction, capped at 4 MiB, and stored as inert .txt files. Unavailable sources are recorded with a reason. Schema v1 to v3 inputs and recorded runs stay valid, proven with real v3 fixtures. Refs #352
Authorization redaction covers any scheme, an unquoted cookie stops at quotes and angle brackets, and JSON values honour escaped quotes. The size limit also holds after redaction. Unavailable artifacts show their capture time, and the TypeScript report drops terminal controls.
…E and unquoted tag text
…xact Each JSON value in a line is masked while the plain-text rules run, so JSON before trailing text is redacted and a Cookie header still covers the rest of its line. The secret-name prefix rule now uses the JSON key rules, so max_tokens keeps its value. In a Lighthouse report only audit ids lose secret-key handling. Decoding keeps unknown references apart from decoded ampersands. Candidate parsing stops 32 levels down and after 4096 failed starts, so lines of brackets stay linear.
A JSON string with a lone surrogate, such as a console message cut inside an emoji, decoded to an empty value, so its text skipped redaction. It is now replaced whole, and a key that does not decode is matched as written.
…imits A small JSON scanner replaces the serde check. It reads numbers as text, so 1e400 no longer rejects a value, and it has no nesting limit. Where JSON stops being valid, the valid part is redacted as JSON in place and stays plain text, and the search goes on from there, so each byte is read once and no fallback skips nested secrets. A literal marker character in the input is escaped, so only inserted markers are restored.
When JSON in a line breaks inside a value under a secret key, the rest of that value is redacted up to the bracket that closes it, or to the end of the line, so the plain-text rules no longer see it without its key. A JSON key that does not decode now counts as a secret key.
…y context JSON that breaks off is now rewritten by the same token rewriter, read leniently up to where its outer container closes, so keys after the break, including escaped ones, keep their meaning. Stray words are copied or redacted under a secret key, a closer closes back to the container it matches, and a closer that does not match inside a secret value redacts the rest of the line. Inside a secret container of broken JSON, keys are redacted too. Each fragment trims its line break once, and a closer that matches no container costs O(1).
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.
Evidence accepted only screenshots. A reviewer could not see the UI tree or the log excerpt behind a verdict, or the device state at capture time, and matrix runs and the rule checks in #353 need all three.
pickforge evidence recordnow writes schema v4. Each state can carry a capture with the requested and observed device state, the capture time, the app build and the emulator and system image versions; a value that was not observed is recorded asunknown. UI trees, log excerpts and Lighthouse reports are read as UTF-8 files of at most 4 MiB, redacted, and stored as plain.txtthat no viewer runs. A source that is not available records its reason. Schema v1 to v3 inputs and recorded runs stay valid.Redaction keeps stored output usable. JSON is rewritten token by token, so numbers, spacing and order survive and rule checks can parse it. XML is redacted in decoded form and encoded again, so trees stay well formed. JSON inside a log line is redacted with its key context, and broken JSON is read leniently so a secret after the break is still found.
Proof: the CI jobs pass locally on the merge with
main(231151b): cargo fmt, clippy and workspace tests, tsc, oxlint, vitest (3370 passed) and build. The evidence fixtures are marked-text, so Windows checkouts keep them byte for byte. PickCheck reports no violations. The QA pass ran nine CLI journeys; the redaction journey that failed was rerun on b2997ea and passes.Council (Sol and Fable, with Kimi in rounds 1 and 2): ten rounds. On 0a38a23 Sol approved with 10/10 and Fable with 9/10; a differential fuzz of 18,000 outputs found valid JSON unchanged and no new leaks.
Rollback: revert the merge commit. No release has shipped schema v4, so only v4 runs recorded locally in between would be skipped by the older reader.
Closes #352
evidence.rs: text artifacts are copied, redacted and stored as.txtwith kind, origin, format and capture timetests/evidence_capture.rs; QA journeys 1 and 7unknown;requestedlists only given keys; invalid rotation, density, font scale, dark mode, time, unknown fields and empty build are rejected with no run written~/.pickforge/investigations/qa-352/out/j7.txttests/evidence_capture.rs; QA journey 1unknown; secrets in build strings are redacted~/.pickforge/investigations/qa-352/out/j1.outtests/evidence_capture.rs~/.pickforge/investigations/qa-352/out/j5-*.outtext_redaction.rs; QA journey 2 rerun on b2997ea; CLI run with the council's broken-JSON inputs~/.pickforge/investigations/qa-352/rerun-b2997ea/unavailable: "no AT-SPI bus"~/.pickforge/investigations/qa-352/out/j8-report.txt<script>andonerroris stored only as.txt; report.md escapes markup and links only to the artifact path~/.pickforge/investigations/qa-352/out/j3.out~/.pickforge/investigations/qa-352/out/j6-report-v3.txtpackages/core/test/rust-evidence.test.tspickforge-lab artifacts reportshow captures and artifacts as captured, unavailable or missing~/.pickforge/investigations/qa-352/out/j8-report-missing.txtDeclined: validating locale, display mode and fold state against a fixed vocabulary, because the rule checks in #353 own normalization; Fable's notes on unterminated strings losing their text and on redacting the rest of a line after a break inside a secret value, which trade readable text for safety; continuing instead of stopping when a key appears inside a secret value, which is equally safe; and duplicate
[REDACTED]keys for undecodable keys.Follow-ups: #388 (capture trees, logs and reports from the tools), #389 (align the Rust and TypeScript redactors), #390 (show a deleted screenshot as missing), #401 (secret context across pretty-printed JSON), #403 (escaped key names in plain-text rules), #405 (a stray closer between a secret key and its colon).