Closed Bug 2028916 Opened 7 months ago Closed 6 months ago

Investigate impact of Per-app keystore limits

Categories

(Firefox for Android :: Tooling, task)

All
Android
task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: mcarare, Assigned: mcarare)

References

Details

(Whiteboard: [fxdroid][group6] )

Attachments

(1 external file)

Beginning with Android 17, the system enforces a limit on the number of keys an app can own. The limit is 50,000 keys for non-system apps targeting Android 17 (API level 37).

https://developer.android.com/about/versions/17/behavior-changes-all#per-app-keystore-limits

This would not impact Fenix or Focus, since we are creating an unique key, not repeatedly for every session or app launch.
Still, being implemented in a shared component, we should add some logging for clients assuming one would ever hit this limit.

Key changes:

  • Updated generateKey to use a new helper method, generateKeyHandlingLimit, when running on Android API 37 or higher.
  • Implemented generateKeyHandlingLimit to catch KeyStoreException and provide specific logging for exhaustion scenarios.
  • Added logic to differentiate between ERROR_TOO_MANY_KEYS (triggered when targeting API 37+) and ERROR_INCORRECT_USAGE (triggered when not targeting API 37+ but exceeding the 200,000 key limit).
  • Included the current keystore size in error logs to provide better diagnostic context when key generation fails.
  • Introduced a KEY_LIMIT_NON_TARGETING_API37 constant to track the legacy key limit threshold.
Pushed by mcarare@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0c237acc72f7 https://hg.mozilla.org/integration/autoland/rev/37b69a3adec3 Refactor KeyStoreWrapper to handle and log Keystore key generation limits on Android Cinnamon Bun (API 37) and later. r=android-reviewers,jonalmeida
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: