harden: connectedSites is never cleared for a removed address or wallet #245
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The background keeps an in-memory
connectedSitesmap keyedorigin + ":" + address. Nothing clears an entry when the address it names stops existing.removeWalletFromState()has never cleared it, and the address-level removal added by #240 does not either — so this is pre-existing and consistent, not a regression introduced there. Found by the independent review of that PR and filed rather than dropped.Both removal paths already drop the persisted
allowedSites/deniedSitesfor the address. The in-memory map is the one piece of connection state that survives, so for the life of the service worker a dApp can still be treated as connected to an address the user deleted.Implementation requirements
connectedSitesentries for the removed address on both the wallet-level and address-level removal paths, alongside the existingdropSitePermissionscall.connectedSitesactually gates before choosing the fix — if a stale entry only affects anaccountsChangedemission, the consequence is different from it gating an approval, and the PR body should say which it is.Definition of done
connectedSitesentries; removing a wallet clears them for every address it held.connectedSitesgates and the exposure window before the fix.TODO.mdupdated in the same commit.make checkpasses.