Skip to content

Fix startup crash caused by corrupted cookie store - #6944

Open
arpitJ-dev wants to merge 2 commits 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 2 commits 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.

@arpitJ-dev

Copy link
Copy Markdown
Author

Hi @RitikaPahwa4444, when you have time, could you please review this PR? The fix and regression tests are included, and I also validated the recovery behavior on a physical device across multiple corrupted cookie-store inputs. Please let me know if any changes or additional testing would be helpful.

@RitikaPahwa4444

Copy link
Copy Markdown
Collaborator

I'll start testing 🙂

@github-actions

Copy link
Copy Markdown

✅ Generated APK variants!

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

2 participants