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

Feature request: Permissions API #2427

Closed
RendijsSmukulis opened this issue May 6, 2022 · 17 comments
Closed

Feature request: Permissions API #2427

RendijsSmukulis opened this issue May 6, 2022 · 17 comments
Labels
feature request feature request tracked We are tracking this work internally.

Comments

@RendijsSmukulis
Copy link

RendijsSmukulis commented May 6, 2022

There's currently no way to list or manage site permissions (e.g. geolocation, camera, microphone) apart from handling the PermissionsRequested event.

To create meaningful indicators of permissions for the users we'd need to:

  • Be able to list what permissions have been set for a given site (allow/deny/query)
  • Be able to programmatically change and reset them

There's a couple ways this can be enabled:

  • Quick-win: add a flag to WebView2 parameters that ensures the PermissionsRequested is fired every time a permission is requested by site. This would allow us to manage the permissions entirely in our code, and decide which ones are cached and when they're reset
  • Alternatively, add a proper API that allows listing permissions that have been granted, denied, set to query; and modify/erase them.

AB#39482825

@RendijsSmukulis RendijsSmukulis added the feature request feature request label May 6, 2022
@victorthoang victorthoang added the tracked We are tracking this work internally. label May 9, 2022
@victorthoang
Copy link

Thanks for the feedback RendijsSmukulis! We've added this as a scenario on our backlog!

@deeringc
Copy link

deeringc commented Jun 2, 2022

It's definitely not supported or even advisable to make any changes to these files, but it seems that the EBWebView\Default\Preferences json file stores the relevant information.

				"media_stream_camera": {
					"https://webcamtests.com:443,*": {
						"expiration": "0",
						"last_modified": "13298647470739859",
						"model": 0,
						"setting": 1
					}
				},
				"media_stream_mic": {},

@nishitha-burman
Copy link
Collaborator

Hi @RendijsSmukulis,

Can you describe the scenarios you are trying to light up by managing site permissions?

Thanks,
Nishitha

@RendijsSmukulis
Copy link
Author

Can you describe the scenarios you are trying to light up by managing site permissions?

  • We want to provide the ability for our users to list what sites they have set non-default permissions on (e.g. always allow)
  • We want to provide a way to modify or clear these permissions settings
  • We want to provide a way to indicate to the user what permissions the user has granted to the currently open page, and modify said permissions

@nishitha-burman
Copy link
Collaborator

Hi @RendijsSmukulis,

Thank you for your reply. Other follow up questions:

  1. Do you want to programmatically reset permissions for a given site or control all permissions for all sites? Or both?
  2. Does this list cover all the permissions you are interested in: https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2permissionkind?view=webview2-dotnet-1.0.1185.39?

Thank you

@q71114
Copy link

q71114 commented Sep 5, 2022

Hi @nishitha-burman

  1. We want the former (to control permissions for any given site). That being said once that's done by monitoring which sites have permission set we can achieve the latter as well.
  2. The most critical ones that we need to have access to are
    • Geolocation
    • Camera
    • Microphone
    • Screen Share <- this one is missing

@nishitha-burman
Copy link
Collaborator

Hi @q71114,

Do you want to be able to permissions for any site at any given time? E.g. be able to change permissions for a site even though you're not on that site?

Thanks,
Nishitha

@q71114
Copy link

q71114 commented Sep 13, 2022

Hi @nishitha-burman,

Yes, we want the option to change the permission for any site at any given time although the scope for this is limited.

E.g. be able to change permissions for a site even though you're not on that site?

We only want to do this when clearing allowed / rejected permission so next time the permission request is raised again for this site.

@nishitha-burman
Copy link
Collaborator

Hi @q71114,

Can you describe the end user scenario where you would do this?

Thank you,
Nishitha

@q71114
Copy link

q71114 commented Sep 28, 2022

Can you describe the end user scenario where you would do this?

Hi @nishitha-burman,

We offer option to clear all data for specific domains. When selected all user data will be cleared for those domains including any permissions previously allowed / rejected by the user.

@CoenraadS
Copy link

I also have a similar request. e.g. when using window.showDirectoryPicker, a prompt is shown asking the user if they want to give the browser permission to the folder.

This doesn't trigger the permissions request, would be great to have a way to programmatically accept it.

@nishitha-burman
Copy link
Collaborator

Hi @CoenraadS,

Is there an Edge (edge://settings/content) or web permission you are referring to that you would like to see triggered in this scenario?

@CoenraadS
Copy link

CoenraadS commented Jan 12, 2023

@nishitha-burman

Actually I found another issue already for similar to this bug I mentioned: #1039

Mainly just want the user to interact with the filesystem api, without having to click through the security popup boxes the browser shows. I'm not sure if chrome/edge exposes something for this, which is why I thought perhaps the permissions event would provide some solution.

I made a new issue here: #3121

@vickiez
Copy link
Contributor

vickiez commented Jan 21, 2023

Hi all, we added some experimental Permission Management APIs in the new prerelease package, 1.0.1619-prerelease.

You can read more here: https://github.com/MicrosoftEdge/WebView2Feedback/blob/main/specs/PermissionManagement.md. Please try these out and let us know if you run into any issues!

Steps for testing upcoming APIs/ features: https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/set-preview-channel.

@q71114
Copy link

q71114 commented Jan 26, 2023

Hi @vickiez, I can confirm that we can achieve what @RendijsSmukulis requested using the SavesInProfile property on PermissionRequestedEventArgs. Thanks for adding these APIs.

What is your timeline for having them in the stable release?

@vickiez
Copy link
Contributor

vickiez commented Jan 26, 2023

Thanks for confirming @q71114. The APIs will be stable in next month's prerelease package, and then they will become part of the 111 release package that is tentatively scheduled for 3/9/23

@vickiez
Copy link
Contributor

vickiez commented Mar 22, 2023

Hi all, the extended permission APIs are available in the latest release package, 1.0.1661.34. Closing this issue as completed but feel free to reactivate if needed. Thanks!

@vickiez vickiez closed this as completed Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

7 participants