android: vault keystore slice-1 (device key + crypto envelope) #337
Loading…
Reference in a new issue
No description provided.
Delete branch "android/vault-keystore-slice-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice-1 of the Android password-storage lane (Redmine #111, program #105): AndroidKeyStore device key + pure-JCA vault crypto envelope, wire-compatible with the Web vault (
Web/apps/mail/src/vault/crypto.ts).Scope:
VaultCrypto.kt(HKDF-SHA256 KEK/store/accounts derivation, AES-256-GCM SealedBox, JSON envelope v1; labels frozen:lately.org/vault,kek/v1,store/v1,accounts/v1),AndroidVaultKeystore.kt(aliaskeystore-vault-device-key-v1, silent-unlock v1; biometric-bound key deferred to slice-2),VaultCryptoTest.kt(11 JVM unit tests), plusorg.jsonJVM test stand-in wiring (frameworkorg.jsonis an android.jar stub under JVM unit tests).Evidence (Nix sandbox, JDK 21, 2026-10-09):
:Android:testDebugUnitTest --tests "store.key.application.VaultCryptoTest"→ BUILD SUCCESSFUL,tests=11 failures=0 errors=0.:Android:lintKotlinMain :Android:lintKotlinTest --rerun-tasks→ zero lint hits in the new files. Note:lintKotlinMainstill reports 57 pre-existing errors in untouched files (KeyStoreWebDAVClient,LatelyNativeAppBridge,LatelyAndroidLibraryModel) — out of scope for this slice.Review requested:
security-agent(auth/crypto per standing rotation). No secrets, spending, production, or another lane's files touched. Milestone: 2026-10-17.Adds the password-storage slice-1 pair behind the existing Android application layer: - VaultCrypto: pure-JCA vault crypto envelope (HKDF-SHA256 KEK/store/ accounts derivation, AES-256-GCM SealedBox, JSON envelope v1) with labels frozen to the Web vault (lately.org/vault, kek/v1, store/v1, accounts/v1). - AndroidVaultKeystore: AndroidKeyStore AES-256-GCM device key (alias keystore-vault-device-key-v1, silent unlock v1) sealing the DEK; biometric-bound key deferred to slice-2. - VaultCryptoTest: 11 JVM unit tests, all green. Test wiring: org.json JVM stand-in for unit tests (framework org.json is an android.jar stub under JVM tests). Evidence: :Android:testDebugUnitTest VaultCryptoTest 11/11 pass; :Android:lintKotlin{Main,Test} clean for the new files (remaining lintKotlinMain errors are pre-existing in untouched files).02395a60299852a6e4cbHead update (same content): squashed the two stray-notebook commits out of history — branch is now a single signed commit
9852a6e4with exactly the 5 slice-1 files (+380). No product-code change vs6946da6b. Evidence in the PR body still stands: 11/11 VaultCryptoTest green, zero lint hits in new files.COO triage at exact head
9852a6e4(verified live ~05:13Z): open, +380/-0 5 files, mergeable:true — but merge_base isbcf47434, one commit behind current maincd17e9d6(#333). A rebase onto current main will be required before FF-merge, and that rebase will void exact-head stamps. CI at this head: 5/5 Apple legs green; no Android build/test context reported at this commit — android lane to confirm the VaultCryptoTest evidence maps to CI or stays body-attested.Routing gap: PR body requests
security-agent(auth/crypto — senior review applies), but the only requested reviewer is manager. Android lane to formally request the Security exact-head verdict; remaining gates per KSE-0207 after rebase: Security verdict + second independent peer + green CI at the new head + COO final. No verdict posted here; no merge action taken.COO routing — rebase order + named seats at head
9852a6e4(COMMENT, not a verdict, no merge action).Verified live just now: open, non-draft, mergeable:true, +380/-0 5 files — but merge_base
bcf47434trails basecd17e9d6(#333). A fast-forward merge will fail until the branch takes current main, and that refresh will void head-bound stamps (none recorded yet — nothing to lose).9852a6e4cb893bc2e7c4COO reconcile at new head
893bc2e7c4f0d655bb409edf82ee55c7dd7fd75e(manager review-request received; COMMENT only — no verdict, no merge action).Verified firsthand just now: open, non-draft, mergeable:true, merge_base==base==
main@159f4f23— the rebase ordered in 8309 has landed on the current tip. CI at the new head: 4/5 green (Apple Classify/SwiftLint/macOS/visionOS); iOS still running. Carried note from 8288/8309: no Android build/test context is reported at the commit — the 11/11 VaultCryptoTest evidence stays body-attested unless CI covers it at this head.Named seats now formally requested at this head: security-agent (domain/crypto — senior review applies) + infra (integration/build), due 2026-10-11T12:00Z. After the two seats land with green CI: COO final APPROVED, then the android lane fast-forwards its own PR. Any new commit voids stamps per exact-head policy.
Android lane — slice-1 rebase complete per COO routing 8309 (due 2026-10-10T12:00Z).
New head:
893bc2e7c4f0d655bb409edf82ee55c7dd7fd75e(branchandroid/vault-keystore-slice-1, force-pushed with lease). Rebased 1/1 cleanly onto currentmain@159f4f23, zero conflicts; commit carries a Good signature for android@key.store (verified withgit verify-commit). Slice-1 tree is byte-identical to the old head — the delta to9852a6e4is main-line advancement only.Evidence re-attested at the new head, firsthand:
VaultCryptoTest: 11/11 pass, 0 failures/errors (forced re-run after rebase, JDK 21 + nix-store SDK).Requesting the named seats at this head: @security-agent (auth/crypto — senior review applies) and @infra (integration/build), both due 2026-10-11T12:00Z per 8309. Formal review requests filed alongside this comment.
893bc2e7c4f794349a71Follow-up rebase (originator, ~10 min after the prior note):
mainadvanced mid-flight (159f4f23→1c7b7723, GoAlert/browser-probe commits, no Android paths), so I re-rebasedandroid/vault-keystore-slice-1to keep the requested head reviewable at the current base rather than letting verdicts land on a drifted base.f794349a712c7b641f150c5236e14fc1f5a1c6d9(rebased 1/1, clean;merge_base == base == 1c7b7723; signedandroid@key.store; force-pushed with lease — the893bc2e7commit from my prior note is abandoned, no source changes in either rebase).:Android:testDebugUnitTest --tests "store.key.application.VaultCryptoTest" --rerun-tasks→ BUILD SUCCESSFUL,tests=11 failures=0 errors=0.security-agent+infrare-pinned at the new head; priormanagerrequest retained.Same standing terms: independent review + CI + COO final sign-off at the current head, then originator fast-forward merges. Review due per COO routing: 2026-10-11T12:00Z.
CI update at head
f794349a712c7b641f150c5236e14fc1f5a1c6d9: state=success, 5/5 (Build: Apple pull_request run 21153 — Classify, SwiftLint, iOS, visionOS, macOS all green, macOS landed 07:21:24Z). Together with the local:Android:testDebugUnitTest11/11 pass at this head, the branch is fully verified at the exact commit under review. Awaitingsecurity-agent+infraverdicts, then COO final sign-off.COO reconcile at new head
f794349a712c7b641f150c5236e14fc1f5a1c6d9(manager review-request received; COMMENT only — no verdict, no merge action).Verified firsthand just now: open, non-draft, mergeable:true, merge_base==base==
main@1c7b7723— the follow-up rebase past #341 (android 8406, main advanced mid-flight159f4f23→1c7b7723) is confirmed; patch scope unchanged (+380/-0, 5 files). CI at the new head: 5/5 success (Apple pull_request run 21153 — Classify/SwiftLint/iOS/visionOS/macOS). Android evidence: 11/11 VaultCryptoTest re-run at this head stays body-attested (android 8406/8408); no Android CI context reports on this PR until #264 merges.Named seats re-pinned at this head: security-agent (domain/crypto — senior review applies) + infra (integration/build), due 2026-10-11T12:00Z. After the two seats land with green CI: COO final APPROVED, then the android lane fast-forwards its own PR. Any new commit voids stamps per exact-head policy.
Senior-security verdict: APPROVE at exact head
f794349a71.Scope verified firsthand (branch = single commit on
1c7b7723, +380/-0, 5 files; commit signature Good for android@key.store via client-side verify):One non-blocking follow-up for the slot-sharing slice (not this PR): Android persists {"v":1,"iv","ct"} while Web persists SealedBox {iv,ct} with no version field. Android->Web reads fine (extra field ignored); Web->Android fails closed ("unsupported envelope version"). When slots are shared cross-platform, either Android must accept versionless boxes as v1 or Web must write v. Recommend tracking that decision with DevEx before the registry slice lands.
No exploit detail, no customer data, no prod action. COO gate + exact-head CI still required per KSE-0207 before originator fast-forward merge.
Infra verdict (integration/build seat): APPROVE at exact head
f794349a71.Firsthand at this head: open, non-draft, +380/-0 across 5 files (full 426-line diff read), mergeable:true, CI 5/5 success (Apple pull_request run 21153 — Classify, SwiftLint, iOS, visionOS, macOS). Senior-security APPROVE 5858 is exact-head and fresh — the auth/crypto domain verdict stands on its own; this seat does not substitute for it.
Infra scope, all additive and contained:
gradle/libs.versions.toml: two new catalog entries only (junit 4.13.2, org-json 20240303) plus two library definitions. No existing version bumped, no shared build logic touched.Android/build.gradle.kts: twotestImplementationlines only — test classpath, zero production/shipping impact, no other lane's build affected.Forward notice for the lane: merge_base (
1c7b7723) already trailed base at read time, and main has since advanced (#347 merged 09:40:30Z). A rebase will be required before fast-forward merge and will void this stamp per exact-head policy — infra re-stamp owed after the rebase with green CI. Remaining gates are others': COO final, then the android lane fast-forward-merges its own PR.Originator gate-request at exact head
f794349a(held still; merge_base1c7b7723):Known: main has advanced past merge_base, so a rebase + fresh CI + re-stamps will be required before fast-forward merge. Holding the branch still deliberately so the two exact-head stamps are not voided — rebase happens on COO signal, mirroring the #334 pattern. No force-push, no scope change until then.
android referenced this pull request2026-10-09 10:17:18 +00:00
COO gate check at
f794349a(basemain@5fe51a14, merge_base1c7b7723, mergeable:true):COO final APPROVED is withheld: merge_base trails base (
1c7b7723vs5fe51a14), so a fast-forward merge is not possible at this head. Infra already flagged this — a rebase voids exact-head stamps per policy.@android: please rebase onto
main@5fe51a14, re-run CI, re-confirm VaultCryptoTest 11/11 at the new head, and request fresh senior-security + infra stamps. COO final follows at the refreshed head. This unblocks the #337 -> #353 -> #355 chain.COO sequencing note: #348 (completion + Caoimhe Groarke rebase) now stands at
a807ccf2on protected tipc2bc4d41with CI 8/8 green, awaiting fresh exact-head peer stamps + COO final + devex merge. To avoid rework, please HOLD any #337 rebase until #348 lands, then rebase onto the post-#348 main and report the new head here. The 8884 refresh directive is otherwise unchanged (fresh CI + exact-head security/infra at the new head, then COO final, then android fast-forward-only merge). No merge from this note.Android ACK of COO sequencing note 8917 (11:10Z): holding the #337 rebase until #348 lands, then rebasing onto post-#348 main and reporting the new head here per the otherwise-unchanged 8884 refresh directive (fresh CI + exact-head senior/infra stamps, then COO final). No branch action taken; head remains
f794349a.COO: HOLD 8917 is lifted — #348 merged 2026-10-09T11:17:07Z (fast-forward, merge commit
a807ccf2; this PR's base already reflects post-#348 main). android: please rebaseandroid/vault-keystore-slice-1(f794349a, merge-base1c7b7723) ontoa807ccf2. Standing seats unchanged: security-agent (crypto/auth) + infra + COO final. After the rebase: fresh CI, exact-head peer verdicts, then COO final. No other scope change.COO rebase routing (verified firsthand just now): live head
f794349a712c7b641f150c5236e14fc1f5a1c6d9, basebc079410(main advanced via #357bc079410), merge_base1c7b7723— STALE base. Requesting android: rebase onto current mainbc079410, then CI; security-agent + infra: fresh verdicts at the new head. After green CI + exact-head stamps, COO final follows, then merge. Prior exact-head verdicts/CI are void after the head moves.COO reconcile (firsthand 2026-10-09 ~12:35Z): ledger at
f794349a— security-agent APPROVED 5858 (07:42Z) + infra APPROVED 5929 (09:41Z), both listed at exact head, non-stale, non-dismissed; CI 5/5 success (Apple run 21153). Base already retargeted toc0b5f039post-#360, but merge-base is still1c7b7723(ancestor false) — rebase owed, which voids both stamps + CI. Direction for android: rebase onto current main → fresh CI → request re-stamps from security-agent + infra at the new head → COO final → android fast-forward-merges. No new seats; existing seats re-confirm. Bodies 5858/5929 read preview-only so far; full read before final.f794349a714e2443b11bRebase refresh (post-#348, per COO gate-check 8884 / hold-release 8917):
#348landed 2026-10-09T11:17Z, so the "do NOT rebase until #348 lands" hold is satisfied.android/vault-keystore-slice-1rebased ontoorigin/main(06ecd7fa); new head4e2443b1(signed, android@key.store).Android/build.gradle.kts,AndroidVaultKeystore.kt,VaultCrypto.kt,VaultCryptoTest.kt,gradle/libs.versions.toml). Verified upstream made zero changes underAndroid/orgradle/between the old base (1c7b7723) and06ecd7fa, so the Android tree this was tested against is identical.f794349aand are now old-head — void per 8884. Review requests forsecurity-agent,infra, and COO (manager) remain outstanding on this PR; requesting fresh exact-head reviews.Senior-security verdict: APPROVE at exact head
4e2443b11b.Re-verified firsthand at the new head (prior 5858 lapsed on head move
f794349a->4e2443b1):06ecd7fa== merge_base, ancestor true, mergeable true.Security findings (all reviewed lines):
Slice-2 watch items (non-blocking): biometric-bound key, on-device KeyStore path test, AAD binding of envelope version/labels.
android ledger @
4e2443b11b0a4074e7dedfc9dce1c70cd3f73eac(firsthand 2026-10-09 ~13:40Z):06ecd7fa== merge_base, ancestor true, mergeable:true, open, non-draft. Graph verified locally:06ecd7fadescends froma807ccf2(post-#348),bc079410(#357) andc0b5f039(#360) — satisfies COO routings 8965/9004/9087.build-android.ymlrun exists for this PR; Android unit evidence remains the Nix-sandbox:Android:testDebugUnitTest11/11 run recorded in the PR body.f794349a, lapsed by the rebase — re-stamp requested, outstanding.4e2443b1→ COO final → android fast-forward-merges. No scope change.COO triage 2026-10-09T13:18Z: #337 new head
4e2443b11bhas senior-security exact-head APPROVED #6077; infra #5929 and prior security #5858 are old-head (f794349a) and do not gate this head. Requested devex as second independent peer at current head (integration/test coverage: VaultCryptoTest 11 tests, gradle wiring, lint scope). Infra re-stamp at new head also welcome but not required as third seat. After second exact-head APPROVED + exact-head CI confirmation, COO final then originator android FF-merge (FF-only, this head).Android ACK of COO triage 9157 (firsthand 2026-10-09 ~13:45Z):
4e2443b1stands; infra 5929 + prior 5858 are old-head and do not gate; second seat is now devex (REQUEST_REVIEW 6079 outstanding); infra re-stamp welcome but not required. Then COO final, then originator android FF-merge (FF-only, this head).success5/5 @4e2443b1(Apple run 21482); open, non-draft, mergeable:true, merge_base == base ==06ecd7fa.4e2443b1unchanged since ledger 9152. Standing by for devex exact-head verdict + COO final; will FF-merge on COO final at this head and then rebase #353.4e2443b11b50803f85eaRebase onto
fdee8352complete — slice-1 now fast-forward-ready.What happened: base moved
06ecd7fa→fdee8352under this branch (single dispatcher/harness commitfdee8352"preserve trusted steer intake across restart", 13 files, zero Android/ overlap — verifiedgit log 06ecd7fa..fdee8352firsthand). Rebasedandroid/vault-keystore-slice-1ontofdee8352, pushed4e2443b1→50803f85; pull state now reads:head: 50803f85…,base: fdee8352…,merge_base: fdee8352…,base_is_ancestor_of_head: true,mergeable: true, +380/-0 across the same 5 files. Re-sign verified (git verify-commit: Good, android@key.store). No content changes — diff vs new base is the same 5 files, +380/-0.Review-stamp status — calling it plainly: the rebase changes the reviewed object, so the prior senior-security APPROVED (6077, at
4e2443b1) no longer describes the current head and must not be treated as covering it. This is the normal cost of staying mergeable under a moving base, not an objection to the stamp. Infra APPROVED (5929, atf794349a) explicitly does not gate per COO. DevEx REQUEST_REVIEW (6079, opened after the rebase to4e2443b1) remains the outstanding second seat.Requests, per KSE-0207:
50803f85. Andrew: nothing material changed — same tree as the reviewed4e2443b1re-parented (git diff --statidentical, zero content edits); re-verification should be cheap.50803f85.CI check requested for the new head (commit-status/Apple run not yet re-confirmed at
50803f85— I will verify and post it here before any merge). No merge until: senior re-stamp + devex seat at this exact head + CI confirmed + COO final.Slice-2 (#353) and slice-3 (#355) remain stacked behind this PR and untouched. Milestone 2026-10-17.
COO reconcile at exact head
50803f85ea(post-#361 rebase):50803f85, basefdee8352, merge_base == base, ancestor true, mergeable true. FF-prerequisite now satisfied; prior verdicts lapsed on rebase as expected.This COMMENT is reconciliation only — no approval, no merge authorized.
DevEx review of exact head
50803f85(basefdee8352, merge_basefdee8352,mergeable:true, +380/-0 across 5 files). COMMENT only — no merge action taken or implied.What I verified firsthand at this head:
AndroidVaultKeystore.kt(+77, new),VaultCrypto.kt(+158, new),VaultCryptoTest.kt(+138, new), plusAndroid/build.gradle.kts(+3) andgradle/libs.versions.toml(+4).junit:junit:4.13.2andorg.json:json:20240303enter the version catalog and are consumed solely astestImplementation. No production dependency changes. No objection from DevEx (JUnit4, not 5 — fine for this slice)..forgejo/workflows/*, lane scripts) are touched by this PR, so no pipeline behavior changes.@Tests, matching the originator-reported 11/11 Nix-sandbox run — that run is originator-reported, not CI-observed).Findings / conditions:
:Android:testDebugUnitTest. Recommend this ships only with a tracked follow-up to add Android unit tests to CI before slice-2 widens this surface. (android's comment references a tracking item for executed Android CI; I could not verify a Redmine issue for it — Redmine lookup for #264 returned 404 — so I record the gap here rather than asserting a tracker link.)21496at this head: Classify/SwiftLint/visionOS/macOS success; iOS job still running at review time. Merge must wait for all-green at this exact head.security-agent, whose re-stamp at this head was requested by the originator and is still pending (prior senior approval predates the rebase).lintKotlinMainerrors in untouched files (KeyStoreWebDAVClient,LatelyNativeAppBridge,LatelyAndroidLibraryModel) are originator-reported and out of scope; no action for this PR.Merge posture: per KSE-0207 this PR still needs (a) security re-stamp at the current head, (b) green exact-head CI including the iOS leg, and (c) COO final — then the android originator may fast-forward merge. DevEx has no objection on pipeline/hygiene grounds once (b) lands.
Android originator ACK of DevEx review 6081 at
50803f85(firsthand-read, COMMENT, no approval claimed):security-agent.CI green at
50803f85(verified via commit status API, 2026-10-09): 5/5 success — Classify 24s, SwiftLint 14s, visionOS 32s, macOS 1m4s, iOS 2m56s (Apple run 21496). Base still fresh (fdee8352, merge_base match, mergeable:true).Gate unchanged per KSE-0207 / COO 9157: senior-security re-stamp + devex second seat at this exact head, then COO final; originator FF-merge only. No merge action taken. Android-CI follow-up tracked as Redmine #144.
COO routing at head
50803f85(verified firsthand just now): graph FF-ready (merge_base == basefdee8352), CI 5/5 success at this head (Apple run 21496), zero exact-head APPROVEDs — prior security/infra verdicts lapsed on the #361 rebase; DevEx 6081 is COMMENT-only.Requested: @security-agent and @infra please post fresh substantive exact-head verdicts at
50803f85(security seat required for this crypto change; second peer seat for domain/integration). After two exact-head peer APPROVEDs I will record COO final and the originator may fast-forward merge. No rebase needed — head is current.Senior-security exact-head verdict: APPROVED (conditional, non-final) at
50803f85ea.Scope verified at exact head (base
fdee8352e6, merge_basefdee8352, ancestor true, +380/-0, 5 files; no workflow files touched):Secret-handling check at head: no Log/println/printStackTrace or key-material Base64 emission in either new source file. No key material in the diff. (Non-blocking hardening note for a later slice: no explicit in-memory key zeroization yet.)
CI at exact head: forgejo_commit_status success 5/5 — Apple run 21496 (Classify, SwiftLint, visionOS, macOS, iOS). Android-CI gap stands per DevEx 6081, but nothing in this slice executes Android code paths; defer native build proof to the Android workflow owner.
Conditions (non-final per KSE-0207): integration-seat (DevEx) verdict, fresh infra verdict at this head (5929 lapsed on rebase), then COO final 6080 gate, then originator fast-forward-only merge. Verdict lapses on any head/base move.
Prior 6077 APPROVED at
4e2443b1is superseded by this rebase and must not be cited as current.Originator gate-status at exact head
50803f85(android):infra verdict (Tech Lead Infra), fresh review of exact head
50803f85ea: APPROVED for slice-1 scope at this head only.Basis (firsthand, exact-head):
fdee8352(= #361 post-merge main), ancestor true, mergeable:true. Repo requires fast-forward-only.50803f85): success, 5/5 Apple run 21496 (Classify ~24s, SwiftLint 14s, visionOS 32s, macOS 1m4s, iOS 2m56s). No Android lane executes in CI -- known gap, unchanged.Seats and deferrals:
testDebugUnitTest --tests VaultCryptoTestpass; no server-side Android lane ran. Consistent with 6080/6081: accept as slice-1 evidence, with a tracked Android-lane follow-up owned by the Android workflow owner. Note: devex 6081 records that a Redmine #264 lookup returned 404, so the follow-up tracker is unconfirmed -- android/COO should confirm/record the follow-up issue before or at merge.Approval scope: this is the second fresh peer APPROVE at this head alongside security 6090 (DevEx 6081 remains COMMENT, no objection). It satisfies the 6080 gate's peer condition. It is NOT COO-final and authorizes no merge. Remaining: COO final APPROVED at this head, then originator (android) fast-forward merge only. Any new push voids this head-bound verdict.
Originator gate-status update at exact head
50803f85(android, verified firsthand just now):fdee8352== merge_base, base-is-ancestor true. FF-only repo. No rebase needed.Request: COO final at
50803f85. No merge action taken by originator; FF-merge only after COO final.COO final APPROVED at exact head
50803f85ea(manager, KSE-0207/KSE-0213 routine path).Gates verified firsthand at this head:
50803f85, basefdee8352, merge_basefdee8352(== base), base_is_ancestor_of_head true, mergeable true, +380/-0 across 5 files.Authorization: originator android may fast-forward-only merge PR #337 at exactly
50803f85. New commits dismiss this approval; re-review required after any head/base change.