An extension permission is a capability granted by the browser, not a substitute for application authorization. Host access decides where an extension may read or modify pages; API permissions decide which browser services it may use. A narrow action can often start from a user gesture on the active tab, while an always-on feature may require an explicit host grant. Neither permission makes private page data safe to transmit elsewhere. The extension should describe what it reads, what it stores, and what changes when a grant is withdrawn. Its server still authenticates any submitted operation.
Extension Host Permissions and User Invocation
Working case
A municipal reviewer installs a helper that extracts the case number from the currently open permit page and opens a local checklist. The first version asks for access to every site at installation, although it only needs the permit portal after the reviewer presses its toolbar control. That scope would allow the extension to inspect unrelated email and banking pages. The revised design requests temporary access to the selected tab for the action and keeps a separately explained optional grant for reviewers who want automatic highlighting on the permit portal. It does not read other tabs, and it does not ship page content to a service by default.
Implementation boundary
function mayReadActiveCase(action) {
return action.userInvoked && action.hostGranted &&
action.tabOrigin === 'https://permits.internal.test';
}
console.log(mayReadActiveCase({ userInvoked: true, hostGranted: true, tabOrigin: 'https://permits.internal.test.evil' }));
// Output: falseList each browser API and host pattern beside the user task that needs it. Put the smallest required set in the base manifest; declare optional access only for features that can genuinely operate without it. Ask at the moment the task is clear, then handle denial as a normal state with an alternate manual case-ID entry. Check that the active tab is on an allowed origin before injecting a content script. A temporary grant can disappear when the tab changes or permission is revoked, so recheck before each privileged operation. Keep the server-side case access check even if the extension has host permission. Avoid wildcard host patterns for convenience. Version the permission inventory and review it before every release; a new dependency should not silently expand the extension’s data reach.
Cost and boundaries
A permissions check is small, but broad host access has a large trust and review cost. Always-on scripts run on more pages, consume memory and CPU, and may read data unrelated to the intended task. An on-demand script pays startup time only when invoked. Optional permission prompts add friction, so measure completed checklists and denials without collecting full visited URLs. Storage of grant preferences is O(H) for H host choices, but the privacy cost depends on which hosts are visible. Track injected page count, failure on unsupported pages, permission revocations, and task completion. A server request adds network latency and must be charged to the signed-in reviewer, not to the presence of an extension.
Failure trace
Open a bank page, press the helper control, and require refusal before injection. Deny optional portal access, then complete the checklist through manual case-ID entry. Grant access, open a case, revoke the grant, and repeat the action; no old content script should send new private data. Switch from a permitted portal origin to a lookalike host and require refusal. Sign out of the portal while the browser permission remains; the server must deny a private checklist operation. Update the extension with a new host pattern and inspect the permission warning and review record. Run on a low-memory browser with many tabs and compare idle CPU to the action-only version.
Verification
- Unrelated and lookalike sites do not receive an injection.
- Denied permission has a usable manual route.
- Server access is checked independently of host permission.
Practice drill
Build a case helper for permit case 47. Declare one narrow portal host as optional and use a user-invoked active-tab path for one-time extraction. Model three states: no grant, temporary action grant, and persistent portal grant. Test a valid portal, an impostor hostname, and an unrelated page. Revoke each grant while the tab remains open. Record whether any case text leaves the device and how a reviewer finishes the checklist when a grant is denied.
Decision note
Browser permission bounds where the helper may act; the task and server permission still bound what it may do.
Common Mistakes
- Requesting every host for a one-site feature.
- Treating a browser grant as a server session.
- Keeping an injected page active after permission revocation.
Related lessons
Browser Extension Trust and Lifecycle; Content Script Isolation and DOM Mutation; Extension Background Events and Durable State; Extension Message Contracts and Page Data Boundary; Browser Capabilities and Permission Lifecycle; Authorization and Tenant Boundaries.
Connected practice
Build Project: permit checklist browser helper and review Web Development: extension boundary decisions quiz.
