LifeMate — Personal, Family & Learning Companion
fix: probe actual Java source support before prompting for local secrets
Quinn White committed
Oct 23, 2026 at 10:47 UTC
3c695749941a1926b6b73a34219821cd1b9d0687
5 files changed
+62
-2
.github/workflows/signing-preflight-qa.yml
+1
@@ -34,6 +34,7 @@ jobs:
34
- name: Exercise ephemeral fictional keys and fail-closed guards
35
run: python -m unittest discover -s scripts/tests -p 'test_signing*.py' -v
36
- name: Existing APK and Android host guards
37
+ if: runner.os == 'Linux'
38
run: python -m unittest discover -s apps/lifemate/tool -p '*_test.py' -v
39
- name: Tracked-file checks (not a full-history secret scan)
40
run: |
docs/operations/PERSONAL_SIGNING_PREFLIGHT.md
+6
-1
@@ -67,7 +67,12 @@ RSA/EC پشتیبانی میشوند؛ فقط داشتن certificate عموم
67
68
```powershell
69
python -m unittest discover -s scripts/tests -p "test_signing*.py" -v
70
-python -m unittest discover -s apps/lifemate/tool -p "*_test.py" -v
70
+```
71
+
72
+آزمونهای قدیمی host به shell/POSIX وابستهاند و فقط در Ubuntu اجرا میشوند:
73
+
74
+```sh
75
+python3 -m unittest discover -s apps/lifemate/tool -p '*_test.py' -v
76
```
77
78
آزمونها کلید موقت RSA/EC، ورود دوباره، نسخهٔ کپی **ساختگی**، رمز اشتباه،
docs/superpowers/plans/2026-10-23-local-signing-preflight.md
+15
-1
@@ -61,4 +61,18 @@ PR45; no merge/release/deploy. Stop after handover.
61
- Ruling: no new key-generation/transfer feature; read-only inspection is the
62
smallest prep dependency. A wrong scope choice costs deferred usable transfer,
63
not a change to installed data or approved policy.
64
-- Status: implementation/tests/CI UNVERIFIED until recorded below.
64
+- Task1: `79e1211`, 11 Java tests PASS on actual Temurin17; absent-helper RED and
65
+ deliberately removed-proof mutation RED observed (synthetic mismatched cert).
66
+- Task2: 24 Python tests PASS, including real synthetic CLI→JDK→keypair proof;
67
+ missing-module RED, source17 capability RED, pre-prompt guard RED recorded.
68
+- Ruling: check compiler module and empty-input source17 probe, not `javac` binary
69
+ presence — system21 has compiler but lacks ct.sym/source17; false capability
70
+ acceptance would delay inspection failure until after credentials. No key read
71
+ during the probe. Downloaded temporary official checksum-verified JDK17 only.
72
+- Ruling: inherited 82 host guards run on Ubuntu only because they invoke POSIX
73
+ shell/FIFO operations; new signing suites run on both CI systems. Wrong scope
74
+ costs missing Windows legacy-guard coverage, not weaker Android release gates.
75
+- Local full regression: 90 tests in32.576s OK (55 recovery +35 signing), inherited
76
+ host82 in0.197s OK; source compile and `git diff --check` exit0.
77
+- Task3: CI and independent review pending; no owner key/device/data inspection,
78
+ config/signing/build/APK/merge/deploy/DNS performed by this packet.
scripts/signing_preflight.py
+4
@@ -216,6 +216,10 @@ def main(argv=None):
216
if args.command == "inspect":
217
if not args.acknowledge_owner_local_inspection:
218
raise PreflightError("owner_local_acknowledgement_required")
219
+ if not sys.stdin.isatty():
220
+ raise PreflightError("interactive_terminal_required")
221
+ if not _java_available():
222
+ raise PreflightError("jdk17_required")
223
store, key = _passwords()
224
report = inspect_key(args.keystore, args.alias, store, key)
225
else:
scripts/tests/test_signing_preflight.py
+36
@@ -2,6 +2,7 @@
2
3
from contextlib import redirect_stdout
4
import getpass
5
+import hashlib
6
import io
7
import json
8
import os
@@ -87,6 +88,16 @@ class SigningPreflightTest(unittest.TestCase):
88
tool._passwords()
89
self.assertEqual(failure.exception.code, "interactive_terminal_required")
90
91
+ def test_invalid_jdk_refused_before_password_prompt_or_private_io(self):
92
+ with patch.object(tool.sys.stdin, "isatty", return_value=True), \
93
+ patch.object(tool, "_java_available", return_value=False), \
94
+ patch.object(tool, "_passwords", side_effect=AssertionError("password prompt")), \
95
+ patch.object(tool, "read_bounded", side_effect=AssertionError("private IO")):
96
+ code, report = self.call(["inspect", "--keystore", CANARY, "--alias", CANARY,
97
+ "--acknowledge-owner-local-inspection"])
98
+ self.assertEqual(code, 2)
99
+ self.assertEqual(report["reason"], "jdk17_required")
100
+
101
def test_hidden_password_and_same_key_password(self):
102
with patch.object(tool.sys.stdin, "isatty", return_value=True), \
103
patch.object(tool.getpass, "getpass", side_effect=[CANARY, ""]):
@@ -241,5 +252,30 @@ class SigningPreflightTest(unittest.TestCase):
252
tool._run_inspector(b"fictional", CANARY, CANARY, CANARY)
253
254
255
+class SyntheticCLIIntegrationTest(unittest.TestCase):
256
+ def test_real_local_helper_hidden_prompt_port_and_source_preservation(self):
257
+ from scripts.tests.signing_test_support import synthetic_keystores
258
+
259
+ with synthetic_keystores() as fixture:
260
+ before = hashlib.sha256(fixture.jks_path.read_bytes()).hexdigest()
261
+ output = io.StringIO()
262
+ with redirect_stdout(output), patch.object(tool.sys.stdin, "isatty", return_value=True), \
263
+ patch.object(tool.getpass, "getpass", side_effect=[fixture.store_password, fixture.key_password]):
264
+ code = tool.main(["inspect", "--keystore", str(fixture.jks_path), "--alias", fixture.alias,
265
+ "--acknowledge-owner-local-inspection"])
266
+ self.assertEqual(code, 0)
267
+ report = json.loads(output.getvalue())
268
+ self.assertEqual(report["certificateSha256"], fixture.fingerprints[fixture.jks_path])
269
+ self.assertEqual(report["delivery"], "BLOCKED")
270
+ self.assertEqual(report["status"], "INSPECTED")
271
+ self.assertEqual(hashlib.sha256(fixture.jks_path.read_bytes()).hexdigest(), before)
272
+ for private in (fixture.store_password, fixture.key_password, fixture.alias, str(fixture.jks_path)):
273
+ self.assertNotIn(private, output.getvalue())
274
+ # File remains reopenable; independent second keypair proof, no edits.
275
+ repeated = tool.inspect_key(fixture.jks_path, fixture.alias, fixture.store_password, fixture.key_password)
276
+ self.assertEqual(repeated["certificateSha256"], report["certificateSha256"])
277
+ self.assertEqual(repeated["privateKeyProof"], True)
278
+
279
+
280
if __name__ == "__main__":
281
unittest.main()