910d6893b2c9

resolve PB-26-009 through PB-26-012 (v2.17.37)

time
2026-09-12 03:23 UTC · 2 months ago
machine
koh2
agent
camel-stream/auto
session
assessment remediation
parent
8649c663d364
12 files VERSION+1 −1app/src/main/java/com/peachpasswords/passkeys/PasskeyCallerOrigin.kt+5 −2app/src/main/java/com/peachpasswords/passkeys/PasskeyRegistration.kt+1 −0app/src/main/java/com/peachpasswords/vault/VaultStore.kt+1 −2app/src/test/java/com/peachpasswords/passkeys/PasskeyAssertionTest.kt+14 −0app/src/test/java/com/peachpasswords/passkeys/PasskeyCallerOriginTest.kt+11 −0app/src/test/java/com/peachpasswords/passkeys/PasskeyCredentialPlannerTest.kt+10 −0app/src/test/java/com/peachpasswords/passkeys/PasskeyRegistrationTest.kt+5 −0releases/v2.17.37.md+14 −0scripts/check-release-manifest.py+4 −1scripts/kepr-build-apk.sh+5 −6scripts/test-release-manifest.sh+24 −0
VERSION+1 −1
@@ -1 +1 @@1-2.17.361+2.17.37

view file

app/src/main/java/com/peachpasswords/passkeys/PasskeyCallerOrigin.kt+5 −2
@@ -140,6 +140,7 @@140140      */141141     fun canServeCredential(storedCallerOrigin: String?, rpId: String, callerOrigin: String): Boolean =142142         when {143+            isPlaintextWebOrigin(callerOrigin) -> false143144             isWebOrigin(callerOrigin) ->144145                 rpIdMatchesOrigin(rpId, callerOrigin) &&145146                     (storedCallerOrigin == null || isWebOrigin(storedCallerOrigin))@@ -147,9 +148,11 @@147148             else -> false148149         }149150 151+    internal fun isPlaintextWebOrigin(origin: String): Boolean =152+        runCatching { URI(origin).scheme.equals("http", ignoreCase = true) }.getOrDefault(false)153+150154     fun isWebOrigin(origin: String): Boolean =151-        origin.startsWith("https://", ignoreCase = true) ||152-            origin.startsWith("http://", ignoreCase = true)155+        runCatching { URI(origin).scheme.equals("https", ignoreCase = true) }.getOrDefault(false)153156 154157     /**155158      * WebAuthn effective-domain check: rpId must equal the origin's host or

view file

app/src/main/java/com/peachpasswords/passkeys/PasskeyRegistration.kt+1 −0
@@ -47,6 +47,7 @@4747         // must sit inside the rpId's registrable domain; native-app origins4848         // (android:apk-key-hash:*) bind the credential to the calling app.4949         val callerOrigin = origin?.takeIf { it.isNotBlank() } ?: return null50+        if (PasskeyCallerOrigin.isPlaintextWebOrigin(callerOrigin)) return null5051         val rp = request["rp"]?.jsonObject ?: return null5152         val user = request["user"]?.jsonObject ?: return null5253         val rpId = rp["id"]?.jsonPrimitive?.contentOrNull ?: return null

view file

app/src/main/java/com/peachpasswords/vault/VaultStore.kt+1 −2
@@ -299,8 +299,7 @@299299             .remove("peach_pin_wrapped_iv_v2").remove("peach_pin_attempt_aliases_v2")300300             .remove("peach_pin_preferred_v2")301301             .commit()302-        val cacheFiles = codexCacheDir.listFiles() ?: emptyArray()303-        val cacheCleared = cacheFiles.all { it.delete() }302+        val cacheCleared = codexCacheDir.deleteRecursively()304303         return prefsCleared && cacheCleared305304     }306305 

view file

app/src/test/java/com/peachpasswords/passkeys/PasskeyAssertionTest.kt+14 −0
@@ -152,6 +152,20 @@152152         )153153     }154154 155+    @Test fun rejects_plaintext_http_origin() {156+        val keyPair = KeyPairGenerator.getInstance("EC").apply {157+            initialize(ECGenParameterSpec("secp256r1"))158+        }.generateKeyPair()159+        assertEquals(160+            null,161+            PasskeyAssertion.build(162+                passkeyEntry(keyPair.private as ECPrivateKey),163+                """{"challenge":"c","rpId":"example.com"}""",164+                "http://example.com",165+            ),166+        )167+    }168+155169     @Test fun bound_credential_refuses_every_other_caller() {156170         val keyPair = KeyPairGenerator.getInstance("EC").apply {157171             initialize(ECGenParameterSpec("secp256r1"))

view file

app/src/test/java/com/peachpasswords/passkeys/PasskeyCallerOriginTest.kt+11 −0
@@ -50,6 +50,17 @@5050         assertFalse(PasskeyCallerOrigin.canServeCredential(null, "example.com", "https://evil.com"))5151     }5252 53+    @Test fun plaintext_http_origins_never_match_or_serve_credentials() {54+        assertFalse(PasskeyCallerOrigin.rpIdMatchesOrigin("example.com", "http://example.com"))55+        assertFalse(PasskeyCallerOrigin.rpIdMatchesOrigin("example.com", "HTTP://login.example.com"))56+        assertFalse(PasskeyCallerOrigin.canServeCredential(null, "example.com", "http://example.com"))57+        assertFalse(58+            PasskeyCallerOrigin.canServeCredential(59+                "https://example.com", "example.com", "http://example.com",60+            ),61+        )62+    }63+5364     @Test fun native_callers_only_get_their_own_bound_credentials() {5465         val appA = "android:apk-key-hash:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"5566         val appB = "android:apk-key-hash:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"

view file

app/src/test/java/com/peachpasswords/passkeys/PasskeyCredentialPlannerTest.kt+10 −0
@@ -46,6 +46,16 @@4646         assertTrue(PasskeyCredentialPlanner.candidates(listOf(passkey("a")), """{"challenge":"c","rpId":"example.com"}""", " ").isEmpty())4747     }4848 49+    @Test fun plaintext_http_callers_get_no_credentials() {50+        assertTrue(51+            PasskeyCredentialPlanner.candidates(52+                listOf(passkey("a")),53+                """{"challenge":"c","rpId":"example.com"}""",54+                "http://example.com",55+            ).isEmpty(),56+        )57+    }58+4959     @Test fun legacy_credentials_hide_from_native_app_callers() {5060         // callerOrigin == null means pre-binding (or browser-synced). A native5161         // app's apk-key-hash origin can never prove a relationship to the

view file

app/src/test/java/com/peachpasswords/passkeys/PasskeyRegistrationTest.kt+5 −0
@@ -80,6 +80,11 @@8080         assertEquals(null, PasskeyRegistration.build(request, "https://evilexample.com"))8181     }8282 83+    @Test fun rejects_plaintext_http_origin() {84+        val request = """{"challenge":"c","rp":{"id":"example.com"},"user":{"id":"u","name":"june"},"pubKeyCredParams":[{"alg":-7}]}"""85+        assertEquals(null, PasskeyRegistration.build(request, "http://example.com"))86+    }87+8388     @Test fun stores_verified_caller_origin_on_the_credential() {8489         val web = PasskeyRegistration.build(8590             """{"challenge":"c","rp":{"id":"example.com"},"user":{"id":"u","name":"june"},"pubKeyCredParams":[{"alg":-7}]}""",

view file

releases/v2.17.37.md+14 −0
@@ -0,0 +1,14 @@1+# Peach Android v2.17.372+3+## Security fixes4+5+- Release signing secrets are loaded before Gradle configuration, so the canonical release script works from a clean shell without changing the established keystore or certificate lineage.6+- Release manifest inventory now freezes nested intent-filter data constraints and refuses scheme, host, port, path, or MIME drift.7+- Plaintext HTTP passkey web origins are rejected; HTTPS and native APK-key-hash origins retain their existing authorization rules.8+- Vault destruction recursively removes the complete Codex cache tree and reports deletion failure.9+10+## Verification11+12+- Manifest inventory, native provenance, and Kepr helper gates passed.13+- Focused passkey origin, registration, assertion, and planner tests passed.14+- Full Android unit tests and lint passed; release assembly remains blocked unless the existing protected signing environment is loaded.

view file

scripts/check-release-manifest.py+4 −1
@@ -40,10 +40,11 @@4040             lines.append(4141                 f"query|{child.tag}|{child.get(ANDROID_NS + 'name', '')}|{attrs(child)}"4242             )43+            for data in sorted(child.findall("data"), key=attrs):44+                lines.append(f"query-data|{child.tag}|{attrs(data)}")4345     application = root.find("application")4446     if application is None:4547         raise SystemExit("release manifest has no application")46-    # Every application-level attribute — allowBackup, dataExtractionRules,4748     # fullBackupContent, networkSecurityConfig, usesCleartextTraffic, debuggable,4849     # process, enabled — is exposure-bearing and was previously invisible here.4950     # The manifest element's own versionName/versionCode are deliberately NOT@@ -60,6 +61,8 @@6061             actions = sorted(action.get(ANDROID_NS + "name", "") for action in intent_filter.findall("action"))6162             categories = sorted(category.get(ANDROID_NS + "name", "") for category in intent_filter.findall("category"))6263             lines.append(f"intent-filter|{child.tag}|{name}|actions={','.join(actions)}|categories={','.join(categories)}")64+            for data in sorted(intent_filter.findall("data"), key=attrs):65+                lines.append(f"intent-filter-data|{child.tag}|{name}|{attrs(data)}")6366     return "\n".join(lines) + "\n"6467 6568 

view file

scripts/kepr-build-apk.sh+5 −6
@@ -46,6 +46,11 @@4646     echo "refusing to publish: VERSION is missing or not strict semantic version" >&24747     exit 14848 fi49+# PB-26-009: Gradle reads release signing passwords during configuration, so50+# source the existing protected environment before invoking any release task.51+if [ -f "$HOME/.secrets" ]; then52+    . "$HOME/.secrets"53+fi4954 5055 "$ROOT_DIR/gradlew" --no-configuration-cache :app:assembleRelease5156 @@ -109,12 +114,6 @@109114     exit 1110115 fi111116 112-# PB-26-001: passwords are no longer in local.properties. Source ~/.secrets113-# for the env vars the Gradle signing config also reads, then read the114-# non-secret keystore path and alias from local.properties as before.115-if [ -f "$HOME/.secrets" ]; then116-    . "$HOME/.secrets"117-fi118117 RELEASE_KEYSTORE=$(sed -n 's/^peachStoreFile=//p' "$ROOT_DIR/local.properties" | sed -n '1p')119118 RELEASE_ALIAS=$(sed -n 's/^peachKeyAlias=//p' "$ROOT_DIR/local.properties" | sed -n '1p')120119 RELEASE_STOREPASS="${PEACH_STORE_PASSWORD:-}"

view file

scripts/test-release-manifest.sh+24 −0
@@ -88,6 +88,30 @@8888     fail "a granted URI permission was accepted as no drift"8989 fi9090 91+# Nested intent-filter data attributes are security-relevant and must drift.92+cat > "$MERGED" <<'XML'93+<?xml version="1.0" encoding="utf-8"?>94+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.peachpasswords">95+    <application android:name=".App">96+        <activity android:name=".MainActivity" android:exported="true">97+            <intent-filter>98+                <action android:name="android.intent.action.VIEW"/>99+                <data android:host="example.com" android:scheme="https"/>100+            </intent-filter>101+        </activity>102+    </application>103+</manifest>104+XML105+python3 "$CHECK" write "$MERGED" "$INVENTORY"106+grep -q '^intent-filter-data|activity|.MainActivity|host=example.com;scheme=https$' "$INVENTORY" ||107+    fail "inventory is missing nested intent-filter data"108+python3 "$CHECK" check "$MERGED" "$INVENTORY"109+sed 's/android:host="example.com"/android:host="evil.example.com"/' "$MERGED" > "$MERGED.changed"110+mv "$MERGED.changed" "$MERGED"111+if python3 "$CHECK" check "$MERGED" "$INVENTORY" >/dev/null 2>&1; then112+    fail "nested intent data drift was accepted"113+fi114+91115 cat > "$MERGED" <<'XML'92116 <?xml version="1.0" encoding="utf-8"?>93117 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.peachpasswords">

view file