Add support for time limits for Web API permissions in brave-core
See original GitHub issueCurrently, when requesting a permission, Chromium allows users to say yes or no, w/o an intermediate option.
For example, i can give google maps access to my location forever (or deny), or i can give the zoom web client access to my camera and mic forever (or deny), but there is no option to say “you can use my camera until i close the page” or “you can use my location for 24 hours”.
Options
This issue is to create the ability to grant a page access to a permissioned API for the following options:
- Grant permission, forever (currently available)
- No permission, forever (currently available)
- Permission for this site session (i.e. until there are no more top-level documents for the eTLD+1, to align with ephemeral site storage)
- Permission for
arbitrary amount of time
For 4, we likely wouldn’t want to expose this option to users (I imagine we’d want so preset “one week” or similar options), but the implementation should allow for arbitrary lengths.
Current UI
Currently Brave uses the upstream Chromium options (and UI), which give the user only a permanent Yes or No option.

Other Browsers
Fiirefox
Firefox currently has a version of this for for some permissions. By default, "allow" and "deny" apply for the page, and "Remember this decision" makes the choice permanent.
Safari
Safari similarly by default grants permission for the page, with options to make the choice permeant.

Out-of-Scope and Other Considerations
- This issue does not cover the UI to expose these new capabilities to users. UI work is covered in issues https://github.com/brave/brave-browser/issues/14127 (Desktop) and https://github.com/brave/brave-browser/issues/14128 (Android)
- It would be ideal to extend these lifetime’d permissions to extension permissions, but that is separate, come later work
- I expect it may be difficult to surface the lifetime’d permissions in the chrome content settings UI. That would also be ideal, but is also saved for follow up work.
- This issue currently suggests adding “for site session” (in the ephemeral site storage sense). If this ends up being significantly more difficult than the “page session” options Firefox and Safari use, lets change this issue to be “page session” too
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (16 by maintainers)

