DEV Community

LeoJulieta
LeoJulieta

Posted on

Chrome AI Extension Permissions: Update Before Jan 2025

Title: Chrome’s New AI Extension Permissions: What You Must Change by Jan 2025


Introduction

Google just announced a ground‑up rewrite of AI‑related permissions in Chrome, and the deadline is fast approaching. Starting with a developer preview in June 2024, the new model becomes mandatory for every Chrome user in January 2025. If your Manifest V3 (MV3) extension talks to a generative‑AI service, you’ll have to update the manifest, add a runtime consent flow, and pass a new compliance scan—otherwise Chrome will block your add‑on. This guide shows you exactly what to change, gives ready‑to‑copy code snippets, and provides a Node.js scanner and Playwright test suite to keep you compliant across Chromium‑based browsers.


Quick‑Start Checklist

✅ Action Where
1 Add aiDataIn, aiDataOut (and optionally aiLocalCompute) to manifest.json manifest.json
2 Implement the runtime consent UI using chrome.permissions.request Background/service worker
3 Run the Node.js scanner on your source tree npm run scan:ai
4 Execute the Playwright compliance test in CI npm test:ai
5 Publish the updated version before 31 Dec 2024 Chrome Web Store

New Permission Model

Chrome now distinguishes input (data you send to an AI) from output (data the AI returns). The manifest must declare each direction explicitly:

{
  "manifest_version": 3,
  "name": "My AI Writer",
  "version": "2.0.0",
  "permissions": [
    "storage"
  ],
  "optional_permissions": [
    "aiDataIn",
    "aiDataOut",
    "aiLocalCompute"
  ],
  "action": {
    "default_popup": "popup.html"
  }
}
Enter fullscreen mode Exit fullscreen mode
  • aiDataIn – required when the extension sends user‑generated text, images, or audio to an external model.
  • aiDataOut – required when the extension receives generated content that will be displayed or stored.
  • aiLocalCompute – required only if the model runs inside a Service Worker (e.g., on‑device Whisper).

Runtime Consent Flow

Chrome forces a prompt that lists the exact data categories. Use the chrome.permissions.request API to trigger it right before the first AI call:

async function requestAIPermissions() {
  const needed = { permissions: ['aiDataIn', 'aiDataOut'] };
  const granted = await chrome.permissions.request(needed);
  if (!granted) {
    alert('AI features disabled because permission was denied.');
    return false;
  }
  return true;
}

// Example usage before calling the API
document.getElementById('generate').addEventListener('click', async () => {
  if (await requestAIPermissions()) {
    callOpenAI(); // your existing function
  }
});
Enter fullscreen mode Exit fullscreen mode

The prompt automatically shows something like “Allow My AI Writer to read text you type in a form and write generated text back to the page.” No extra UI work is needed beyond invoking the request.


Frequently Asked Questions

# Question Answer
1 What permissions do I need for a typical “text‑to‑text” extension? Declare aiDataIn (user‑typed text) and aiDataOut (generated reply). If you also store the result locally, keep the existing storage permission.
2 Will my extension break after the deadline? Yes. Chrome 129+ will block any add‑on that lacks the new permissions, showing a warning on chrome://extensions. Updating the manifest and adding the consent flow prevents the block.
3 How do other browsers handle this? * Edge*: mirrors Chrome’s schema (same manifest keys). * Brave*: identical but adds a “privacy‑enhanced” toggle in the UI. * Firefox*: uses its own aiSandbox permission set, so you’ll need a separate manifest for Firefox. * Safari*: still relies on App Store review; no Chrome‑style permissions yet.
4 Can I test compliance locally? Yes. Run the bundled Playwright suite (npm run test:ai) which loads a fresh Chrome profile, installs your unpacked extension, and verifies that the consent prompt appears and that blocked APIs are correctly intercepted.
5 Is there an official migration guide? Google’s documentation lives at developer.chrome.com/ai/extensions and includes a step‑by‑step migration checklist, sample manifests, and a downloadable scanner.

Practical Migration Example

Assume you have a simple extension that sends the selected page text to OpenAI’s gpt‑4o model and inserts the reply into the page.

1. Update manifest.json

{
  "manifest_version": 3,
  "name": "Summarizer AI",
  "version": "1.3.0",
  "action": { "default_popup": "popup.html" },
  "background": { "service_worker": "background.js" },
  "optional_permissions": ["aiDataIn", "aiDataOut"]
}
Enter fullscreen mode Exit fullscreen mode

2. Add consent request in background.js

chrome.runtime.onMessage.addListener(async (msg, sender, sendResponse) => {
  if (msg.cmd === 'summarize') {
    const granted = await requestAIPermissions();
    if (!granted) return sendResponse({error: 'Permission denied'});
    const summary = await callOpenAI(msg.text);
    sendResponse({summary});
  }
});
Enter fullscreen mode Exit fullscreen mode

3. Run the scanner

npm install
npm run scan:ai   # scans for any fetch/postMessage to known AI endpoints without permission flags
Enter fullscreen mode Exit fullscreen mode

The scanner will output something like:

[WARN] background.js: line 27 – fetch to https://api.openai.com without aiDataOut permission
Enter fullscreen mode Exit fullscreen mode

Fix the warning by adding the missing permission (as shown above) and re‑run until the output is clean.

4. Verify with Playwright

npm run test:ai
Enter fullscreen mode Exit fullscreen mode

A successful run ends with:

✓ Consent prompt appears
✓ Extension loads without blocking
✓ AI call succeeds after permission grant
Enter fullscreen mode Exit fullscreen mode

Impact Across Chromium‑Based Browsers

Browser Permission Schema Additional Steps Release Timeline
Chrome aiDataIn, aiDataOut, aiLocalCompute Runtime consent via chrome.permissions.request Mandatory Jan 2025
Edge Same as Chrome None (inherits Chrome UI) Mirrors Chrome
Brave Same as Chrome + “Brave Privacy Shield” toggle Optional extra UI toggle in chrome://extensions Mirrors Chrome
Opera Follows Chrome (uses same manifest) None Mirrors Chrome
Firefox aiSandbox (different keys) Separate manifest block, Firefox‑specific API Independent schedule

If you ship a single‑code‑base, keep the Chrome/Edge/Brave manifest and add a conditional manifest_firefox.json for Firefox users.


Resources

  • Official policy: https://developer.chrome.com/ai/extensions
  • Node.js scanner repo: github.com/google/chrome-ai-scanner
  • Playwright compliance suite: github.com/google/chrome-ai-playwright
  • Chrome DevTools “AI Permissions” panel: chrome://flags/#enable-ai-permissions (enable for local testing)

Conclusion

The new AI permission model is not optional—it’s a compliance requirement that aligns Chrome with upcoming AI regulations worldwide. By updating your manifest, adding a tiny runtime consent snippet, and running the provided scanner/tests, you can keep your extension functional, privacy‑respectful, and ready for the January 2025 deadline. Start the migration now, publish the updated version before the end of 2024, and you’ll avoid the dreaded “extension blocked” warning that will appear in Chrome 129 and later.

Happy coding!


Herramienta mencionada: GitHub Copilot

Top comments (0)