Files
reverse-engineering-anything/docs/specs/desktop-app-environments/build-secrets/verification.md
T
387bcb795d feat(desktop): isolate declared secrets during app builds (#9225)
* fix(desktop): preserve local file URL authority

* fix(desktop): preserve local file URL authority

* fix(desktop): preserve local file URL authority

* fix(desktop): render captured file URLs at launch

* fix(desktop): classify numeric timestamps using field context

* fix(desktop): classify numeric timestamps using field context

* fix(desktop): classify numeric timestamps using field context

* fix(desktop): retain context for generated draft values

* fix(desktop): retain context for generated draft values

* fix(desktop): retain context for generated draft values

* test(desktop): cover generated IDs in text guards

* test(desktop): cover generated IDs in text guards

* test(desktop): cover generated IDs in text guards

* fix(desktop): isolate launcher URL encoding

* fix(desktop): isolate launcher URL encoding

* fix(desktop): isolate launcher URL encoding

* fix(desktop): isolate launcher URL encoding

* fix(desktop): bound private key redaction spans

* fix(desktop): retain published bundle on copy failure

* fix(desktop): retain secret file cleanup owners

* fix(desktop): retain both published output cleanup owners

* test(desktop): verify UTF-16 credential refusal

* test(desktop): verify truncated secret redaction over MCP

* fix(desktop): retain clean text in noisy record fields

* fix(desktop): classify added line values in one pass

* fix(desktop): scan private key runs in one pass

* fix(desktop): apply XML quote rules to text drafts

* fix(desktop): distinguish XML attributes from quoted text

* fix(desktop): preserve parsed XML line context

* Format appTaskChecks.ts with the pinned oxfmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): retain partial XML syntax facts

* fix(desktop): recognize markdown autolinks in drafts

* fix(desktop): reuse export exclusions in task drafts

* fix(desktop): report unchecked client build paths

* docs(desktop): clarify gzip scrub limits

* test(desktop): build the fixture JWT from its parts and reformat

The literal token made every edit of this file trip secret scanners; the test
checks the same string. Also applies the pinned oxfmt to the key-run test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): reuse export exclusions in task drafts

* docs(desktop): clarify gzip scrub limits

* fix(setup): own desktop build process cleanup

* fix(desktop): find no private key in NSS's key4.db password check

An Electron app's NSS key database holds a password-check value shaped like
an encrypted private key, so every such export was refused. An encrypted key
now counts only under a password-based encryption scheme, never PBKDF2 or
PBMAC1, and with at least the 48 bytes of encrypted data the smallest key
needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(doctor): compare desktop settings with resolved defaults

* style(desktop): format the noisy-record draft files with the pinned oxfmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): give the root-array draft test its own describe

The records describe grew past the 150-line lint limit with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(doctor): inspect client-recorded desktop runners

* fix(doctor): reuse matching runner probes

* fix(setup): propagate cancellation to desktop actions

* fix(setup): stop Hopper on cancel, never report a cancelled setup ready, and keep a failed action's client setting

- The Hopper install gets setup's signal: Linux already honoured it, and the
  macOS installer now stops its downloads and stops before mounting or copying.
- runSetup checks the signal after the final doctor and close, so a
  cancellation there raises instead of returning ready.
- A failed pack or agentenv install no longer writes its archive or runner to
  client configs, so the setting the client already had stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): close five withheld-state gaps a review found

- A sign-in window whose walk hit its entry limit, could not read a path or
  left a change unconfirmed is refused, rather than trusted as complete.
- The export refuses app dconf keys the sign-in window changed and the seed
  would ship with a different value, naming the keys, not their values.
- A bundle holding a gzip file that expands past what REA scans is refused.
- Withheld bytes are kept under a handle of their own, created exclusively and
  never replaced; a later build's different bytes take the next free handle,
  and a handle the computer's answer names is checked before any write.
- Setting names a Python keyword or a leading digit would break get file_,
  and names that collide get _2, _3 in a stable order.
- Adds the feature's tasks.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): redact a cut secret's start only at REA's own cuts

The boundary match for a secret cut short hid the start of any ellipsis-ended
text, so "Please…" became a redaction. It now applies only where text ends
one of REA's value cuts, whose lengths the producers and the redactor share,
and the host redacts the app's stderr and progress before it quotes their
end. Redacting before anything cuts stays a follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(setup): keep the completed setup result in a cancellation after cleanup