Top Related StackOverflow Question
Verification passed on OnePlus 6T with Android 10 running 1.24.81 x64 build
Time Based checks
20 Sec timer - Allow (Camera + Microphone)
20 Sec timer - Block Forever (Camera + Microphone)
Block Foreveradds an entry under blocked list for the siteOrigin-based cases
Origin-based behaviour, multiple tabs (Location)
browserleaks.com/geotriggers permission promptUntil I close this pageand select allow sets the permission for the page and detects locationBlock Foreveradds the site to blocked listbrowserleaks.com/geotab resets the site permission from site settings24-hour / 1-week cases
23 hrs test
25 hrs test
6 Days 12hrs test
8 days Test
Allow/Block forever cases
Allow forever (Location)
https://permission.sitetriggers permission promptforeverBlock Forever (Notifications)
https://permission.sitetriggers permission promptBlock ForeverConsecutive-revocation cases
10 sec repeat permission
--permission-lifetime-test-seconds=10shows 10 sec option in permission prompthttps://permission.siteworkshttps://browserleaks.com/geotriggers the prompt and set it to 10 sec optionPrivate tab test
Permission on private tabs
Verification passed on Samsung Tab A with Android 10 running 1.24.81 x64 build
Time Based checks
20 Sec timer - Allow (Camera + Microphone)
20 Sec timer - Block Forever (Camera + Microphone)
Block Foreveradds an entry under blocked list for the site <img width=300 src=>Origin-based cases
Origin-based behaviour, multiple tabs (Location)
browserleaks.com/geotriggers permission promptUntil I close this pageand select allow sets the permission for the page and detects locationBlock Foreveradds the site to blocked listbrowserleaks.com/geotab resets the site permission from site settings24-hour / 1-week cases
23 hrs test
25 hrs test
6 Days 12hrs test
8 days Test
Allow/Block forever cases
Allow forever (Location)
https://permission.sitetriggers permission promptforeverBlock Forever (Notifications)
https://permission.sitetriggers permission promptBlock ForeverConsecutive-revocation cases
10 sec repeat permission
--permission-lifetime-test-seconds=10shows 10 sec option in permission prompthttps://permission.siteworkshttps://browserleaks.com/geotriggers the prompt and set it to 10 sec optionPrivate tab test
Permission on private tabs
Verified
PASSEDusingNOTES (especially for the rest of the @brave/legacy_qa team):
https://permissions.infowill tell you whether a permission previously granted for that site has expired or not, though.brave://settings/content,brave://settings/content/camera,brave://settings/content/microphone,brave://settings/content/location,brave://settings/content/midi,brave://settings/content/notificationsand moreLifetime Permissionsviabrave://flags, since that’s common to nearly all the testcases herehttps://permission.siteto test, of course! if you use that site, be sure you are loading it overHTTPS, rather thanHTTP, as many of the tests’ buttons won’t work overHTTPTime-based cases
20-seconds, Allow permission (
microphone):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflaghttps://permission.siteMicrophone20 seconds, clickAllowContinue allowing permission.site to access your microphonebrave://settings/content/microphonehttps://permission.site:443is underAllowhttps://permission.site, confirm that clicking onMicrophoneagain re-prompts for permissionsbrave://settings/content/and confirm there’s nomicrophoneorpermission.sitelisted underRecent activity20-seconds, Allow permission (
camera + microphone):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflaghttps://permission.siteCamera + Microphone20 seconds, clickAllowCamera-AllowandMicrophone-AllowCameranorMicrophonewith any values presentOrigin-based cases
Origin-based behavior, multiple tabs (
location):brave://flagsand enable thePermission Lifetimeflaghulu.comuntil I close this pageAllowbrave://settings/content/locationshowsAllowforLocationAllowwhen prompted to install Widevinehulu.comin another tabbrave://settings/content/locationshowsAllowforLocationbrave://settings/content/locationnow showsAsk before accessing (recommended)and has nothing underBlockandAllowOrigin-based behavior, leave tab open, restart (
MIDI):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/until I close this pageAllowbrave://settings/contentshowspermission.sitewithAllowed MIDI devicesbrave://settings/content/midiDevicesshowsAsk when a site wants to use system exclusive messages to access MIDI MIDI devicesBlockorAllowhttps://permission.site/MIDIOrigin-based behavior, close tab, open new tab (
MIDI):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/MIDIuntil I close this pageAllowbrave://settings/contentshowspermission.sitewithAllowed MIDI devicespermission.sitetabbrave://settings/content/midiDevicesin a new tabBlockorAllowhttps://permission.site/in a new tabMIDI24-hour / 1-week cases
24-hours, negative test (25 hours) (
microphone):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/Microphonefor 24 hoursbrave://settings/contentshowsAllowforMicrophonebrave://settings/contentshowsAsk (default)forMicrophonehttps://permission.site/Microphone24-hours positive test (23 hours) (
microphone):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/Microphonefor 24 hoursbrave://settings/contentshowsAllowforMicrophonebrave://settings/contentshowsAllowforMicrophonehttps://permission.site/Microphone1-week, negative test (8 days) (
camera):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/Camerafor 1 weekbrave://settings/contentshowsAllowforCamerabrave://settings/content shows "Ask (default)forCamerahttps://permission.site/Camera1-week, positive test (
location):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/Locationfor 1 weekbrave://settings/contentshowsAllowforLocationbrave://settings/content showspermission.sitewithAllowed locationunderRecent activity`https://permission.site/LocationAllow/Block forever cases
Allow forever (
location):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/Locationforeverbrave://settings/contentshowsAllowforLocationbrave://settings/contentshowsAllowforLocationhttps://permission.site/Block forever (
notifications):brave://flagsand enable thePermission Lifetimeflaghttps://permission.site/NotificationsBlock foreverbrave://settings/contentshowsBlockforNotificationsbrave://settings/contentshowsBlockfor Notificationshttps://permission.site/Consecutive-revocation cases
Consecutive-revocation permissions (
location):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflaghttps://permission.siteLocation20 secondspermission.sitein the URL barLocationis set toAllowhttps://browserleaks.com/geopermissions.siteLocationwith any valuebrowserleaks.com/geoLocationwith any valueNegative/current-parity cases
Block (
Auto Download):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflag. restart Brave via command-linehttps://permission.siteAuto DownloadDownload multiple fileswithBlockandAllowbuttonsBlockin the dialogCancelin the file pickerDownloadicon in the URL barContinue blocking automatic downloads of multiple fileschosenbrave://settings/content/automaticDownloadsand confirmhttps://permission.site:443is under theBlocksectionbrave://settings/content/and confirmpermission.site - httpreadsBlocked automatic downloadspermission.siteclick again onAuto Download, and confirm nothing happens (no file picker or permissions dialog pop up)Allow (
Auto Download):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflag. restart Brave via command-linehttps://permission.siteAuto DownloadDownload multiple fileswithBlockandAllowbuttonsAllowin the dialogCancelorSavein the file pickerCancelorSaveagainDownloadicon in the URL barContinue allowing automatic downloads of multiple fileschosenbrave://settings/content/automaticDownloadsand confirmhttps://permission.site:443is under theAllowsectionbrave://settings/content/and confirmpermission.site - httpreadsAllowed automatic downloadspermission.siteclick again onAuto Download, and confirm you again get two consecutive file-picker dialogsAllow (
Widevine):--enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --permission-lifetime-test-seconds=20brave://flagsand enable thePermissions Lifetimeflag. restart Brave via command-linenetflix.com(or anyWidevine-using site)Notifications, when prompted (or just dismiss the dialog)Install and run Widevineprompt, with a[ ] Don't ask againcheckbox andBlockandAllowbuttonsAllowWidevineMigration (stored prefs)
Block (
Notifications):1.23.73, loadpermission.sitein a new profileNotificationsBlock1.24.xwith itbrave://flagsand flipPermission LifetimetoEnabled1.24.xpermission.siteNotificationsdoesn’t prompt or show notificationsbrave://settings/content/notificationsand confirm thathttps://permission.site:443is listed underBlockAllow (
Location):1.23.73, loadpermission.sitein a new profileAllow1.24.xwith itbrave://flagsand flipPermission LifetimetoEnabled1.24.xpermission.siteLocationdoesn’t prompt or show notificationsbrave://settings/content/locationand confirm thathttps://permission.site:443is listed underAllowContinue allowing this site to access your locationVerification passed on
Verified selected test case from above test plan
20-seconds, Allow permission (camera + microphone )
Verified permission prompt was triggered
Verified permissions were granted
Verified permissions were revoked after 20s
Origin-based behavior, multiple tabs (location)
Verified visiting browserleaks.com/geo triggers permission prompt
Verified the permission is granted
Verified That after closing 1 tab, the permission is still granted
Verified closing all the related tabs, clears the permission
Verified visiting browserleaks.com/geo again triggers permission prompt

