LifeMate — Personal, Family & Learning Companion

test/personal-notification-settings
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
md 129 lines 6.41 KB
Rendered Raw
1 # Personal Android update delivery guard — 2026-10-21
2
3 Offline data preservation takes priority. This change blocks incompatible APK
4 delivery; it does not provide a new installable update or prove preservation of
5 the child's installed data. App code9, the normal manifest checker, SQLite
6 schema1 and the online edition remain unchanged.
7
8 The public [baseline](personal-delivered-baseline.json) describes the **DELIVERED**
9 APK, not a verified reading of the actual device. Its identity comes from
10 [the existing handoff](PERSONAL_ANDROID.md) and
11 [recorded APK verification](../audits/evidence/personal-android-2026-10-20.json).
12 Actual-device signer/version and upgrade preservation remain **UNVERIFIED**.
13
14 ## Recorded comparison
15
16 | Evidence | Delivered baseline | PR39 personal CI |
17 | --- | --- | --- |
18 | Run | 39480587450 | 39541418453 |
19 | Source | `3e36dfd4f01d51e11816c0f97d1abda4266f1945` | `c5cb3084f665cb5b1546447e34e35963e5ea5597` |
20 | User APK artifact | 12292340083 | 12320495397 |
21 | Package | `ir.lifeguide.app.device` | `ir.lifeguide.app.device` |
22 | Version code | 9 | 9 |
23 | Certificate SHA256 | `4ef990d647fc98ac41113d5dbe7ee476ba80bf95b71b5f219b7863fa95263391` | `0e5c979c14a3f293a443aba20e7e54e228ae98d78ed9861a1f0fb3f00ec20889` |
24 | APK SHA256 | `c24ff6e75a987945399b0d96129f5d1a72525fa0270f31b0c481f9780f84db8e` | `7eea3d839179d02d140389da62ba7c2a14894c031f96b6a21a47e742164284b0` |
25
26 The latest CI succeeded. Its verification artifact12320565252 was obtained
27 through the official GitHub connector and inspected in memory. ZIP SHA256
28 `ba787baff54364a0f9d32b713c43447f3d53f84fd2a1a52be5d0e2a02a03d055`
29 matched GitHub's artifact digest. Its apksigner report and emulator receipt agree
30 on the newer certificate; the signature report says Android Debug, v2 verified,
31 v3 false. This is recorded CI evidence, **not a new local cryptographic
32 verification of the whole APK**. The baseline must never advance to a random
33 new debug certificate just to pass CI.
34
35 The certificate mismatch prevents a normal update over the delivered package.
36 Equal code9 also fails the new monotonic-delivery policy; Android can allow
37 same-version replacement in some circumstances. Availability of the original
38 matching private key is unknown. An unrelated new owner key cannot replace
39 this v2-signed installation. A certificate/APK does not supply its private key.
40 No signing key was read, generated, exported or configured.
41
42 ## Enforced delivery policy
43
44 `tool/check_standalone_update.py` accepts only an actual APK path. It reads the
45 binary manifest with the existing parser, computes the APK hash and invokes the
46 existing `certificate_digest` apksigner probe. A successful verifier process and
47 exactly one valid certificate digest are required. Neither a CLI-provided digest
48 nor a CLI-provided baseline can establish trust.
49
50 The reviewed baseline requires the same package and original signer plus a
51 strictly greater version code. Missing verifier, invalid/multiple signer output,
52 invalid manifest/baseline and incompatible candidates produce sanitized reason
53 codes and a nonzero exit. A necessary-compatibility PASS still reports
54 `dataPreservation: UNVERIFIED` and `delivery: BLOCKED`.
55
56 The workflow keeps existing build/tests and fresh-emulator SQLite/notification
57 acceptance before the new compatibility check. The check is immediately before
58 the user-APK upload so a signer mismatch does not prevent native regression
59 evidence. That upload additionally has an explicit source-level `if: ${{ false }}`
60 hold, with no environment, workflow-input or manual-dispatch bypass. Diagnostic
61 artifacts still upload with `always()`. Current code9 must fail compatibility;
62 the resulting failed delivery job is intentional and is not a green-APK claim.
63
64 Removing the upload hold requires reviewed implementation and independent
65 acceptance of exact delivered APK → candidate using the default product DB.
66 The current same-run fixture uses another DB and creates records after its
67 replacement, so it does not meet this requirement. Acceptance must preserve
68 profile/UUIDs/theme/companion, weekly dates/times, per-occurrence edits/ticks and
69 archives, reminder opt-in/off and native pending/delivered state. It must verify
70 no onboarding/data reset/duplicate notification, and a future reminder after
71 replacement with the process absent. Never uninstall or clear child data to
72 resolve a signature conflict. Physical-device acceptance remains separate.
73
74 ## Local verification actually run
75
76 Commands below run from `apps/lifemate` unless stated otherwise. All new tests
77 were written first. Before implementation:
78
79 ```text
80 python3 -B -m unittest discover -s tool -p 'check_standalone_update_test.py' -v
81 Ran 12 tests in 0.002s
82 FAILED (failures=12)
83 AssertionError: unexpectedly None : The fail-closed personal update guard is missing
84 ```
85
86 After implementation:
87
88 ```text
89 python3 -B -m unittest discover -s tool -p '*standalone*test.py' -v
90 Ran 35 tests in 0.026s
91 OK
92
93 python3 -B -m unittest discover -s tool -p '*test.py' -v
94 Ran 60 tests in 0.030s
95 OK
96 ```
97
98 The new policy tests cover wrong signer/package, equal/lower/invalid version,
99 missing/malformed/multiple/failed verifier output and a necessary-compatible
100 candidate that still cannot claim data preservation. External-process outputs
101 and parser results are mocked only to test rejection boundaries; those tests
102 are **not cryptographic or Android acceptance evidence**.
103
104 The pure policy replay below uses the independently obtained CI report values,
105 not an APK verifier result from this workspace:
106
107 ```sh
108 python3 -B - <<'PY'
109 import json
110 import sys
111 sys.path.insert(0, 'tool')
112 from check_standalone_update import load_baseline, validate_compatibility
113 reported_ci_evidence = {
114 'package': 'ir.lifeguide.app.device',
115 'versionCode': 9,
116 'certificateSha256': '0e5c979c14a3f293a443aba20e7e54e228ae98d78ed9861a1f0fb3f00ec20889',
117 'apkSha256': '7eea3d839179d02d140389da62ba7c2a14894c031f96b6a21a47e742164284b0',
118 }
119 print(json.dumps(validate_compatibility(reported_ci_evidence, load_baseline()), sort_keys=True))
120 PY
121 ```
122
123 ```json
124 {"dataPreservation": "UNVERIFIED", "delivery": "BLOCKED", "deliveryReasonCode": "default_database_upgrade_acceptance_missing", "installedDeviceVerification": "UNVERIFIED", "reasonCodes": ["certificate_mismatch", "version_code_not_incremented"], "result": "BLOCKED"}
125 ```
126
127 No new local Android build, apksigner verification or device installation was
128 performed for this guard. No merge, deploy, live configuration or real data was
129 changed. Existing code9 builds and random debug signing are not repair claims.