What permissions should be declared when creating a browser extension manifest ? When in a browser extension's manifest file, in the section "permissions"
, defines what browser resources and features the extension needs access to? Add the permissions are necessary for the extension to perform certain tasks, such as accessing the active tab, storing data, or executing scripts on web pages.
Here is a list of all available permissions that can be declared in a browser extension manifest file:
activeTab
- Access the current tab by clicking the extension icon.
alarms
- Allows you to create, modify, and delete alarms.
background
- Allows scripts to run in the background.
bookmarks
- Access to browser bookmarks.
browsingData
- Allows you to clear browsing data.
clipboardRead
- Read access to clipboard contents.
clipboardWrite
- Allows you to save data to the clipboard.
contentSettings
- Manage content settings.
contextMenus
- Creating custom context menus.
cookies
- Access to website cookies.
debugger
- Allows you to debug web pages.
declarativeContent
- Allows you to declaratively modify the content of pages.
declarativeNetRequest
- Allows declarative filtering and modification of network requests.
downloads
- Manage file downloads.
enterprise.deviceAttributes
- Access to device attributes in an enterprise environment.
enterprise.hardwarePlatform
- Access to hardware platform information in an enterprise environment.
enterprise.networkingAttributes
- Access to network attributes in a corporate environment.
enterprise.platformKeys
- Access to platform keys in a corporate environment.
experimental
- Access to experimental APIs.
fileBrowserHandler
- Allows extensions to handle files in the file manager.
fileSystemProvider
- Allows extensions to provide filesystems.
fontSettings
- Manage font settings.
gcm
- Enables the use of Google Cloud Messaging.
geolocation
- Access to device location.
history
- Access to browsing history.
identity
- Enables user authentication.
idle
- Allows detection of user idle state.
management
- Managing other extensions.
nativeMessaging
- Enables communication with native applications.
notifications
- Allows you to display notifications.
pageCapture
- Allows you to capture the content of pages.
platformKeys
- Access to platform keys.
power
- Allows you to manage the device's power status.
printerProvider
- Allows extensions to provide printers.
privacy
- Manage your privacy settings.
proxy
- Allows you to manage proxy settings.
scripting
- Allows you to inject scripts into websites.
search
- Allows you to manage search engines.
sessions
- Access to browser sessions.
storage
- Allows data to be stored in the browser's local memory.
system.cpu
- Access to device processor information.
system.display
- Access information about device displays.
system.memory
- Access to device memory information.
system.storage
- Access to device storage information.
tabCapture
- Allows you to capture the contents of cards.
tabGroups
- Managing card groups.
tabs
- Access to browser tabs.
topSites
- Access to your most visited pages.
tts
- Enables the use of text-to-speech functionality.
ttsEngine
- Enables the creation of text-to-speech engines.
unlimitedStorage
- Allows unlimited data storage.
vpnProvider
- Allows extensions to provide VPN services.
wallpaper
- Allows you to manage wallpapers.
webNavigation
- Allows you to monitor and control browser navigation.
webRequest
- Allows you to monitor and modify network requests.
webRequestBlocking
- Allows you to block network requests.
Enter the permissions between brackets [] syntax to create the code
"permissions": ["Permission1", "Permission2", "Permission3", "Permission4"]
place the code anywhere in the manifest.json file
Example of a section "permissions"
in a file manifest.json
:
{
"manifest_version": 3,
"name": "Przykładowe Rozszerzenie",
"version": "1.0",
"permissions": [
"activeTab",
"storage",
"scripting",
"tabs",
"webNavigation",
"cookies"
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "icon.png",
"48": "icon.png",
"128": "icon.png"
}
}
}
What permissions to add?
The permissions you choose depend on the features you want to implement in your extension. For example:
- If you want the extension to be able to store data, add
"storage"
. - If you need access to your current tab, add
"activeTab"
. - If you want to inject scripts into your pages, add
"scripting"
.
Be sure to only add permissions that are necessary for your extension to function to minimize potential security risks and increase user trust .
Comments
Post a Comment