el1t / uBlock-Safari

uBlock Origin - An efficient blocker for Chromium, Firefox, and Safari. Fast and lean.
GNU General Public License v3.0
2.74k stars 97 forks source link

Explanation of the state of uBlock Origin (and other blockers) for Safari #158

Open ghost opened 5 years ago

ghost commented 5 years ago

Very quick tl;dr: uBO will no longer work with Safari, use Firefox or a new "content blocker" app (see below for good replacements).

In the past few months, and especially in the past week, there have been a lot of posts and comments questioning the status of uBlock Origin for Safari. This should answer all questions on the status of uBO for safari.

uBlock Origin was ported for Safari in 2016, and was updated regulary (mostly changes from the main project) until 2018 when development completley stopped. Since then Apple has begun phasing out Safari extensions as extensions, and has instead been implenting a new extensions framework which is extremley limited in adblocking functions, only allowing "content blockers", which are just links bundled as an app which Safari enforces. From Safari 12 / macOS Mojave, old legacy Safari extensions were still allowed, but came with warnings saying that they will slow down your browsing (they infact won't, or at least not noticably). Safari also recently shut their Extension Gallery, instead redirecting it to the mac app store. Though it is still curently possible to install uBlock Origin by downloading the extension from Github (edit: must follow these instructions, it will not be starting from Safari 13 / macOS Catalina, when the legacy entension API will be fully deprecated.

It will not possible for uBlock Origin to work with the upcoming Safari 13 / macOS Catalina release If you are a current user of uBlock Origin for Safari here are the options to continue blocking ads:

  1. For the moment continue to use Safari 12 with uBlockOrigin. Anybody with uBO currently installed, it won't be removed until you update to Safari 13. If you don't have uBO installed, and wish to install on a pre-Catalina version of Safari, Download the latest (and final) release here and follow these instructions to install it. Unfortunately it's a bit complicated. This will stop working with macOS Catalina (coming "this fall"). Update: It appears that it is not possible to install uBO permanently, it will always uninstall on a restart of Safari. If you have it, it should stay.
  2. Switch to a different browser. If you choose this, I strongly recomend Firefox. Chrome will itself be ending support for uBlockOrigin soon. If battery life is an issue for you get Firefox Beta, Nightly or Developer which has massive battery life improvements to bring it on par with Safari / Chrome being tested (note: somewhat unstable). This will come to the stable version, hopefully in time for uBO-Safari's eol.
  3. Get a content blocker. Not nearly as powerful as uBO, but the best option if you want to stay with Safari. Do not get the app called "uBlock", this is unassociated with uBlockOrigin (read about the split here), and is simply a content blocker with a big negative feature of having acceptable ads built in (which is AdBlockPlus's pay-to-play ad and tracker unblocking program). It shares no code with uBO and has no advantages over any other content blocking app. Here are some recomendations of content blockers:

Top picks

Other Good Options

Do Not Reccomend

Update: Here is a statement from gorhill (uBO developer) on the state of Safari

Edit: a lot people are asking about uBlock Origin not working in the future on Chrome. If you'd like more information on this, here is an article from ghacks from january, and a statement from gorhill, developer of uBlock.**

There has been discussion of this on Reddit Github and Hacker News.

joz3l commented 5 years ago

Sadly after researching these recommendations, they all feel like consolation prizes compared to uBlock_0. I really hope someone with the same comprehension and standards recreates the project as a compliant(?) Safari extension even with reduced features due to new limitations.

alvarnell commented 5 years ago

Sorry, but I don’t see that it would be any better than those already covered here.

Sent from my iPad

-Al-

On Sep 24, 2019, at 19:51, joz3l notifications@github.com wrote:

I really hope someone with the same comprehension and standards recreates the project as a compliant(?) Safari extension even with reduced features due to new limitations.

ghost commented 5 years ago

Sadly after researching these recommendations, they all feel like consolation prizes compared to uBlock_0. I really hope someone with the same comprehension and standards recreates the project as a compliant(?) Safari extension even with reduced features due to new limitations.

I think that AdGuard for Safari does everything that uBO does that can be possibly implemented into Safari.

eddyg commented 5 years ago

Using Firefox when this scrolling issue is still around? Ick... Really going to miss uBO-Safari. 😢

roop commented 5 years ago

It will not possible for uBlock Origin to work with the upcoming Safari 13 / macOS Catalina release

@p4t44 Have you looked at the possibility of creating a Safari App Extension (which is not the same as a content-blocker extension)? You can inject JavaScript into any page, listen to beforeload and block those events if required. I've tried these in macOS Catalina and all of this works.

The downside is that there's no "global" area for scripts or resources -- that is now the Swift code, and there's no way to call Swift code and get back an answer synchronously (i.e. no canLoad equivalent exists). This implies that all JavaScript needs to get injected into every page and on every reload, which might affect performance and/or memory footprint.

ghost commented 5 years ago

It will not possible for uBlock Origin to work with the upcoming Safari 13 / macOS Catalina release

@p4t44 Have you looked at the possibility of creating a Safari App Extension (which is not the same as a content-blocker extension)? You can inject JavaScript into any page, listen to beforeload and block those events if required. I've tried these in macOS Catalina and all of this works.

The downside is that there's no "global" area for scripts or resources -- that is now the Swift code, and there's no way to call Swift code and get back an answer synchronously (i.e. no canLoad equivalent exists). This implies that all JavaScript needs to get injected into every page and on every reload, which might affect performance and/or memory footprint.

I'm not the develoeper and don't really understand how any of it works. I just spent far to long scraping together why uBO stopped working in Safari when I upgraded to the Catalina beta, and thought I would try to explain after a lot of posts on /r/ublockorigin had the same issue as me. The developer who made ublock-safari also hasnt updated it for over a year even before Safari 13. But if you or anyone else thinks they can make it work, please do.

roop commented 5 years ago

@p4t44 I understand your position now. Sorry, I'm afraid I don't think I can work on this as of now. I'd be happy to help anyone else who wants to take it up, though.

frodo2007 commented 5 years ago

... Though it is still curently possible to install uBlock Origin by downloading the extension from Github (edit: must follow these instructions, it will not be starting from Safari 13 / macOS Catalina, when the legacy entension API will be fully deprecated.

This doesn't work anymore as the “Show Extension Builder” command in the “Develop” menu no longer exists (Safari 13 on macOS 10.14.6).

ghost commented 5 years ago

... Though it is still curently possible to install uBlock Origin by downloading the extension from Github (edit: must follow these instructions, it will not be starting from Safari 13 / macOS Catalina, when the legacy entension API will be fully deprecated.

This doesn't work anymore as the “Show Extension Builder” command in the “Develop” menu no longer exists (Safari 13 on macOS 10.14.6).

That was written before Safari 13 was released, fixed now.

eddyg commented 5 years ago

FWIW, if you still haven't updated to Safari 13, you can run:

softwareupdate --ignore Safari13.0.1MojaveAuto

to hide the Safari 13 update...

liam-k commented 5 years ago

Thank you! I’d like to see https://better.fyi added to the list. Costs 2,99 and is open source.

ghost commented 5 years ago

Thank you! I’d like to see https://better.fyi added to the list. Costs 2,99 and is open source.

I disagree that better is a good choice in comparison to the other options. Though I have not personally tested it, it only seems to have one content blocker so its blocking power will be less than alternatives such as AdGuard (free) or Wipr (also $1.99). It seems like an unexceptional paid content blocker from what I have seen about it.

avsadyryn commented 5 years ago

@p4t44 thank you very much for the advice!!! 1Blocker the best.

alvarnell commented 4 years ago

I think the current developer and those who had hoped to carry on have made it clear that this isn’t a matter of money. Current Apple rules won’t allow anything like uBlock to perform as it used to.

grahamannett commented 4 years ago

@alvarnell yeah I deleted the post since I wanted to look into it more. I found https://github.com/dgraham/Ka-Block which is a good prototype of ideas but am trying to understand more so how ublock works so i can understand if there is a similar approach.
Im all ears for what apple rules make this not feasible compared to ublock origin (like specific workflows or functions that handle stuff I could see in ublock or where a feature like NSExtensionRequestHandling fails).

If theres somewhere its spelled out by an actual dev that would be helpful. From my completely uninformed view it seems like the issue is that all the handling done in js would be done in swift, what parts of the old code can even be reused? I have no idea

ghost commented 4 years ago

@alvarnell yeah I deleted the post since I wanted to look into it more. I found https://github.com/dgraham/Ka-Block which is a good prototype of ideas but am trying to understand more so how ublock works so i can understand if there is a similar approach. Im all ears for what apple rules make this not feasible compared to ublock origin (like specific workflows or functions that handle stuff I could see in ublock or where a feature like NSExtensionRequestHandling fails).

If theres somewhere its spelled out by an actual dev that would be helpful. From my completely uninformed view it seems like the issue is that all the handling done in js would be done in swift, what parts of the old code can even be reused? I have no idea

Take a look at AdGuard for Safari, https://github.com/AdguardTeam/AdGuardForSafari. It is open source and supports as much of the functionality of uBlock Origin as is reasonably feasible in Safari.

As I understand currently an app / extension can send Safari content blocking rules which Safari enforces. This is contary to how uBlock Origin works, where you give the rules to uBO and it enforces them. If you want to create a Safari app / extension which replicated the functionality of uBO in Safari as much as possible that would be great but I'd recommend not using the uBO name / "brand" for the project (as it would not share any of the code or inner workings with uBO, it should go by a different name to avoid confusion. uSafari?). You might also like to use AdGuard as a base.

vassudanagunta commented 4 years ago

@grahamannett I don't mean to be mean, but as a New Yorker I can't help but be direct. It seems like you didn't give much weight to all of the effort that went into the explanation at the top of this issue, effort by @p4t44 and people who contributed edits to that explanation via comments.

If you want confirmation from @el1t himself, then take a look at which issue he pinned to the top of the issues list. This pin, as far as I know, is his latest and final comment on uBlock for Safari. In addition, the explanation above contains a link to a statement by @gorhill himself.

If you want more technical details, follow the links, e.g. the Hacker News discussion.

alfonmga commented 4 years ago

Hey guys, did you check out the new macOS update? could it help us somehow?

Screen Shot 2020-03-26 at 12 59 25 PM

URL: https://developer.apple.com/documentation/macos_release_notes/macos_catalina_10_15_4_release_notes

vassudanagunta commented 4 years ago

@alfonmga All Catalyst does is allow UIKit apps (those built for iOS) to be easily ported to run on MacOS. This does not in any way loosen restrictions on Safari plugins/extensions.

Apple has promised its users to build an impenetrable wall around user's privacy. There simply is not a way to allow third party code to do content-filtering without giving that code access to a user's entire browsing history. We can't have our cake and eat it too.

Content Blocker is Apple's solution to this problem: Third parties supply Safari with filtering rules, not code. Unless uBlock Origin adopts that (it won't), uBlock Origin will never work in Safari.

ghost commented 4 years ago

@vassudanagunta

Apple has promised its users to build an impenetrable wall around user's privacy. There simply is not a way to allow third party code to do content-filtering without giving that code access to a user's entire browsing history. We can't have our cake and eat it too.

Except that just about every content blocker has another extension included which can see your entire browsing history for whitelisiting. They haven't built an impenetrable wall around users privacy, they have built an impenetrable wall around user customisation and choice.

Also you can have your cake and eat it too in any other browser by being careful and not installing malicious extensions.

vassudanagunta commented 4 years ago

@p4t44 I think your take is an oversimplification. The beauty of it is they don't have a monopoly; the people who prefer the kind of user customization you want can have it: Firefox. Or Linux.

But for people who don't want it at the expense of security, even super technical people like me, and people who like me have spent countless hours digging non-technical people out of malware holes, or get pissed off at all the con-artists taking advantage of people confused by complexity (most people, including us technical people), we are glad that we have the choice to choose a more locked down platform.

Just as you said, it's all about choice and Apple is the only vendor in this space offering that choice.

gingerbeardman commented 4 years ago

Another point regarding 1Blocker, it now requires 10.15 Catalina.

Thankfully I'm still using an old version that works on 10.14 Mojave.

Baccount commented 4 years ago

Ad-Guard works well on macOS 10.15, it’s open source and you can disable 2 out of its 8 Safari extensions to prevent it from having any access to your website data, it also allows custom filters. App Store version: https://apps.apple.com/us/app/adguard-for-safari/id1440147259?mt=12

GitHub source code: https://github.com/adguardteam/adguardforsafari#

superlex commented 4 years ago

@Baccount I agree, and AdGuard for Safari supports most of uBlock0 syntax (e.g. scriptlets) :)

KDederichs commented 4 years ago

Seems like they announced web extensions on the WWDC, could this eventually mean that add-ons like uBlock might be possible again with the next OS version?

freediverx commented 4 years ago

I was thinking the same thing when I watched the keynote. I’m a little skeptical, though, because the announcement was light on details, and it wasn’t entirely clear whether something like uBlock Origin can work in Big Sur, or whether there will be functional limitations restricting features like hiding HTML screen elements… Apple is likely to put up barriers on any functionality that could be used as a malware attack vector.

On Jun 22, 2020, at 5:00 PM, Kai Dederichs notifications@github.com wrote:

Seems like they announced web extensions on the WWDC, could this eventually mean that add-ons like uBlock might be possible again with the next OS version?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/el1t/uBlock-Safari/issues/158#issuecomment-647766720, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2XK6MX544U2NQID6GPO3RX7A5VANCNFSM4IUSZ4XA.

KDederichs commented 4 years ago

They do say New support for the WebExtensions API so I'm hopeful that they actually support the whole range of it, with the restriction of the user having to enable the add-on explicitly

freediverx commented 4 years ago

I heard that and made a mental note to look it up. Was that API developed by Mozilla, and was it used to create the uBlock Origin add-on for Firefox? Also, assuming their mention of this related specifically to macOS and not to iOS or iPadOS as well… (I need to rewatch the keynote.)

On Jun 22, 2020, at 7:03 PM, Kai Dederichs notifications@github.com wrote:

They do say New support for the WebExtensions API so I'm hopeful that they actually support the whole range of it, with the restriction of the user having to enable the add-on explicitly

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/el1t/uBlock-Safari/issues/158#issuecomment-647811554, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2XK4KMQQLFRRGRXWUB4DRX7PNDANCNFSM4IUSZ4XA.

ameshkov commented 4 years ago

More info here: https://developer.apple.com/documentation/safariservices/safari_web_extensions

Compatibility and limitations: https://developer.apple.com/documentation/safariservices/safari_web_extensions/assessing_your_safari_web_extension_s_browser_compatibility

The most important limitation for blockers is this part:

It basically means that we have to continue using their Safari Content Blocking API.

freediverx commented 4 years ago

Ugh, their Safari Content Blocking API is worthless, at least based on every content blocker I’ve tested. So much for that idea. Damnit, Apple.

On Jun 22, 2020, at 7:10 PM, Andrey Meshkov notifications@github.com wrote:

More info here: https://developer.apple.com/documentation/safariservices/safari_web_extensions https://developer.apple.com/documentation/safariservices/safari_web_extensions Compatibility and limitations: https://developer.apple.com/documentation/safariservices/safari_web_extensions/assessing_your_safari_web_extension_s_browser_compatibility https://developer.apple.com/documentation/safariservices/safari_web_extensions/assessing_your_safari_web_extension_s_browser_compatibility The most important limitation for blockers is this part:

webRequest BlockingResponse not supported. Blocking requests not supported. It basically means that we have to continue using their Safari Content Blocking API.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/el1t/uBlock-Safari/issues/158#issuecomment-647813543, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2XK7WXGNHRXBDBJ4AMSTRX7QGBANCNFSM4IUSZ4XA.

joshdick commented 4 years ago

Ugh, their Safari Content Blocking API is worthless, at least based on every content blocker I’ve tested. So much for that idea. Damnit, Apple.

Send feedback to Apple via the Feedback app once you’re able to run a beta! 🙂

aaronsky commented 4 years ago

I could be wrong, but those docs look the same as the ones before today. Meaning I'm not so sure they've updated their documentation site with the new APIs

gwarser commented 4 years ago

https://www.reddit.com/r/uBlockOrigin/comments/hdz0bo/will_ublock_origin_back_to_macos_big_sur/fvoc7wk/

Apparently not, this is what it says for the webRequest API:

BlockingResponse not supported.

Blocking requests not supported.

Edit: There are other unsupported API methods:

  • onCreatedNavigationTarget (to deal with unwanted popups);
  • minimal support for insertCSS: no user styles, can't inject on a per-frame basis;
  • No privacy API;
speckz commented 4 years ago

FYI, https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/

freediverx commented 4 years ago

Can someone with the requisite expertise look here and see if the APIs required for uBlock Origin features are supported?

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs

On Jun 23, 2020, at 4:56 PM, Barnabas Toth notifications@github.com wrote:

FYI, https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/ https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/ — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/el1t/uBlock-Safari/issues/158#issuecomment-648413267, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2XK4CT72R65B6SEZJG2DRYEJH5ANCNFSM4IUSZ4XA.

gwarser commented 4 years ago

image

amarendra commented 4 years ago

Send feedback to Apple via the Feedback app once you’re able to run a beta! 🙂

Apple doesn't make what users want, Apple makes what they want users to want. Besides the overwhelming majority of Apple user/fan base is always happy with what Apple makes or tries/claims to make.

vegai commented 4 years ago

Here's a fine option if you're comfortable with blocking via /etc/hosts: https://github.com/StevenBlack/hosts.git -- as a bonus, it can optionally block fakenews, porn and other such junk.

gorhill commented 4 years ago

@ameshkov Please correct the disinformation in this picture which purports to compare AdGuard for Safari to other blockers on Safari: https://cdn.adguard.com/public/Adguard/Blog/safari-compare.jpg I have no doubt you are well aware that "UBlock" on Safari is not uBO.

ameshkov commented 4 years ago

@gorhill uh, wrong logo? sorry for that, we'll fix it. May I ask where you found that picture?

gorhill commented 4 years ago

https://adguard.com/en/adguard-safari/overview.html, "What's the difference between AdGuard for Safari and other ad blockers? ".

elesto commented 4 years ago

So.. is ubo coming to new safari and big sur? I dont really understand all this technical speak

liamengland1 commented 4 years ago

So.. is ubo coming to new safari and big sur? I dont really understand all this technical speak

No. https://www.reddit.com/r/uBlockOrigin/comments/hdz0bo/will_ublock_origin_back_to_macos_big_sur/fvoc7wk/

Use uBo in firefox or chrome, or use adguard in safari.

ghost commented 4 years ago

FYI, it seems that Wipr no longer supports blocking YouTube ads: https://www.reddit.com/r/MacOS/comments/hs16jl/what_is_going_on_with_wipr/

chaithanya008 commented 4 years ago

Just FIY I would not recommend buying 1Blocker. I paid both for the initial version and the "1Blocker X" one on IOS but I had the constant feeling the filter lists weren't being updated and I wasn't sure of their origin (I'm assuming they use EasyList for the ads, but which one do they use for privacy & annoyances?).

AdGuard for Safari is free, open-source and is compatible with uBlock-style filter lists (it has code that does its best to convert them to Safari content blocking lists). You can choose to use EasyList, EasyPrivacy, Fanboy's lists or any of the regional lists so I would recommend it over 1Blocker.

Mac preferences> safari extensions - says permission to read sensitive data including passwords and logins! is that ok?

chaithanya008 commented 4 years ago

So.. is ubo coming to new safari and big sur? I dont really understand all this technical speak

No. https://www.reddit.com/r/uBlockOrigin/comments/hdz0bo/will_ublock_origin_back_to_macos_big_sur/fvoc7wk/

Use uBo in firefox or chrome, or use adguard in safari.

safari extension preferences say - permission to read sensitive information including passwords and logins. Do they store these information?

alvarnell commented 4 years ago

Mac preferences> safari extensions - says permission to read sensitive data including passwords and logins! is that ok?

Only if you want it to work, otherwise it won't.

permission to read sensitive information including passwords and logins. Do they store these information?

Only locally and only what is necessary for its use.

jorge-d commented 4 years ago

Hi, I decided to switch back to Safari as my main browser for battery reason and discovered that uBlock Origin is not compatible anymore. After reading most of the possible solutions I think I came up with a pretty acceptable outcome: using NextDNS.

Nextdns is a (free for basic usage) DNS resolver, when you create an account you can select blocklists, which does include for example Easylist:

Screenshot 2020-09-01 at 14 21 09

The only downside is that there is no menu action on webpage to say "whitelist this website", it has to be done on the configuration page of nextdns.

Cheers,

ps: I'm not affiliated with NextDNS in anyway, just a happy user

freediverx commented 4 years ago

NextDNS (and similar services) are a valid way to block unwanted ads and tracking. However, they lack the ability to manually select and block annoying screen elements on the fly. I’m currently using AdGuard as my replacement for uBlock Origin. It’s nowhere near as light or fast, but it restores that ability to hide unwanted annoyances on specific web pages as desired.

On Sep 1, 2020, at 9:24 AM, Dimitri Jorge notifications@github.com wrote:

Hi, I decided to switch back to Safari as my main browser for battery reason and discovered that uBlock Origin is not compatible anymore. After reading most of the possible solutions I think I came up with a pretty acceptable outcome: using NextDNS.

Nextdns https://nextdns.io/ is a (free for basic usage) DNS resolver, when you create an account you can select blocklists, which does include for example Easylist: https://user-images.githubusercontent.com/1178099/91856583-a9519b00-ec5e-11ea-8ba3-304cca095e33.png The only downside is that there is no menu action on webpage to say "whitelist this website", it has to be done on the configuration page of nextdns.

Cheers,

ps: I'm not affiliated with NextDNS in anyway, just a happy user

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/el1t/uBlock-Safari/issues/158#issuecomment-684850741, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2XK5TLPGWZXMFCRM7JCTSDTY2RANCNFSM4IUSZ4XA.

KDederichs commented 4 years ago

Also should be mentioned that with services like NextDNS you basically reroute all of your net activity through their service which is... let's say not ideal in a privacy kind of sense. (Even if they claim to do nothing with that data)