Skip to content

[PM-40755] fix: App crash when fill assist toggle enabled - #2902

Merged
andrebispo5 merged 1 commit into
mainfrom
pm-40755/fix-fill-assist-hash-crash
Jul 22, 2026
Merged

[PM-40755] fix: App crash when fill assist toggle enabled#2902
andrebispo5 merged 1 commit into
mainfrom
pm-40755/fix-fill-assist-hash-crash

Conversation

@andrebispo5

@andrebispo5 andrebispo5 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-40755

📔 Objective

Fixes a Release-only crash in DataFingerprintService.fingerprint(for:), used by FillAssistRepository when the fill assist toggle is enabled.

The Swift compiler miscompiles calls through the any HashFunction.Type existential parameter (hashFunction.hash(data:)) under Release optimizations. This was previously identified and worked around for Data.generatedHashBase64Encoded(using:) via @_optimize(none) in PM-25026 (#1871), but the sibling function Data.generatedHash(using:) — used by DataFingerprintService — was never patched. This is why the crash only reproduces in TestFlight/Release builds and not when run unoptimized via Xcode.

Applies the same @_optimize(none) workaround, referencing the existing PM-25026 TODO to remove both once the underlying compiler issue is fixed.

📸 Screenshots

N/A — background crash fix, no UI changes.

Applies the same @_optimize(none) workaround used on
generatedHashBase64Encoded (PM-25026) to generatedHash. The Swift
compiler miscompiles calls through the `any HashFunction.Type`
existential under Release optimizations, crashing
DataFingerprintService.fingerprint(for:) — and therefore fill assist —
only in optimized builds (e.g. TestFlight), not when run unoptimized
via Xcode.
@andrebispo5
andrebispo5 requested review from a team and matt-livefront as code owners July 22, 2026 15:36
Copilot AI review requested due to automatic review settings July 22, 2026 15:36
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:bug Change Type - Bug labels Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed a one-line bugfix in BitwardenKit/Core/Platform/Extensions/Data.swift that adds @_optimize(none) to Data.generatedHash(using:) to prevent a Release-only crash caused by the Swift compiler miscompiling calls through the any HashFunction.Type existential under optimization. The change mirrors the existing, proven workaround on the sibling generatedHashBase64Encoded(using:) function directly below it and references the same PM-25026 TODO for eventual removal. Verified that generatedHash(using:) is invoked through the existential in DataFingerprintService and AccountAPIService, consistent with the reported crash path. No security, correctness, or breaking-change concerns identified.

Code Review Details

No findings. The fix is minimal, correctly scoped, consistent with the established PM-25026 pattern, and satisfies the todo_without_jira lint rule.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies an existing Swift compiler Release-optimization workaround to Data.generatedHash(using:) to prevent a Release/TestFlight-only crash when computing fingerprints (used by fill assist when enabled).

Changes:

  • Add @_optimize(none) to Data.generatedHash(using:) to avoid optimizer miscompilation in Release builds.
  • Align the optimization workaround and TODO note with the existing generatedHashBase64Encoded(using:) implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to 40
@_optimize(none) // TODO: PM-25026 Remove when optimization for this is fixed on release config.
func generatedHash(
using hashFunction: any HashFunction.Type,
) -> String {
@andrebispo5
andrebispo5 enabled auto-merge (squash) July 22, 2026 15:42
@andrebispo5
andrebispo5 merged commit 454f0ab into main Jul 22, 2026
22 checks passed
@andrebispo5
andrebispo5 deleted the pm-40755/fix-fill-assist-hash-crash branch July 22, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants