ibillingsley / HumbleNewTabPage

New tab page extension for Chrome and Firefox
https://chrome.google.com/webstore/detail/mfgdmpfihlmdekaclngibpjhdebndhdj
MIT License
626 stars 104 forks source link

Chrome blocks HNT's attempts at opening a local file #115

Closed MMachado05 closed 9 months ago

MMachado05 commented 9 months ago

Chrome: Version 118.0.5993.70 (Official Build) (64-bit) [Linux Debian] Underlying OS: Kubuntu 22.04.3 Humble Newtab version: 1.26

Description: When clicking a bookmark that points to a local file on my drive, nothing occurs. Right-clicking and selecting either "Open link in new tab" or "Open link in new window" instead opens about:blank#blocked, whereas selecting "copy link" and then manually posting it into a new tab or window works fine. I'm not sure if this is due to a change in Chrome's security, but it wasn't happening before.

I love HNT and have been using it for a long time, but this is an essential part of my workflow with it, so I'd love some direction on the source of the issue to find a fix!

ibillingsley commented 9 months ago

Hmm, so this has always been blocked for normal links (context menu: open in new tab/window), but I had been using the chrome.tabs.create api to get around the limitation for file:/// and chrome:// urls. I can confirm this no longer works as of Chrome 118.

A related bug discussion is here: https://bugs.chromium.org/p/chromium/issues/detail?id=1418820 Unfortunately I don't think there's much I can do about it.

They do mention an enterprise extension policy file_url_navigation_allowed. Documentation: https://chromeenterprise.google/policies/?policy=ExtensionSettings and https://support.google.com/chrome/a/answer/7517525

I don't know if this works, but try creating a file at /etc/opt/chrome/policies/managed/settings.json with the following contents:

{
  "ExtensionSettings": {
    "mfgdmpfihlmdekaclngibpjhdebndhdj": {
      "file_url_navigation_allowed": true
    }
  }
}

edit: More info about the change here: https://developer.chrome.com/docs/extensions/whatsnew/#changes-to-file-scheme But in order to have the "Allow access to file URLs" option, I would basically need to make the extension request full read access to the entire filesystem.

edit2: I might be able to use the less broad "activeTab" permission to make the "Allow access to file URLs" toggle available.

MMachado05 commented 9 months ago

I'll have to try out these workarounds once I'm back at my laptop; I'll edit this comment with the results.

In the meantime, do you know if this functionality still exists (and is likely to continue to exist) on FireFox? I've been meaning to make the switch anyways and this would be a huge push to make that happen sooner rather than later.

EDIT: Gave that change a shot and restarted Chrome, unfortunately, it's still not working. Though if that "activeTab" change looks promising, I'd love to have it implemented!

ibillingsley commented 9 months ago

Firefox blocks it by default but there is a workaround: (from https://github.com/fastaddons/GroupSpeedDial/issues/36#issuecomment-788283828)

Add these 3 string values to your "about:config" page:

capability.policy.policynames = "localfilelinks"
capability.policy.localfilelinks.checkloaduri.enabled = "allAccess"
capability.policy.localfilelinks.sites = "moz-extension://UNIQUE_ID_OF_MY_ADDON_ON_YOUR_PC"

The last value should be the addon url - this is however different on every PC. You can find the addon url at about:debugging#/runtime/this-firefox about-debugging

The final config should look something like this: 111785499-f9bbdd80-88bc-11eb-967f-98a03d2277f4

ibillingsley commented 9 months ago

I updated the Chrome extension. With Humble New Tab Page 1.26.1, file urls are still blocked by default, but you can enable them more easily:

Go to Manage Extensions > Details (or chrome://extensions/?id=mfgdmpfihlmdekaclngibpjhdebndhdj) and enable "Allow access to file URLs"

allow-file

MMachado05 commented 9 months ago

We're back in business! Thank you so much for your community attentiveness and kind demeanor, this extension is great and it's good to know the developer is a decent guy! I'll be closing the issue, now.