A cancellation during the final doctor or host close carried only the applied
actions, dropping each client's result and backup path and the doctor report.
It now carries the whole result as setup_result, as doctor's cancellation
carries its report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(desktop): publish secret files atomically, decompress a gzip seed once, and scan JSON strings linearly

- A secret file is written under a private temporary name and linked to its
  handle, so a concurrent export never reads a half-written file and reuses
  its handle for other bytes.
- The export decompresses each gzip seed file once and shares the result
  with the secret scan, the credential scan and the size refusal.
- The cut-secret stopgap finds JSON string literals in one forward pass
  instead of restarting at every quote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(desktop): move launch execution to boundary suite

* fix(desktop): redact build schema failure output

* refactor(desktop): normalize schema failure once

* fix(desktop): omit unsafe schema parser snippets

* fix(desktop): preserve draft change and selected path evidence

* test(desktop): group retained dconf note regressions

* fix(desktop): respect archive entry format in draft checks

* test(desktop): separate unowned-file draft note cases

* fix(desktop): preserve explicitly selected journal documents

* fix(xml): avoid scanning selected ancestors per tag

* fix(desktop): exclude covered text runs from draft counts

* fix: preserve text when drafting desktop checks

* fix: restore nested desktop state aliases

* refactor: share UUID recognition across draft checks

* fix: retain multiline XML attribute context

* fix: retain relationship identifiers in task drafts

* docs: clarify desktop draft identifier handling

* test(desktop): type formatting run cases as pairs

* fix(desktop): carry document format into selector evaluation

* test(desktop): separate markup boundary regression group

* fix(desktop): propagate formats through draft selectors

* fix(desktop): switch selector format within archive entries

* test(desktop): remove duplicate seed filename case

* fix(setup): retain diagnostics when cancellation overlaps failure

* refactor(setup): keep command cancellation at its owner

* test(setup): verify cancellation at the application boundary

* test(desktop): pass JSON format in exported index parity

* docs(desktop): clarify task checks before scratch export

* fix(desktop): respell selected paths in file URLs

* test(desktop): group captured document spelling cases

* fix(desktop): retain temporary secret file cleanup

* fix(desktop): preserve unmarked token-shaped values

* fix(desktop): withhold drafts after secret use

* fix(desktop): guard drafts against shared secret changes

* test(desktop): compare preserved seed bytes without enumeration

* fix(desktop): bound draft preview serialization

* fix(desktop): restore selected state aliases

* fix(desktop): respect entry format in draft noise

* test(desktop): match exported alias evidence at its JSON boundary

* fix(desktop): retain app state logs in exported seeds

* fix: align desktop numeric seed comparisons

* test(desktop): keep one draft exclusion fixture import

* test(desktop): retain log eligibility across draft test groups

* fix(doctor): resolve empty registered desktop runner

* style: fix desktop launch test formatting

* style: format native command path schema

* fix(desktop): map selected external launch paths

* style(desktop): format seed document regressions

* test(desktop): group launch URL regressions

* fix(desktop): omit redundant nested state aliases

* fix(desktop): compare added free text as a whole

* fix(desktop): check recompressed seeds as shipped

* docs(desktop): clarify recovered seed format

* test(desktop): group shipped gzip seed checks

* fix: retain quoted identifier text in task drafts

* fix: recognize Unicode XML in desktop state readers

* fix(desktop): bound nested draft checks

* fix(desktop): explain missing arrays in truncated views

* fix(desktop): find XML type references in archives

* test(desktop): remove duplicated capture assertions

* fix(desktop): retain nested omitted text boundaries

* style(desktop): format draft value imports

* test(desktop): group model and draft value checks

* fix(desktop): map captured launch paths once

* refactor: remove unused whole-text guard state

* refactor: stop passing unused text children

* test: align free-text checks with whole-note policy

* fix: validate recompressed desktop archive seeds

* style(desktop): format archive seed regression

* fix(desktop): retain placed-item sibling guards

* fix(desktop): preserve archive paths and bound doctor reads

* fix(doctor): refuse non-files before descriptor admission

* fix(setup): track remaining cleanup resources across retries

* test(desktop): specify XML format in heap pairing fixture

* fix(doctor): query agentenv for model endpoint

* fix(doctor): preserve uncertainty for empty endpoint override

* fix(desktop): protect host controls and quote withheld paths

