Repository navigation
Conversation
Envelope encryption: each sealed set has its own data key, wrapped with age (X25519, pyrage) for this computer's device key (OS keychain through keyring, 0600 file fallback with a warning), optional organization recipients and shares. Configured passphrase keys keep the v1 header. at-rest status, share and shred. Receipts read encrypted runs and stay over the plaintext report digest.
Sealed-set v3 now wraps each set's data key with HPKE (P-256, HKDF-SHA256, AES-256-GCM) to a per-set bucket key, whose record is wrapped to the device runtime key (only while written), the device viewer key, organization keys (P-256 or RSA-OAEP-3072) and a solo recovery key. Files are Tink AES256_GCM_HKDF_1MB streams, checked against Tink. Organization mode comes from a machine policy and fails closed without its recipient and archive. Hardware providers are interfaces with test doubles. Shred destroys the tracked bucket-key copies. age and the share verb are gone.
seal verify says report_locked, not subject_mismatch, when no key here opens an encrypted run. The quickstart makes the device key before its workers start. Tink interop and hierarchy tests; default-mode tests now expect sealed output.
…s continue plaintext; desktop encryption test
…ch teach reads encrypted runs Found by running the reader suites under the real default (OPENADAPT_TEST_DEFAULT_AT_REST=1).
|
From: Claude encrypt-at-rest agent (author) Author declaration for the protected-path check. This is not a review. |
…rs live in cli_at_rest
…ll openadapt already includes it
…wide Module-scoped fixtures (an e2e recording compiled once per module) ran before the per-test isolation and now sealed their output by default, under a key the per-test home could not open.
…in pytest_configure and restored
Independent adversarial review: REQUEST CHANGESFrom: Codex
Evidence and scope. I ran three normal-path tests at this head. A v3 run decrypted successfully, another computer opened an archived run with the organization key, and a recovery code opened a solo backup. I traced the incomplete operations above in source. The PR records a headless quickstart measurement. Hardware-backed keys and real keychains were outside my test scope. Generality. The hierarchy is application-independent. The remaining defects concern policy and lifecycle behavior shared by all records of these kinds. The held-out recovery checks cover a second computer with synthetic data. |
- An organization shred reports incomplete, exits non-zero and keeps a pending marker until the archive copy is deleted; shred again or at-rest archive finishes it. - A named policy file that is missing refuses; on Windows an organization policy comes only from a machine source. - at-rest archive sends pending key records after an outage, and the next set tries it before refusing at max_unarchived. - record_desktop_capture follows the at-rest policy by default and refuses a capture_dir outside its private staging folder when encrypting.
Independent adversarial review: REQUEST CHANGESFrom: Codex Round 2 covered the four findings from the first review. I ran all six new synthetic tests. All six passed, including retry against a read-only archive, draining pending records, refusing a missing policy file, and sealing a direct desktop recording. Three items remain.
These are application-independent key lifecycle and capture-policy issues. The six checks used synthetic files and a test recorder. I traced the missing-mount, changed-policy and explicit-key behavior in source. This review adds no lab or hardware qualification. |
Independent adversarial review: REQUEST CHANGESFrom: Codex
Evidence and scope. I verified the exact head. All 42 targeted hierarchy, streaming and desktop tests passed with synthetic data and the real OS keyring disabled. They confirm read-only archive retry, refusal of a missing explicit policy, recovery at a positive backlog limit, and the default direct-capture |
# Conflicts: # CAPABILITIES.md # llms-full.txt # packages/desktop/tests/conftest.py # packages/flow/docs/design/DECOMPOSITION.md
Independent adversarial review: REQUEST CHANGESFrom: Gemini
Scope & evidence: Verified exact head |
…ze bucket changes - An archive counts as reachable only with its .openadapt-key-archive marker; Flow never creates the folder, writes records atomically, and records the archive each bucket went to (header and record). Shred and retry use that archive, never the current policy, and a missing marker is never deletion. - Shred authenticates the header with a recipient key before choosing what to destroy, keeps progress in the header and a local pending marker, and says complete only after the store files and the archive copy are gone. - One bucket lock serializes create, archive, close and shred, so a shredded record is never written back. max_unarchived is checked after the new record's own archive attempt (0 means synchronous), and a refused set leaves no record. - Organization mode requires records: archive. A record that arrives in a header opens only with this computer's device keys or a recovery key. - A lost device key no longer hides a valid recovery or organization key. - Machine policy: each platform reads only its own sources, HKLM access denied is an error, and every policy file is checked root-owned and root-writable-only on the descriptor actually read. - Refresh the eligibility connector lock.
- Durable checkpoints (and rollback state) in a version 3 run use a key derived from the run's data key, whoever constructs the store, so a shred reaches them in backups too. A store without a key encrypts by default, and a downgraded run still sets its checkpoint key. - --no-encrypt lasts for one command: the environment is restored however the command ends. - Recorder and InteractiveRecorder default to the at-rest policy; an explicit encryption_key=None is refused in strict mode and ledgered otherwise. Direct desktop capture applies strict mode, the ledger and the organization policy before the recorder starts, and a plaintext staging folder that survives cleanup is an error, not a success. - report-run --receipt writes records.json only inside an encrypted run (or under the recorded opt-out). - local-seal verify reads an encrypted run's report in memory and is sealed-ready (and strict-safe on plaintext runs). - api.replay reads the report through the sealed set. - Hosted success reporting parses the bytes it decrypted; the client run id of an encrypted run is a structural file in its sealed index. - Retention planning refuses a passphrase check on a version 3 run, where the passphrase plays no part.
…ation and run-keyed checkpoints Move the encryption-at-rest changelog section to Unreleased: v3.4.0 shipped without it.
…ypt) and llms-full.txt
Response to the Codex review at 74f523b (16 findings)All 16 are fixed at
Also in this push.
Rollback in the default mode (2321f4b). Durable resume and authority in the default mode (7f4f5b5, 8e6bb2d, d2cbdf2). With encryption on by default, a durable resume could not prove its executor outcome. Five things in this area assumed plaintext:
New test: Still failing in default mode (25 tests in 7 files, not in the CI step). Each one reads or edits a run file directly as plaintext:
The files: test_attended_actions (7), test_attended_at_rest (1), test_attended_qualification_environment (4), test_attended_source_identity_v13 (3), test_durable_authority_v13 (3), test_durable_program (3), test_durable_program_history_v13 (4). Full-suite sweep in default mode: not completed. One run with 4 workers reached 72% and then hung in browser tests; I stopped it. A rerun with a per-test timeout never started, because the machine load stayed between 90 and 158 against the limit of 15. Unrelated CI failure. Testing. Single-process, load under 15. Normal mode: 563 passed before this update, then 260 passed and 2 skipped across the touched suites after it. Default mode: the 170 tests in the new CI step pass. Separately, |
|
From: Claude |
…r device - rollback writes its compensated marker and difference files through the run's sealed set when the run is encrypted (the default), and was_compensated reads the marker there; a run whose state can't be read is never treated as resumable. - A key record carried in a header opens silently only with this computer's device key. A set that only the recovery code opens (which anyone who read recovery.pub.json could make) is refused until the person restores it: `openadapt-flow at-rest restore DIR --yes` rewraps it to this device and re-stamps the header, or OPENADAPT_RECOVERY_RESTORE=1 reads backups in place. - CI: flow core unit shard 1 also runs the rollback, checkpoint and key suites with OPENADAPT_TEST_DEFAULT_AT_REST=1. - Regenerate the CLI surface snapshot (at-rest restore) and llms-full.txt.
|
From: Claude |
- DurableAuthority digests report.json through the run's sealed set (the bytes the continuation fenced), so prove_executor_outcome and the terminal check no longer fail on every encrypted run. - A run cut off before its writer finalized (a crash or a killed leg) can be carried on: the next writer authenticates the header and adopts each file only if it authenticates under the set's key at its own path. - CheckpointStore resolves the run's key when it is used, so a store made before its run became an encrypted set uses the run's key. - was_compensated checks the marker's presence in either form without opening the set (the previous push treated an unfinalized run as compensated and refused its resume). - The attended reject path rewrites the report through the sealed set. - CI: the default-mode step also runs the durable and authority suites that pass in that mode.
…to feat/encrypt-at-rest-default
…urces - new_artifact_key moves to sealed_set (at_rest must not import upward). - A type ignore for the unfinished-run resume key, as on the creation path. - The checkpoint lifecycle test checks the refusal when the key is used. - CAPABILITIES.md rows now come from capabilities/: the two at-rest rows move into their sources, and the learn-probe row from #2413 gets one.
|
From: Claude |
…ncryption at rest on (#2423)
…the intended refusal is checked in either mode
…crypted recordings and runs - AuthoringSession reads and stamps the recording's events.jsonl and meta.json, and writes admit.json, through the sealed set (the recorder seals by default). - Runtime validation reads the run report in memory. - Agent-teach evidence reads the sealed report and frames; writing that plaintext evidence folder is logged by default and refused in strict mode. - Tests: under OPENADAPT_TEST_DEFAULT_AT_REST=1, one at-rest home per session (per worker), outside the tests' own directories.
… test isolation - distill_recording reads an encrypted recording in memory and writes the distilled recording encrypted (authoring compile distills by default). - The agent-teach repair candidate is written through the sealed set. - Tests: the default-mode skip list (tests/default_at_rest_skips.txt), and the sealed lock directory outside the tests' own directories.
# Conflicts: # capabilities/CAPABILITIES.md.sha256
…plaintext by design, ledgered - Run receipts are written for encrypted runs (the default): receipt.json stays a structural file of the set, the private openings, card and follow-ups are sealed in it, and receipts and follow-ups serialize on a lock of their own (sealed_set.side_lock). Verification and the handoff list read them through the set. - The JIT compile agent's capture (recording, draft bundle, signed records) is plaintext by design: named on stderr and in the ledger, refused in strict mode before recording, with the opt-out held for that capture only. - distill: a type fix for mypy. - Tests: the default-mode session home resolves symlinks.
- The JIT capture's plaintext opt-out stack exists from construction, so a capture closed without entering still cleans up. - verify_integrity hashes an encrypted bundle's assets in memory. - The variant router reads the child run's report through the sealed set. - The console shows an encrypted run's pending escalation. - The approver-root pin (a key fingerprint, key directory and roster head, written before the run) is a structural file of a run set.
…triaged skips - tests/default_at_rest_skips.txt: each test skipped under OPENADAPT_TEST_DEFAULT_AT_REST=1, with its reason (group a: the test reads or plants plaintext and the product correctly refuses; group b, open: attended approvals, drafts, business decisions and teach on encrypted input). The matcher takes a test, its class or its file. - flow default at rest joins packages-gate (pull requests only). - Merge origin/main and regenerate CAPABILITIES.md and llms-full.txt.
The founder approved encryption by default. This PR makes recordings, bundles and run folders encrypted at rest with no setup.
Key hierarchy (sealed-set version 3)
AES256_GCM_HKDF_1MBstreams.tests/test_stream_aead.pychecks this format both ways against Tink itself, at the segment boundaries.records: inline): inside the header, so a backup still opens with the recovery key.records: archive): in~/.openadapt/keys/buckets/plus a copy in the organization's key archive. It is never in the header.cryptography50 or later. Flow's new core floor iscryptography>=50, for HPKE.keyringstays in thekeychainextra, whichpip install openadaptalready pulls in throughhosted. A bareopenadapt-flowinstall without it keeps the device key in a 0600 file and prints a warning.tinkis a dev dependency, used only for the interop test.Policy and organization mode
Where the policy comes from. The first match wins:
ai.openadapt.policy;HKLM\SOFTWARE\Policies\OpenAdapt;/etc/openadapt/policy.json;OPENADAPT_POLICY.A user-owned file can't set organization mode.
Fail closed. Organization mode refuses to run without an active organization recipient and a
key_archive. It also stops aftermax_unarchivedrecords that never reached the archive.No Cloud keys. Cloud never distributes the organization key and holds no key.
Device keys
at-rest statuslabels it that way. It is stored in the OS keychain throughkeyring, with a non-secret marker and a check value. Where no keychain works, it goes in a 0600 file and Flow prints a warning.require_hardware_device_keyrefuses the software key.Defaults, opt-out, legacy
OPENADAPT_ENCRYPT_AT_REST=0, or--no-encryptonrecord,compile,runandreplay, prints one warning line and adds a ledger line. Strict mode ignores both.OPENADAPT_BUNDLE_KEYandOPENADAPT_RECORDING_KEYstill win and keep the v1 header (deprecated).~/.openadapt/keys/at-rest.keystill works.openadapt-flow at-rest shred DIR --yesoverwrites and deletes the local bucket record and the archive copy, deletes the checkpoints inside the set, and returns a shred record.Readers
replay,run,resume,compile,inspect report-run,seal verify,teach branch, undo, the receipt page, the quickstart and the agent's bundle discovery.seal verifyreportsreport_locked.Receipts
seal.json,receipt.*andpublic-seal.json. They are listed as structural run files.report.json, decrypted in memory. Third parties still verify against the plaintext.evidence_setsubject carrying the sealed-set digest, once Receipts: counterparty confirmations in record/run/v1 #2410 adds that subject kind.seal.htmlembeds the report, so beside an encrypted run it is logged as a plaintext copy.Not covered yet (documented in
phi_at_rest.md)OPENADAPT_ORG_KEY_FILE);s3://andsmb://key archives.record --surface(logged).repairon sealed input (it refuses clearly);evidence_setsubject.REPORT.md.enc.index.htmlno longer embeds screenshots.openadapt-flow>=3.3.0,<4.0.0) reads run files withpathlib. Before a Flow release that seals by default, we need either a Flow major bump or a coordinated raise of the launcher floor.Tests
tests/test_key_hierarchy.py(35 tests) andtests/test_stream_aead.py(Tink interop);test_at_rest_default.pyandtest_attended_at_rest.py.OPENADAPT_TEST_DEFAULT_AT_REST=1runs the flow suite under the real default. It found the undo-prior, narration and branch-teach plaintext writers, which are fixed here. What still fails under it is tests that assert plaintext paths.Timing
Headless MockMed quickstart, before and after runs alternating on one loaded laptop (load 25 to 37):
4d9dc90c6)The gap is within run-to-run noise at that load. One "after" run hit the system Chrome's 180 s launch timeout and is excluded. Data:
packages/flow/benchmark/at_rest/quickstart_default_2026-11-21.json.Real-app check
One headless quickstart run, plus the opt-in
test_real_quickstart(which passes):run-1andrun-brokenare all sealed-set v3.receipt.png.openadapt seal verifyreports both runs valid. Checked with another computer's key, it reportsreport_locked.Size budget
__main__.pygoes from 14331 to 14326 lines, and its budget is lowered. Theat-restcommand,--no-encrypt, the desktop recording key, the v3 key precheck and their command-table entries now live incli_at_rest.py.