Allow forever (location)
Verified visiting the page triggers permission prompt
Verified brave://settings/content for Location shows Allow
Verified after 2 months, permission is still granted

24-hours positive test (23 hours) (microphone)
Verified permission prompt was shown and was able to set 24h
Verified permission was allowed in brave://settings/content
Verified microphone permissions are Allowed for the site after 23h :
Verified no prompt was shown for Microphone after 23h

Consecutive-revocation permissions (location)
Verified visiting
Verified Location is allowed for 20 seconds
Verified visiting
Verified Location is allowed for 20 seconds
Verified after 20s the allow permission was revoked

permission.sitetriggers permission prompthttps://browserleaks.com/geotriggers permission promptUpgrade test from 1.23.x
Verified that in 1.23.x,
Verified that after upgrade the permissions remained the same

Locationwas set toBlock,NotificationstoAllowVerification passed on
Verified selected test case from above test plan
20-seconds, Allow permission_Normal Tab (camera + microphone )
Verified permission prompt was triggered
Verified permissions were granted
Verified permissions were revoked after 20s
20-seconds, Allow permission_PrivateTab (camera + microphone )
Verified permission prompt was triggered
Verified permissions were granted
Verified permissions were revoked after 20s
20-seconds, Allow permission_TorTab (camera + microphone )
Verified permission prompt was triggered
Verified permissions were granted
Verified permissions were revoked after 20s
Origin-based behavior, multiple tabs (location)
ExampleExampleExampleExampleExampleAllow forever (location)
ExampleExampleExampleExample24-hours positive test (23 hours) (microphone)
Verified permission prompt was shown and was able to set 24h

Verified permission was allowed in brave://settings/content

Verified microphone permissions are Allowed for the site after 23h :
Verified no prompt was shown for Microphone after 23h
Consecutive-revocation permissions (location)
Verified visiting
permission.sitetriggers permission prompt Verified Location is allowed for 20 seconds Verified visitinghttps://browserleaks.com/geotriggers permission prompt Verified Location is allowed for 20 seconds Verified after 20s the allow permission was revokedExampleExampleExampleExampleExampleExampleUpgrade test
Blockednotifications for permission.site and upgraded profile to 1.24.x1.23.x1.23.x1.24.x1.24.x