Snowflake will turn off on update or browser restart even if consented
Description
While debugging the chrome.runtime.onInstalled
listener, I noticed some unexpected behaviour. It could definitely have contributed to the sharp decline of proxies mentioned in tpo/anti-censorship/team#142.
When a user installs or updates their snowflake proxy extension, they will be prompted to consent to the privacy policy. If they consent, the Snowflake proxy will start enabled, but the enabled state is not stored. This means that if the proxy is restarted for any reason (e.g., it is updated or the browser is restarted), it will default to off, until the user toggles the enabled
slider in the extension popup.
Before the consent prompt fixes, we defaulted the enabled state to true:
const DEFAULT_ENABLED = true;
WebExtUI.prototype.enabled = DEFAULT_ENABLED;
This meant that, unless the user specifically turned off their proxy, it would always start running when reloaded.
The good news is that until the user specifically interacts with the slider to turn their proxy on or off, we don't store any state on it. So if we fix this bug to either store an enabled state if the user has consented, or assume that the proxy is enabled by default unless they haven't consented, proxies that have quietly stopped working will start again.
Steps to reproduce
- Build and install the unpacked extension from locally checked out source code
- Consent to the privacy policy
- Reload the installed extension
At this point, you should see that the extension is off but can be turned on (consent does not need to be given again).