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

Proposal: Persistent Authentication #746

Open
erosman opened this issue Jan 12, 2025 · 2 comments
Open

Proposal: Persistent Authentication #746

erosman opened this issue Jan 12, 2025 · 2 comments
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time

Comments

@erosman
Copy link

erosman commented Jan 12, 2025

Proposal: Persistent Authentication

Background

Extensions use webRequest.onAuthRequired.addListener in the background script to provide authentication. In MV3, when the background script is unloaded, restarting it, retrieving the necessary data asynchronously from the storage, and processing the data, can take up some time, which results in the unwanted authentication popup from the browser.

Ideally, a persistent method to provide the authentication data is needed.

Some APIs such as Menus and Scripting already support persistent data.

Proposal

Create a method to provide persistent authentication data

Suggestions

1. Persistent onAuthRequired

Make the listener and its data persistent

2. declarativeNetRequest

Adapt DNR to provide persistent authorisation data

The rule-based DNR approach (versus an event-based one) might prove to be more efficient in the long run and eliminate the need for a webRequest.onAuthRequired.addListener.

See also:

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Jan 12, 2025
@Rob--W
Copy link
Member

Rob--W commented Jan 16, 2025

Preface: I am restricting the discussion to proxy, because regular network requests can already receive authentication details through DNR, via #264 (comment). If the discussion should apply more broadly, please clarify.

In today's meeting (#750) I mentioned Chrome's proxy API as an example of a declarative proxy API. Upon double-checking, I noticed that it does not support authentication, however. It could be added, and was requested in #264 before.

It sounds like a declarative proxy setting, or even a flag to remember the authentication for a certain amount of time (or until an error or explicit invalidation), potentially restricted to a specific origin and browsing profile, etc.) would fulfill the request to make the proxy details "persistent".

@erosman
Copy link
Author

erosman commented Jan 17, 2025

The issue is "How to provide proxy authentication when the background script is unloaded" (in MV3).

Preface: I am restricting the discussion to proxy, because regular network requests can already receive authentication details through DNR, via #264 (comment). If the discussion should apply more broadly, please clarify.

Indeed, the request is centred around Proxy authentication.

In today's meeting (#750) I mentioned Chrome's proxy API as an example of a declarative proxy API. Upon double-checking, I noticed that it does not support authentication, however. It could be added, and was requested in #264 before.

It would be useful and match the Firefox proxy.onRequest API method of providing authentication.

However, there is a major difference.
Firefox's proxy.onRequest is a background extension process (which can get unloaded in MV3) while Chrome’s proxy is a browser setting that should remain in force even when extension’s background is unloaded.

It sounds like a declarative proxy setting, or even a flag to remember the authentication for a certain amount of time (or until an error or explicit invalidation), potentially restricted to a specific origin and browsing profile, etc.)

Please note that the authentication is not limited to a single credential for a single requester. Multiple authentications for multiple proxies may need to be provided simultaneously. Furthermore, different credentials may be needed for the same requester which would make caching it by the browser impractical.

Currently, the only caching option is the rule-based caching. DNR was suggested as the rules will stay in force even when background script/service-worker is unloaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time
Projects
None yet
Development

No branches or pull requests

2 participants