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

Website breakage triage tools upgraded for efficient mitigation #1787

Merged
merged 8 commits into from
Nov 8, 2023

Conversation

tomasstrba
Copy link
Contributor

Task/Issue URL: https://app.asana.com/0/1199230911884351/1205611221645312/f
Tech Design URL: -
CC:

Description:
Enhancement of Debug menu to help with efficient website breakage mitigation. The menu now enables internal users to change remote configuration URL and remove injected scripts from the current tab.

Steps to test this PR:
Test removal of user scripts

  1. Visit a website
  2. Go to View -> Developer -> Open Developer Tools
  3. In Development Console, go to Sources and make sure you can see all user scripts in Extra Scripts of the left panel
  4. Go to Debug -> User Scripts -> Remove users scripts from selected tab
  5. Verify all user scripts (Extra Scripts) are removed

Test custom configuration URL

  1. Copy the configuration file and modify it. (~/Library/Containers/com.duckduckgo.macos.browser/Data/Library/Application\ Support/Configuration/macos-config.json)
  2. Host the file locally or remotely
  3. Set the URL of the configuration file using the Debug menu (Debug -> Remote Configuration -> Set custom configuration URL...)
  4. Make sure your custom configuration file has been used to set the configuration and you can see the new URL in the menu
  5. Reset the configuration to default (Debug -> Remote Configuration -> Reset configuration to default)
  6. Make sure the configuration is back to default and you can see the default URL in the Debug menu too

Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

func url(for configuration: Configuration) -> URL {
// URLs for privacyConfiguration and trackerDataSet shall match the ones in update_embedded.sh.
// Danger checks that the URLs match on every PR. If the code changes, the regex that Danger uses may need an update.
switch configuration {
case .bloomFilterBinary: return URL(string: "https://staticcdn.duckduckgo.com/https/https-mobile-v2-bloom.bin")!
case .bloomFilterSpec: return URL(string: "https://staticcdn.duckduckgo.com/https/https-mobile-v2-bloom-spec.json")!
case .bloomFilterExcludedDomains: return URL(string: "https://staticcdn.duckduckgo.com/https/https-mobile-v2-false-positives.json")!
case .privacyConfiguration: return URL(string: "https://staticcdn.duckduckgo.com/trackerblocking/config/v3/macos-config.json")!
case .privacyConfiguration: return customPrivacyConfigurationUrl ?? URL(string: "https://staticcdn.duckduckgo.com/trackerblocking/config/v3/macos-config.json")!
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Tom, Im not really fond of complicating that default AppConfigurationURLProvider, I think it should remain unchanged to our default values. Could you please take a look at how I tackled it in https://github.com/duckduckgo/iOS/compare/jacek/custom-config-url?expand=1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jaceklyp, in your PR, I see business logic in the View Controller. Also, the approach can lead to inconsistencies across the codebase in case CustomConfigurationURLProvider is initialized outside of the View Controller. If you think the storing logic should be outside of the AppConfigurationURLProvider, we can create a dedicated class for storing/providing of the custom URL and compose it with AppConfigurationURLProvider.swift.

What do you think?

Copy link
Collaborator

@mallexxx mallexxx left a comment

Choose a reason for hiding this comment

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

LGTM, works as expected 👍
Please see some minor comments inline

DuckDuckGo/Menus/MainMenu.swift Outdated Show resolved Hide resolved
DuckDuckGo/Menus/MainMenu.swift Outdated Show resolved Hide resolved
DuckDuckGo/Menus/MainMenuActions.swift Outdated Show resolved Hide resolved
@mallexxx mallexxx assigned tomasstrba and unassigned mallexxx Nov 3, 2023
@tomasstrba
Copy link
Contributor Author

@jaceklyp, I am going to move on with this so features can be used to mitigate breakage. We can consult the architecture when you are back. Thanks for chiming in :)

@tomasstrba tomasstrba merged commit b33448b into develop Nov 8, 2023
15 checks passed
@tomasstrba tomasstrba deleted the tom/website-breakage-new branch November 8, 2023 13:05
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.

3 participants