* fix: redact declared form-encoded secrets

* fix(desktop): redact runtime schema errors

* fix(desktop): normalize captured file URLs

* fix(desktop): report seeded files by capture path

* fix(desktop): retain startup readiness failure stage

* fix(desktop): retain JSON date checks

* fix(desktop): preserve archive formatting checks

* fix(desktop): preserve explicitly selected journal files

* fix(desktop): report build command transport limits

* docs(desktop): clarify unreadable dconf versions

* test(desktop): remove duplicate history regression

* fix(desktop): align XML names with exported reader

* fix(desktop): create selected state alias targets

* fix(desktop): inspect supported runtime archives

* fix(desktop): retain record identity in draft checks

* fix(desktop): refuse unchecked declared secrets

* fix(desktop): retain partial withheld export receipts

* fix(desktop): detect escaped secrets in JSON state

* fix(desktop): scrub XML independently of reader compatibility

* fix(desktop): preserve file aliases and reader diagnostics

* fix(desktop): scan escaped secrets in UTF-16 JSON

* style(desktop): format secret scan changes

* style(desktop): format review fixes

* style(desktop): format capture review fixes

* style(desktop): format review changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 23:23:13 +08:00

8.6 KiB

Verification

Tests

  • src/domain/desktop/buildSecrets.test.ts: handles; values too short, too long or holding a control character; each spelling found, base64 at every alignment in both alphabets and a gzip file's inside included; a near miss and unrelated bytes not found; text and JSON redacted, member names too; the start of a value each of REA's cuts leaves, a draft value's, a reference's, a view's and a check's, hidden at any length and through an XML or JSON escape, as a string, a JSON member and a result's JSON text; ordinary text ending in …, such as Please…, left whole; an unclosed quote before 64 KiB of escaped quotes scanned in linear time.
  • src/application/desktop/DesktopBuildOutputRead.test.ts: a secret the app's stderr or the capture's progress holds, redacted before the quote of their end cuts it.
  • src/desktop/BuildSecretFiles.test.ts: the folder from XDG_CONFIG_HOME or ~/.config; a 0600 or 0400 file read without its final line break; a file others can read, a symbolic link, a linked folder, a missing file and values it cannot type refused, no refusal quoting the value.
  • src/domain/desktop/computerActions.test.ts, buildWitness.test.ts and src/application/desktop/DesktopBuildActionLog.test.ts: type_secret takes only secret, maps to computer_type and counts as an edit; the log keeps the handle and redacts a typed value.
  • tests/boundary/mcp/buildSecretsMcp.test.ts, over MCP with a fake driver: the driver receives the value as text while no result holds it or an image; screenshot, a file others can read and a missing file are refused; a driver refusal quoting the value shows REA's words; a later refusal quoting it shows the handle; witness.json records the handle and a type holding the value redacted; and an export whose bundle holds a secret's value is refused, naming its files with the value redacted, and writes nothing, as is one holding a gzip file that expands past 64 MiB.

Each of these failed against the code before the change.

KeePassXC on an arm64 build host

KeePassXC 2.7.6 from the Ubuntu 24.04 archive, on an arm64 Ubuntu 24.04 host with agentenv-framework 0.9.1431 and a REA server whose XDG_CONFIG_HOME held one 0600 file, keepassxc-master, with a made-up 30-character password.

  • Build computer: a new database's password and its confirmation were typed with type_secret; each result read Typed the secret keepassxc-master with applied: "yes", and the screenshot afterwards showed 30 dots in each field. type_secret with screenshot: true was refused. The database was saved to Documents/e-test.kdbx, seed marked, a setting changed and end marked.
  • Export: with a second secret file holding keepassxc, a string the bundle holds in its paths and files, the export was refused naming that handle and ten files, envs/<secret:e-probe>/env.toml among them, and no folder was written. With that file removed, the bundle of 10 files was written.
  • Witness, in a computer of the bundle: the seeded database opened locked, type_secret and Return unlocked it, and seed, after edit, near miss and after reset all held. witness.json records the action as {"secret": "keepassxc-master"}.
  • Leaks: every request, result, the driver's and REA server's logs, witness.json, the recording and the bundle (131 files) held the password in none of the spellings the export searches, UTF-16 included; nor did either computer's docker logs or any file in either container. A probe file holding the password's hex and UTF-16 was found by the same scan.

The real-provider observations below predate removal of shape-based credential classification. They describe that earlier build and do not verify current behavior.

Tests

  • src/domain/desktop/appWithheld.test.ts: the owned files changed in the window, and those named; a window missing a checkpoint or out of order, or one a walk may have missed a change in; a path outside the owned paths; settings, variables and handles, a long path hashed and like paths kept apart, and settings that are neither Python keywords nor alike in any order.
  • src/application/desktop/DesktopExportWithheld.test.ts: a withheld file left out of the seed, declared a secret setting from env:, copied aside and named in the README; seeding it refused without a consent and done with one, consent.json shipped; a check on it refused; the draft leaving out the window's files; dconf keys the window changed refused unless the seed holds them as before it or they are seeded with consent.
  • src/application/desktop/DesktopBuildSecrets.test.ts: a kept file's handle that names a path refused, nothing written outside the folder.
  • src/desktop/BuildSecretFiles.concurrent.test.ts: an export never given the handle of another whose different bytes are still being written.
  • tests/boundary/application/buildExportGzipScans.test.ts: a gzip seed file decompressed once for its known-secret and size checks.
  • src/desktop/ExportedAppPython.test.ts: _write_withheld writes the decoded bytes 0600 and _views leaves the file out.
  • tests/boundary/mcp/buildWithheldMcp.test.ts: the named file's bytes kept as a 0600 secret and supplied to a witness's deploy by handle, a variable other than REA_* refused; a later build's bytes kept under a handle of their own, an earlier build's secret left as it was; consent recorded and required for seed_sign_in, and the sign-in window passed to the draft and the export; one sign-in checkpoint alone refused.

Each of these failed against the code before the change.

KeePassXC on an arm64 build host

  • Build: pre-sign-in marked, a database created with its password typed by handle and saved, post-sign-in marked, which acknowledged Documents/e-test.kdbx among its changes, then seed, a setting changed and end. The draft listed withheld_files: ["Documents/e-test.kdbx"], and showed the KeeShare key KeePassXC generated as <credential:private-key>.

  • Export: refused with seed_sign_in and no consent. Without it, the seed held only keepassxc.ini; env.toml set documents_e_test_kdbx to env:REA_KEEPASSXC_DOCUMENTS_E_TEST_KDBX; agentenv's _declare read the setting as a required writeOnly string; the README named the variable; and the host kept the database's base64 as the 0600 secret rea-keepassxc-documents-e-test-kdbx.

  • Deploy without the variable: refused at the probe with Unresolved env:REA_KEEPASSXC_DOCUMENTS_E_TEST_KDBX reference.

  • Witness, from a copy of the bundle with settings naming that handle: the computer wrote Documents/e-test.kdbx, mode 0600, byte for byte the kept file; the agent opened it and unlocked it with type_secret; seed, after edit, near miss and after reset held, and the file was still there after the reset.

  • Leaks: no host file of the run but the secret's own, 146 in all, held the password in any spelling; neither bundle held the database's bytes; and neither computer's logs nor files held the password.

  • The same build, export and witness ran again on the final code with a new password: every stage held, and 124 host files, both bundles and both computers held neither the password nor the database's bytes.

Typora 1.14.9 on an arm64 build host

  • Installed from typora_1.14.9_arm64.deb by URL and SHA-256, on its trial. Its licence file was ~/.config/Typora/rXMW4iG3Bl, hex of {"SLicense":""}; it was mAxvdiPNmi on an amd64 host, so the name differs by machine. Typora writes it at first launch, before any checkpoint, so the export named it in withhold: it was left out of the 84-file seed, declared as REA_TYPORA_CONFIG_TYPORA_RXMW4IG3BL, and kept as the secret rea-typora-config-typora-rxmw4ig3bl.
  • Booted from the bundle's image with a made-up licence in the setting, the initial state the class keeps before the app starts held the made-up file, mode 0600; Typora then found no valid licence and wrote an empty one over the live file, which data/reset would put back.
  • A witness through start_build_computer failed agentenv's first-boot probe (P4 a click in frame space hits its cell), also for a bundle of the same capture exported without withholding, so no stage ran.

Limits of this verification

  • Only a masked field was used: a field that shows its text shows a typed secret in screenshots and in the recording.
  • A deploy refused for want of a variable leaves agentenv's build of that bundle failed; a later run needs agent-env env build or a fresh copy of the bundle.
  • The person's consent was relayed in a test; no person was asked.