kiwix / kiwix/overview

localStorage is shared between ZIM files

Open
#127 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
93
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I noticed this while working on openzim/mwoffliner#2483, which like MediaWiki itself uses the local storage to cache JavaScript modules for faster load times. This resulted in me loading JavaScript from different ZIM files of the same wiki and for some wikis even JS from a completely different wiki.

Image

For the PR I solved this issue by adding a timestamp to the vary version check when loading from localStorage, but ultimately this seems like an issue that should be solved by the reader as getting unexpected data in localStorage from different ZIMs might cause all kinds of issues. The reader should probably clear the localStorage whenever a new ZIM file is getting loaded.

I did not test if this issue exists for other types of storage as well (session, cookies) and I didn't test it for other readers either. I would appreciate it if you could create follow-up issues for any other readers affected by this issue as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the reader entry point that loads a new ZIM and its localStorage handling. Reproduce switching between ZIM files and inspect whether cached JavaScript from the previous file remains; done means storage is isolated or cleared on load without cross-ZIM data leakage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.