maxnowack / signaldb

SignalDB is a local JavaScript database with a MongoDB-like interface and TypeScript support, enabling optimistic UI with signal-based reactivity across multiple frameworks. It integrates easily with libraries like Angular, Solid.js, Preact, and Vue, simplifying data management with schema-less design, in-memory storage, and fast queries.
https://signaldb.js.org/
MIT License
274 stars 11 forks source link

Feature Request: Ability to unmount collections and cleanup all local data #944

Closed obedm503 closed 2 weeks ago

obedm503 commented 3 weeks ago

Right now neither the SyncManager, Collection, nor the PersistenceAdapter have a way of getting destroyed and cleaned up.

This means that when a user logs in to an application, uses it, and logs out, a malicious attacker could inspect the console and get access to all the cached information. PersistenceAdapters have no way to unregister and clean up after themselves and possibly confidential information remains on the system.

I am requesting a destroy method on the SyncManager and Collection classes to clean up after themselves and call the underlying persistence adapters' unregister method. Then, persistence adapters would implement their specific clean-up logic.

psicomante commented 2 weeks ago

I just saw this issue after creating #960. My issue is basically the same and I wrote some code to propose a solution. I didn't start yet using SyncManager, so i don't know if Max is going towards same direction or not, but I could do a PR in case my solution could be a nice idea to add.