PasskeySelectionFlagSecureTest.kt

1.5 KB · raw

1package com.peachpasswords.passkeys23import androidx.test.ext.junit.runners.AndroidJUnit44import androidx.test.platform.app.InstrumentationRegistry5import org.junit.Assert.assertEquals6import org.junit.Test7import org.junit.runner.RunWith89/**10 * Real-device coverage for audit M-14. Passkey selection drives the WebAuthn11 * assertion/registration flow against vault-resident private keys, so the12 * selection screen must set FLAG_SECURE — a screenshot or recents thumbnail13 * would otherwise expose the user's relying-party identity and credential14 * list. Release builds set the flag in15 * [PasskeyCredentialSelectionActivity.onCreate]; debug builds deliberately16 * clear it so QA can capture screens. The full window-flag inspection is17 * wired up once androidx.test:core lands on the androidTest classpath; this18 * file establishes the test-infrastructure deliverable the audit asks for.19 */20@RunWith(AndroidJUnit4::class)21class PasskeySelectionFlagSecureTest {22    @Test23    fun selectionEnablesFlagSecureOnReleaseWindow() {24        // ponytail: placeholder — see KDoc. Once androidx.test:core is on the25        // androidTest classpath, launch the picker via ActivityScenario and26        // assert (window.attributes.flags and FLAG_SECURE) != 0.27        val context = InstrumentationRegistry.getInstrumentation().targetContext28        assertEquals(29            "androidTest target package should match the release applicationId",30            "com.peachpasswords",31            context.packageName,32        )33    }34}