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

Firefox extension ask for access your data for all websites #3

Closed
kaushalyap opened this issue Dec 29, 2020 · 11 comments
Closed

Firefox extension ask for access your data for all websites #3

kaushalyap opened this issue Dec 29, 2020 · 11 comments
Labels
discussion Discuss improvements/fixes

Comments

@kaushalyap
Copy link

I checked Firefox version of the extension it use Access your data for all websites permission which seems invasive.

Screenshot from 2020-12-29 21-18-47

But Chrome extension does not use a such permission

Screenshot from 2020-12-29 21-25-33

@roedesh
Copy link
Owner

roedesh commented Dec 30, 2020

Thanks for bringing this up. That does seem a bit too invasive.

It seems that Firefox shows that warning because my extension can inject a content script into any tab, whenever it wants.

There is a less intrusive permission called activeTab which does not show that warning, but requires the user to perform an action within that tab before my extension can inject its script. This is a problem because:

  • If the user forgets to perform such an action, my extension will not inject its script, and you won't receive a warning when your clipboard data was altered. It seems a bit counter intuitive to me to require the user to manually activate my extension in each tab.
  • Ideally my script runs before any other scripts, due to event bubbling

Perhaps I should add an explanation to the Firefox extension for the "Access your data for all websites" permission?

I'm open to suggestions.

@roedesh roedesh added the question Further information is requested label Dec 30, 2020
@kaushalyap
Copy link
Author

kaushalyap commented Dec 31, 2020

There is a less intrusive permission called activeTab which does not show that warning, but requires the user to perform an action within that tab before my extension can inject its script.

Why do you need to inject a script? Cannot you detect clipboard changes using clipboardRead, clipboardWrite permissions? Cannot you keep the history of clipboard related to a particular URL and detect clipboard changes from there.

@roedesh
Copy link
Owner

roedesh commented Dec 31, 2020

I need the content script to listen for the "copy" event and to get the current text selection.

@kaushalyap
Copy link
Author

kaushalyap commented Dec 31, 2020

Seems like Firefox clipboard API is not ready yet

The clipboard API enables an extension to copy items to the system clipboard. Currently the API only supports copying images, but it's intended to support copying text and HTML in the future.

@kaushalyap
Copy link
Author

I wonder how you do things in Chrome extension? Do you inject a script in there also?

@roedesh
Copy link
Owner

roedesh commented Dec 31, 2020

I wonder how you do things in Chrome extension? Do you inject a script in there also?

Yes, the extension works identical in all versions (Chrome, Firefox and Edge). I use the webextension-polyfill so its a single code base for all versions.

@kaushalyap
Copy link
Author

Okay you may add a note about Firefox permission to the README

roedesh pushed a commit that referenced this issue Feb 25, 2022
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.3.0 to 9.2.6.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md)
- [Commits](TypeStrong/ts-loader@v8.3.0...v9.2.6)

---
updated-dependencies:
- dependency-name: ts-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@Gitoffthelawn
Copy link
Contributor

Thanks for bringing this up. That does seem a bit too invasive.

It seems that Firefox shows that warning because my extension can inject a content script into any tab, whenever it wants.

There is a less intrusive permission called activeTab which does not show that warning, but requires the user to perform an action within that tab before my extension can inject its script....

I'm open to suggestions.

Would it be possible for the "copy to clipboard" user action to be the action that triggers the script to be injected? Or would it be too late?

Thanks.

@roedesh
Copy link
Owner

roedesh commented Mar 2, 2022

Would it be possible for the "copy to clipboard" user action to be the action that triggers the script to be injected? Or would it be too late?

Unfortunately the browser extension API's do not provide such a feature. It would also be too late indeed (although only for the first time you copy) as the event listener will be added after the copy has been done.

The only way to inject the content script on all pages automatically, is to set the the allowed origins to http and https addresses, which, in Firefox, translates to "Access your data for all websites".

If I disable the automatic injection, it will get rid of the warning in Firefox, but the user will have to do a certain action like clicking on the browser extension icon, before I can inject the content script. They will have to do this on every visit.

@roedesh roedesh reopened this Mar 2, 2022
@roedesh roedesh added discussion Discuss improvements/fixes and removed question Further information is requested labels Mar 2, 2022
@Gitoffthelawn
Copy link
Contributor

Thanks. That makes good sense.

I can't think of a really great solution, but I did come up with a possibility:

Firefox allows developers to set on-demand permissions for extensions. By default, the extension could not ask for the "Access your data for all websites" permission; instead it can provide a toolbar button or context menuitem to activate the extension on the current page. Separately, there can be an option to enable the extension for all pages. When the user enables that option, Firefox will prompt for the "Access you data for all websites" permission.

I don't love the above because it's a bit clunky (IMO), but it might be the only possibility (besides keeping things how they are).

@roedesh roedesh closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
@Gitoffthelawn
Copy link
Contributor

Has anything changed with the browser APIs that would allow an improvement per the OP's request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discuss improvements/fixes
Projects
None yet
Development

No branches or pull requests

3 participants