Repository navigation
fix(dashpay): report the Keystore lock-gate refusal for what it is - #1565
HashEngineering merged 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: dashpay/dash-wallet/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe SDK write-failure classifier now recognizes device-locked denials as pre-broadcast failures. Its unauthenticated-error explanation covers authentication and device-lock gates. Tests cover device-bound errors and legacy auth-gated paths. ChangesKeystore failure classification
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change improves Keystore failure reporting without changing broadcast behavior. No merge-blocking issue is established; SDK artifact validation and HONOR device QA remain normal validation tasks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change does not visibly weaken wallet-access controls. However, treating this error as safe to retry depends on an ordering guarantee that could not be independently verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
|
f4f086a to
291cecf
Compare
|
✅ Final review complete — no blockers (commit d9a3f71) · triage: low |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
The PR correctly adds handling for the SDK’s typed device-lock failure and preserves compatibility with older AAR error messages. However, the legacy fallback still reports a DEVICE_BOUND-specific “no auth window” diagnosis even though this classifier also handles genuinely authentication-gated legacy identity blobs, so the reported cause can remain misleading on those installations.
🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
normalbygpt-6-astra(effort low) — This is a substantial, cross-cutting DashPay restore, synchronization, transaction-walking, dependency, and error-classification change with tests, but the diff does not itself alter consensus rules, funds movement, cryptographic primitives, signing/key handling, peer-facing deserialization, or storage migrations. - Phase 1 reviewers: not run (skipped for throughput: 19 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort high); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:193-197: Do not claim that legacy Keystore failures have no auth window
This fallback arm is intentionally retained for both older AARs and legacy identity blobs still wrapped under the authentication-gated alias, as described in the preceding comment. For those paths, the message incorrectly says that the app’s DEVICE_BOUND policy has no authentication window, even though the rejected key may still require authentication. That can reproduce the misleading diagnosis this PR is intended to remove. Keep the unclassified `User not authenticated` message neutral; only the typed device-locked arm should make a device-lock-specific statement.
| t.message?.contains("User not authenticated") == true -> | ||
| // MO-972: this used to read "Keystore auth window expired", which | ||
| // ASSERTS a timeout nobody measured. Field log (2026-09-10, testnet | ||
| // 12000007, HONOR PTP-N49) — biometric at 11:49:16, this at 11:49:17. | ||
| // One second. The window had not expired; the Keystore simply refused | ||
| // to treat the auth as satisfying the identity key's gate, which on | ||
| // that OEM is the same defect family as the false-locked master alias | ||
| // (dashpay/platform#4643 fixes that one and explicitly does NOT cover | ||
| // the auth-gated identity alias; #4060's DEVICE_BOUND policy is the | ||
| // remedy). Report what Keystore said, not a cause we inferred. | ||
| SdkWriteResult.NotBroadcast( | ||
| "signing failure (pre-broadcast): Keystore refused the identity key as " + | ||
| "unauthenticated (auth window may have expired, or the device's " + | ||
| "auth-bound Keystore gate is defective) — ${t.message}", | ||
| "signing failure (pre-broadcast): Keystore refused the signing key as " + | ||
| "unauthenticated (the device's Keystore gate rejected it; on this app's " + | ||
| "DEVICE_BOUND policy there is no auth window to expire) — ${t.message}", |
There was a problem hiding this comment.
🟡 Suggestion: Do not claim that legacy Keystore failures have no auth window
This fallback arm is intentionally retained for both older AARs and legacy identity blobs still wrapped under the authentication-gated alias, as described in the preceding comment. For those paths, the message incorrectly says that the app’s DEVICE_BOUND policy has no authentication window, even though the rejected key may still require authentication. That can reproduce the misleading diagnosis this PR is intended to remove. Keep the unclassified User not authenticated message neutral; only the typed device-locked arm should make a device-lock-specific statement.
| t.message?.contains("User not authenticated") == true -> | |
| // MO-972: this used to read "Keystore auth window expired", which | |
| // ASSERTS a timeout nobody measured. Field log (2026-09-10, testnet | |
| // 12000007, HONOR PTP-N49) — biometric at 11:49:16, this at 11:49:17. | |
| // One second. The window had not expired; the Keystore simply refused | |
| // to treat the auth as satisfying the identity key's gate, which on | |
| // that OEM is the same defect family as the false-locked master alias | |
| // (dashpay/platform#4643 fixes that one and explicitly does NOT cover | |
| // the auth-gated identity alias; #4060's DEVICE_BOUND policy is the | |
| // remedy). Report what Keystore said, not a cause we inferred. | |
| SdkWriteResult.NotBroadcast( | |
| "signing failure (pre-broadcast): Keystore refused the identity key as " + | |
| "unauthenticated (auth window may have expired, or the device's " + | |
| "auth-bound Keystore gate is defective) — ${t.message}", | |
| "signing failure (pre-broadcast): Keystore refused the signing key as " + | |
| "unauthenticated (the device's Keystore gate rejected it; on this app's " + | |
| "DEVICE_BOUND policy there is no auth window to expire) — ${t.message}", | |
| "signing failure (pre-broadcast): Keystore refused the signing key as " + | |
| "unauthenticated (the device's Keystore authentication or lock gate rejected it) — ${t.message}", |
source: gpt-6-astra (phase2-reviewer: general)
There was a problem hiding this comment.
Fixed in 5c7ace1. You were right: this arm also handles identity-key blobs that are still under the legacy auth-gated alias, and for those the auth window is real. So "no auth window" was the same kind of unproven claim this PR removes, just pointing the other way. The message now says only "the device's Keystore authentication or lock gate rejected it". The shared comment above no longer says the app never uses setUserAuthenticationRequired, and classify_userNotAuthenticated_doesNotClaimTheWindowExpired now checks that the message contains neither "expired" nor "no auth window". Only the typed as device-locked arm makes a lock-specific statement. SdkDashPayWritesTest: 30/30.
There was a problem hiding this comment.
Resolved (re-reviewed at 5c7ace1c): Verified your change in 5c7ace1: the fallback now reports only authentication or lock-gate rejection, so it remains accurate for legacy auth-gated blobs without denying their authentication window. The regression assertions exclude both 'expired' and 'no auth window', and I reexecuted all 30 focused tests successfully.
f17003b to
b7e09a9
Compare
6f38a1a to
8285a1d
Compare
8285a1d to
1788a4c
Compare
94b7728 to
2e3e351
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
The actual base-to-head diff changes only the Keystore classifier, its documentation, and its tests; the reported synchronization, alarm, and logcat changes are already present in the supplied base. One nonblocking diagnostic-wording finding remains valid, while the pre-existing credential-export issue merits a separate security follow-up. Static verification and diff whitespace checks completed; no runtime tests were executed.
🟡 1 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
criticalbygpt-6-astra(effort low) — The supplied diff includes substantial new cryptography and key handling in KeyExchangeCrypto.kt and LoginKeyDerivation.kt implementing ECDH, HKDF, AES-GCM, and identity-derived login keys, meeting both the intricacy and critical-surface criteria despite the narrowly described Keystore fix. - Phase 1 reviewers: not run (skipped for throughput: 31 PRs queued, above the 10 limit)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:195-197: Do not claim that legacy Keystore failures have no auth window
(existing thread: https://github.com/dashpay/dash-wallet/pull/1565#discussion_r4010620079)
This generic branch covers both unclassified device-lock denials and failures involving legacy auth-gated identity-key blobs, as documented immediately above it. Matching "User not authenticated" does not establish which alias or gate failed, so the added statement that there is no authentication window can misdirect diagnosis of a genuine legacy authentication-window expiry. DEVICE_BOUND describes the policy selected for new keys, not necessarily the existing blob involved in this failure. Keep this branch gate-neutral and reserve the device-locked explanation for the separately classified denial.
Out-of-scope follow-up suggestions (6)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Existing support-report logcat export can disclose Coinbase credentials — TokenAuthenticator.getUpdatedToken() prints both the stored Coinbase access token and refresh token, and ContactSupportViewModel.collectLogcat() copies this process's logcat into an attachment without redaction. This provides a concrete credential-disclosure path when the token lines remain in the captured buffer and the user shares a report. Both files are byte-identical between the supplied base and head; this PR neither introduces nor expands that export path.
- Follow-up: Track a separate security fix to remove credential logging and prevent sensitive logcat content from entering support attachments, with regression coverage for token redaction.
- Track the bring-up job before awaiting its budget — Outside this PR's scope. The application-scoped async task and timeout-only assignment to detachedBringUp already exist in base 2e3e351. L1ShadowSyncService.kt has identical base/head blob 155a6312d97d2dc23c033a34b8f2279b10712814, and the classifier change does not introduce or expose this cancellation behavior.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
- Prevent the watchdog restart from undoing an external stop — Outside this PR's scope. The application-scoped watchdog stop/start sequence is already present in the supplied base. L1ShadowSyncService.kt is byte-identical between base and head, and none of the changed code alters engine shutdown or restart ownership.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
- Cancel the independent restart alarm when recovery is finished — Outside this PR's scope. The separate restart PendingIntent identity and repeating 15-minute alarm already exist in the supplied base. BlockchainServiceImpl.kt has identical base/head blob 97f7f5bf8076119e94f5d99e25c04532c54a0f98; this PR changes no alarm scheduling or cancellation.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
- Apply the logcat deadline while draining its output — Outside this PR's scope. The synchronous input.read() loop preceding the timed process wait already exists in the supplied base. ContactSupportViewModel.kt has identical base/head blob 0666078f754c81db87a655aab74a2bb6df9a418b, and this PR does not change support-report collection.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
- Start the L1 engine when a deferred first bind succeeds — Outside this PR's scope. The bind-success handler is unchanged: SdkBindRetryService.kt has identical base/head blob 04db9ab99486c68d180d475326dfbb25ad273595. The complete diff changes neither binding, service startup, nor replay idle handling, so this claim cannot block the current Keystore classification PR.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
bc798f6 to
c7fe51b
Compare
1788a4c to
c8a36c1
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Reviewed the complete three-file diff at c8a36c1, the classifier's callers, regression tests, and relevant definitions in the cached pinned SDK. The new device-locked classification has focused coverage, but the prior diagnostic-wording suggestion remains valid for legacy auth-gated keys; no blocking defect was confirmed. Validation was static; tests were not executed.
🟡 1 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: security-auditor); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 6: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
lowbygpt-6-astra(effort low) — The diff adds one contained pre-broadcast error-classification arm in classifyBroadcastFailure, updates diagnostic wording and comments, and adds focused tests without changing cryptography, key handling, or transaction construction. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— security-auditor (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 99% left, weekly 97% left; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort medium); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort medium); agentphase2-reviewer,gpt-6-astra— general (completed, effort medium); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:195-197: Do not claim that legacy Keystore failures have no auth window
(existing thread: https://github.com/dashpay/dash-wallet/pull/1565#discussion_r4010620079)
This fallback also handles legacy AUTH_GATED identity-key blobs, as the preceding comment and retained auth-window regression test explicitly acknowledge. Selecting DEVICE_BOUND for current storage does not establish which alias rejected an existing blob during migration, so invoking that policy's lack of an authentication window can incorrectly steer diagnosis away from a genuine legacy authentication-window expiry. The NotBroadcast classification remains appropriate; keep its explanation neutral about the rejecting gate, or explicitly distinguish current DEVICE_BOUND keys from legacy AUTH_GATED keys.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Correct the remaining "Keystore auth window expired" claims outside SdkDashPayWrites — These references are pre-existing comments and documentation outside the three-file change, not newly introduced diagnostics. Updating them is routine adjacent cleanup, and the claim does not establish an exceptional high-value follow-up that should expand this review.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
…O-972) Username creation on a HONOR PTP-N49 failed pre-broadcast and was reported as "Keystore auth window expired" one second after a successful biometric. There was no window to expire: this app has run KeySecurityPolicy.DEVICE_BOUND since 7e7d534, and that alias carries no authentication gate. What it does carry is setUnlockedDeviceRequired, and Android reports a denial of THAT gate with the identical UserNotAuthenticatedException. The comment in DashSdkServiceImpl asserting DEVICE_BOUND keys "never throw UserNotAuthenticatedException" is what made the real cause invisible, so it is corrected here rather than merely softened, along with its stale reference to platform #4060 (proposed the policy, closed unmerged; it landed as #4183). dashpay/platform#4643 now classifies that denial SDK-side into KeystoreDeviceLockedException, whose message names the alias and the KeyguardManager state at throw time — and therefore no longer contains "User not authenticated". Without a matching arm the failure would fall through to the generic handling and become LESS legible than before the SDK fix, so classifyBroadcastFailure gains one: it reports that Keystore considers the device locked and carries the alias through to the log. The existing "User not authenticated" arm stays for AAR lines older than #4643 and for the genuinely auth-gated paths that survive on an install predating the DEVICE_BOUND switch (blobs still under the legacy auth-gated alias, reached via the SDK's migration fallback). Its wording no longer implies a timeout on a policy that has none. Not done here: wiring a BiometricGate into WalletManagerStore. It cannot affect this bug — under DEVICE_BOUND the gate is unreachable — and its only beneficiaries are legacy auth-gated blobs, which the SDK can recover by silently re-deriving from the seed rather than prompting. It would also need new foreground-Activity plumbing the app does not have today. Tests: one new case pinning the typed device-locked shape end to end (NotBroadcast, names the gate, carries the alias, does not blame a window). Two existing test docs corrected — they blamed the auth gate. SdkDashPayWritesTest is 30/30 green. Verified against an AAR built from platform integration/v42int11 plus the #4643 stack (published locally as 0.1.0-v42int11-mo972-SNAPSHOT); the pin in build.gradle is deliberately left at 0.1.0-v42int5 for the team's own AAR bump. The module's remaining failures — SendCoinsTaskRunner{BIP70, SdkRouting,SelfSpendGrace} and GetUsernameVotingResultOperationTest — are pre-existing on the base branch: a leaked bitcoinj network context and date-dependent assertions. Re-running each class with these three files reverted reproduces the identical failure sets. Co-Authored-By: Claude Opus 5 <[email protected]>
…tral The "User not authenticated" arm of classifyBroadcastFailure claimed that on the DEVICE_BOUND policy "there is no auth window to expire". That arm also serves identity-key blobs still wrapped under the legacy auth-gated alias (installs predating the DEVICE_BOUND switch, reached through WalletStorage.retrievePrivateKey's migration fallback), where the auth window is real. A bare "User not authenticated" does not say which gate or alias refused, so the message now asserts neither an expiry nor its absence. Only the typed "as device-locked" arm names the lock gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Verified the complete PR diff at 5c7ace1. The device-locked matcher agrees with the pinned SDK's exception template, preserves its diagnostic, and retains the pre-broadcast fallback contract; the unclassified refusal is now gate-neutral, resolving the prior finding. All 30 focused SdkDashPayWritesTest tests passed on reexecution, and git diff --check passed; affected-OEM hardware validation remains outstanding.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: security-auditor); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff adds a contained pre-broadcast Keystore error-classification arm and updates diagnostic wording, comments, and focused tests without changing key handling, signing, or broadcast implementation. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— security-auditor (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 99% left, weekly 79% left; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
5c7ace1 to
d9a3f71
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Verified the complete diff at d9a3f71. The new device-lock classifier matches the pinned AAR's exception message, preserves the diagnostic and cause, and leaves the unclassified refusal gate-neutral; the prior finding is fixed. No actionable in-scope findings remain; diff whitespace validation passed, and regression assertions were inspected but not executed during this verification.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: security-auditor); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff adds one contained pre-broadcast error-classification arm, adjusts diagnostic wording and comments, and adds focused tests without changing signing, key handling, or broadcast implementation. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— security-auditor (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 98% left, weekly 79% left; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
Issue being fixed or feature implemented
MO-972. DashPay username creation fails outright on a HONOR PTP-N49 (MagicOS, Android 16). Signing dies pre-broadcast with
Protocol error: Generic Error: User not authenticated, one second after a successful biometric, reproducibly — and we reported it as "Keystore auth window expired".There is no window to expire. This app has run
KeySecurityPolicy.DEVICE_BOUNDsince7e7d53485, and that alias carries no authentication gate. Android puts two independent gates on a Keystore key and reports both failures with the identicalUserNotAuthenticatedException:setUserAuthenticationRequiredsetUnlockedDeviceRequiredThe second one is what fails, on OEM builds whose lock-state tracking is defective (Google confirmed the same on Fairphone 5/6, Issue Tracker 506989112; AOSP ties this to how the device was unlocked). Our own comment in
DashSdkServiceImplasserted that DEVICE_BOUND keys "never throw UserNotAuthenticatedException" — that claim is what made the real cause invisible for weeks, so it is corrected here rather than merely softened.Related PR's and Dependencies
KeystoreDeviceLockedExceptionand degrades an affected device onto a never-lock-bound alias. This PR depends on it: the typed message no longer contains "User not authenticated", so without the new classifier arm the failure would fall through to the generic handling and become less legible than before the SDK fix.dashSdkVersionbump here. Verified locally against an AAR built from platformintegration/v42int11+ the #4643 stack; the pin is left for the team's own AAR bump.What changed
SdkDashPayWrites.classifyBroadcastFailuregains an arm for the typed device-locked denial — reports that Keystore considers the device locked, and carries the alias into the log."User not authenticated"arm stays, for AAR lines older than #4643 and for the genuinely auth-gated paths that survive on an install predating the DEVICE_BOUND switch (blobs still under the legacy auth-gated alias, reached through the SDK's migration fallback). Its wording no longer implies a timeout on a policy that has none.DashSdkServiceImpl: the false "never throw UserNotAuthenticatedException" claim corrected, plus its stale reference to platform #4060 (that PR proposed the policy but was closed unmerged; it landed as #4183).Not done here: wiring a
BiometricGateintoWalletManagerStore. It cannot affect this bug — under DEVICE_BOUND the gate is unreachable — and its only beneficiaries are legacy auth-gated blobs, which the SDK can recover by silently re-deriving from the seed rather than prompting the user. It would also need new foreground-Activity plumbing the app does not have today. Happy to do it separately if wanted.How Has This Been Tested?
./gradlew :wallet:testProdDebugUnitTest --tests '*SdkDashPayWritesTest*'SdkDashPayWritesTest30/30 green, including a new case pinning the typed device-locked shape end to end: NotBroadcast, names the gate, carries the alias, and does not blame a window. Two existing test docs corrected — they blamed the auth gate.Run against a locally published AAR (
0.1.0-v42int11-mo972-SNAPSHOT) built from platformintegration/v42int11plus the #4643 stack, since the currently pinned0.1.0-v42int5does not containstartWalletSubsystemsand the base branch will not compile against it.Pre-existing failures elsewhere in the module, not from this change:
SendCoinsTaskRunner{BIP70,SdkRouting,SelfSpendGrace}andGetUsernameVotingResultOperationTest— a leaked bitcoinj network context, and date-dependent assertions that have aged out. Re-running each class with these three files reverted reproduces the identical failure sets.Checklist:
Summary by CodeRabbit