Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill switch #438

Merged
merged 10 commits into from
Aug 4, 2023
Merged

Kill switch #438

merged 10 commits into from
Aug 4, 2023

Conversation

mallexxx
Copy link
Collaborator

@mallexxx mallexxx commented Jul 28, 2023

Please review the release process for BrowserServicesKit here.

Required:

Task/Issue URL: https://app.asana.com/0/72649045549333/1204311881295998/f
iOS PR: duckduckgo/iOS#1891
macOS PR: duckduckgo/macos-browser#1408
What kind of version bump will this require?: Major

Optional:

Description:

  • refactoring and cleanup: constants moved out of the code, message encoding logics moved out from business logic, AppLauncher moved to Mac implementation, start/stop/cancel tunnel methods made open to be extendable, removed unused code

Steps to test this PR:

  1. see macOS PR

Comment on lines 120 to 121
ipv4Settings.includedRoutes = [.default()] // 0.0.0.0/0
ipv4Settings.excludedRoutes = excludedRoutes.ipv4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the configuration just for when the kill-switch is enabled? or it's now the configuration always

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always, dns server added to Exclusion list (as it was before) if the kill switch is off

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not that a change in behavior?
When the kill-switch is OFF we should comply with this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems smart enough to not route the local network requests through the tunnel, in fact the excludeLocalNetworks flag didn't work for me, but I'm yet to validate this next week

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclusions are now provided from the main app, something to handle in the follow up project

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the routing table shouldn't be affected in this PR as we agreed to the kill switch feature not affecting existing features.

Let's re-enable the routing table we had when the kill switch is off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we have an exclusion list planned and hardcoded items added in Debug menu, this is now set from the NetworkConnectionController

@mallexxx mallexxx changed the title kill switch [WIP] kill switch Jul 31, 2023
@mallexxx mallexxx assigned mallexxx and unassigned diegoreymendez Jul 31, 2023
Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @mallexxx !

Submitted a first round of reviews with some questions and comments. Let me know if there's anything!

Comment on lines 120 to 121
ipv4Settings.includedRoutes = [.default()] // 0.0.0.0/0
ipv4Settings.excludedRoutes = excludedRoutes.ipv4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the routing table shouldn't be affected in this PR as we agreed to the kill switch feature not affecting existing features.

Let's re-enable the routing table we had when the kill switch is off.

@mallexxx mallexxx changed the title [WIP] kill switch Kill switch Jul 31, 2023
@mallexxx mallexxx assigned diegoreymendez and unassigned mallexxx Jul 31, 2023
@@ -18,17 +18,199 @@

import Foundation

public enum ExtensionMessage: UInt8 {
case resetAllState = 0
public enum ExtensionMessage: RawRepresentable {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored the Message encoding/decoding in sake of encapsulation and adding new messages

ipv4Settings.includedRoutes = ipv4IncludedRoutes
ipv4Settings.excludedRoutes = Self.ipv4ExcludedRoutes
let ipv4Settings = NEIPv4Settings(addresses: addresses.ipv4.map { $0.destinationAddress }, subnetMasks: addresses.ipv4.map { $0.destinationSubnetMask })
ipv4Settings.includedRoutes = includedRoutes.ipv4
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are coming from NetworkConnectionController now

@diegoreymendez diegoreymendez self-requested a review August 2, 2023 16:02
@diegoreymendez diegoreymendez self-requested a review August 2, 2023 16:07
Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mallexxx - I approved this and then realized there's no iOS PR for it. Could you please create the iOS PR that integrates these changes?

Thanks.

@mallexxx mallexxx mentioned this pull request Aug 2, 2023
13 tasks
@graeme
Copy link
Contributor

graeme commented Aug 3, 2023

@diegoreymendez I’ve approved the iOS PR. Any issues are now fixed.

Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this optimistically so we can move forward. If there's anything at this point we'll need to tackle it as a follow up.

@mallexxx mallexxx merged commit f419ede into main Aug 4, 2023
3 checks passed
@mallexxx mallexxx deleted the alex/kill-switch branch August 4, 2023 05:07
mallexxx added a commit to duckduckgo/macos-browser that referenced this pull request Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants