Skip to content

Fix startup crash caused by corrupted cookie store - #6944

Open
arpitJ-dev wants to merge 1 commit into
commons-app:mainfrom
arpitJ-dev:fix/corrupt-cookie-store
Open

Fix startup crash caused by corrupted cookie store#6944
arpitJ-dev wants to merge 1 commit into
commons-app:mainfrom
arpitJ-dev:fix/corrupt-cookie-store

Conversation

@arpitJ-dev

Copy link
Copy Markdown

Description (required)

Fixes #6915

CommonsCookieStorage.load() previously allowed malformed persisted cookie data to throw during application startup, leaving both the main process and ACRA process in a persistent crash loop.

This change treats an unreadable cookie store as an invalid saved session. It keeps the in-memory cookie collection empty, removes only the corrupted cookie_store preference, logs the recovery, and leaves unrelated preferences intact. Valid cookie stores and the existing plaintext-to-encrypted migration behavior are unchanged.

Unit tests cover malformed and truncated JSON, JSON null, blank values, incorrect top-level types, invalid domain values, valid empty and populated stores, invalid individual cookies, unrelated-preference preservation, and repeated loading after recovery.

Tests performed (required)

  • Ran the focused CommonsCookieStorageTest and adjacent JsonKvStoreTest suites on BetaDebug: 16 tests, 0 failures.
  • Tested BetaDebug on a Samsung SM-S938U running Android 16 (API 36).
  • Reproduced the original main-process and ACRA crash loop with a malformed persisted cookie store.
  • Installed the fixed build over the same corrupted data and confirmed successful recovery and subsequent cold launches.
  • Verified recovery for a bare string, truncated JSON, JSON null, a top-level array, an invalid domain value, and whitespace-only data.
  • Verified that a valid empty JSON object remains accepted and retained.

Screenshots (for UI changes only)

Not applicable; this change has no UI modifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: App becomes permanently unusable (crash loop) if the local cookie/login store is corrupted, with no in-app recovery

1 participant