Bug 2034845 - Fix broken Access Connector on policy modification#809
Conversation
94a8a20 to
47d71ac
Compare
47d71ac to
8436997
Compare
|
@jporter-dev Now that we have #825 there is no reason not to rebase and add proper testing to ensure this does not regress |
| if (this.autoStart) { | ||
| const state = lazy.IPPProxyManager.state; | ||
| if (state === lazy.IPPProxyStates.ACTIVE) { | ||
| lazy.IPPProxyManager.switch(); | ||
| return; | ||
| } | ||
| if (state === lazy.IPPProxyStates.ERROR) { | ||
| await lazy.IPPProxyManager.reset(); | ||
| lazy.IPPProxyManager.start( | ||
| false, | ||
| PrivateBrowsingUtils.permanentPrivateBrowsing | ||
| ); | ||
| return; | ||
| } | ||
| if (state === lazy.IPPProxyStates.READY) { | ||
| lazy.IPPProxyManager.start( | ||
| false, | ||
| PrivateBrowsingUtils.permanentPrivateBrowsing | ||
| ); | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
Is this really the right place? Can we get feedback from people working on IPProtection for this?
There was a problem hiding this comment.
The autostart component's job is to "connect once when ready, asap".
So the way i'd read that code is, if autostart is enabled and something changes force-start no matter the current state.
If that always-on is the desired behavior, i'd probably move this into it's own little helper component. And swap out this helper component with the ipp-always-on in IPProtectionActivator.
Otherwise, given the bug-problem text, it sounds like just applying this while active should be sufficient. In that case ProxyManager should observe the serverlist and call switch() while in active.
There was a problem hiding this comment.
@strseb I've extracted the logic into a enterprise/IPPAlwaysOn.sys.mjs component that gets loaded in alongside the other helpers in a similar fashion to your IPPEnterpriseAuthProvider PR.
Let me know what you think! If it's the right approach then I can prepare this for upstream
lissyx
left a comment
There was a problem hiding this comment.
LGTM; please verify with a peer of IPProtection for the #handleListChanged implementation if that is the right place.
0592a3d to
e0c6d9c
Compare
919b96c to
03240f8
Compare
03240f8 to
2ebdb9c
Compare
strseb
left a comment
There was a problem hiding this comment.
Overall looks great! Just a few comments :)
| IPPAutoRestoreHelper, | ||
| ...IPPAutoStartHelpers, | ||
| ...(AppConstants.MOZ_ENTERPRISE ? lazy.IPPAlwaysOnHelpers : []), |
There was a problem hiding this comment.
Wondering whether you actually need the AutoRestore (on session restore starts vpn when it was on) or the IPPAutostartHelpers (for the start on boot pref) on enterprise. Otherwise less objects that can start/stop are preferable :)
... AppConstants.MOZ_ENTERPRISE ? lazy.IPPAlwaysOnHelpers : [IPPAutoRestoreHelper,...IPPAutoStartHelpers ]
There was a problem hiding this comment.
I may need to augment IPPAlwaysOn a bit more if removing those to handle the scenarios those handle, but it makes sense to rework it this way to avoid start/stop conflicts. I'll take a look at removing those and making sure IPPAlwaysOn has parity with them
| # ignores the pref-based server list set up in add_setup, so hasList stays false | ||
| # and proxy activation tests time out. | ||
| ["test_IPPAlwaysOn.js"] | ||
| run-if = ["enterprise"] |
There was a problem hiding this comment.
Thats a good point. Maybe we should have a head_enterpise.js for enterprise tests, so add_setup correctly creates the enviroment.
There was a problem hiding this comment.
Good call, I'll fix this up properly in the Phab PR.
| /** | ||
| * Registers the channel filter at startup to prevent data leaks before the | ||
| * proxy connection is fully established in always-on mode. Mirrors | ||
| * IPPEarlyStartupFilter from IPPAutoStart but uses the AlwaysOn policy check. | ||
| */ | ||
| class IPPAlwaysOnEarlyStartupFilter { | ||
| #alwaysOnAtStartup = false; | ||
|
|
||
| constructor() { | ||
| this.handleEvent = this.#handleEvent.bind(this); | ||
| } |
There was a problem hiding this comment.
Wondering, this is pretty much the same as IPPEarlyStartupFilter - only with a diffrent condition.
WDYT if we do
class IPPEarlyStartupFilter{
constructor( shouldActivate:Function<bool>){...}
init() {
if(!this.shouldActivate()) return;
...
}
}
export IPPAutostartFilter = new IPPEarlyStartupFilter(()=>IPPAutoStart.autoStart)
export IPPAlwaysOnEarlyStartupFilter = new IPPEarlyStartupFilter(()=>IPPAlwaysOn.alwaysOnEnabled))
…ive inclusion.match_patterns pref changes
…s for host and port updates
…rt become invalid and terminate VPN connection
2ebdb9c to
8d7cfe2
Compare
Description
This PR fixes an issue that occurs when the
AccessConnectorpolicy is modified in-place (not added/removed). This results in a broken access connector due to the#inclusionListnot being updated whenMatchPatternschanges, and the connection not being re-initialized with the new server when the serverlist changes (host/port in policy)Bugzilla: Bug-2034845
IPProtectionServerlist.sys.mjs: fixPrefServerListpref observer registration (was referencing instance instead of class), skip in maybeFetchList() when pref value is unchangedIPPChannelFilter.sys.mjs: register/unregister pref observer to refresh#inclusionSetwhen changedIPPProxyManager.sys.mjs: addreconnectmethod for reconnecting to the recommended server from the updated listIPPAutoStart.sys.mjs: add logic to#handleListChangedto reconnect on live changesDependencies / Related Issues
Testing
Steps to verify changes:
MatchPatternsExpected result:
AccessConnector shows active/inactive properly when modifying policy