Why Most AI Chrome Extensions Ask for Too Many Permissions — and How I Built a 25 KB activeTab-Only Clipper
When the official Claude browser extension rolled out, one detail jumped out to developers inspecting...
When the official Claude browser extension rolled out, one detail jumped out to developers inspecting its store listing: because it acts as an autonomous browser agent that clicks and types across websites, it discloses access to browsing history, page contents across sites, mouse position, and keystroke activity.
That tradeoff makes complete sense if you genuinely want an autonomous agent navigating your browser for you.
But when I looked at what I actually do 90% of the time with Claude, ChatGPT, and Gemini in Chrome, I didn't want an autonomous agent at all. I only needed three boring, everyday things:
- Clip the current webpage (or highlighted passage) to clean Markdown without ads, navbars, and cookie banners eating half my context window.
- Organize important threads across Claude, ChatGPT, and Gemini in one searchable place so I'm not locked into one vendor's sidebar.
- Export full conversations to Obsidian-ready
.mdor PDF locally, without generating public share URLs or pasting chats through random third-party servers.
None of those three workflows requires <all_urls>, history, or a remote backend.
So I built ClipForAI—an open-source, zero-dependency Chrome MV3 extension (~25 KB zipped) designed around strict minimal permissions. Here are the two engineering choices that made it work cleanly.
1. Using activeTab + scripting Instead of <all_urls>
Most "AI sidebar" and "web clipper" extensions declare <all_urls> or https://*/* in content_scripts. That means their JavaScript loads on every single tab you open—banking dashboards, internal admin panels, private docs—whether you ever click the extension or not.
In Manifest V3, Chrome already gives us a much safer primitive: activeTab.
Here is the entire permissions block of extension/manifest.json:
{
"manifest_version": 3,
"permissions": [
"activeTab",
"scripting",
"storage"
],
"content_scripts": [
{
"matches": [
"https://claude.ai/*",
"https://chatgpt.com/*",
"https://gemini.google.com/*"
],
"js": [
"lib/prompts.js",
"lib/markdown.js",
"lib/store.js",
"content/ai-bridge.js"
],
"run_at": "document_idle"
}
]
}
How this behaves in practice:
- On normal websites: ClipForAI runs zero code until you explicitly click Clip Active Tab in the popup. At that moment,
chrome.scripting.executeScriptinjects the local Markdown extractor into only that active tab, extracts the main article (or your highlighted selection), and returns clean Markdown + an estimated token count. - On
claude.ai,chatgpt.com, andgemini.google.com: The scoped content script renders a tiny local dock to save threads intochrome.storage.localfolders, insert clipped Markdown into the composer, and export the active conversation to.mdor print-ready PDF. - Network footprint: Zero external API calls. Everything runs in-browser.
If you want to inspect the exact permission comparison between autonomous AI browser agents and on-click activeTab tools, I documented the full breakdown here: Official Claude Chrome Extension Privacy & Permission Audit.
2. Surviving Frequent AI Web UI DOM Changes (Without Breaking Export)
Anyone who has built a browser extension for ChatGPT, Claude, or Gemini knows the real maintenance headache: all three web apps change their DOM markup constantly.
Earlier this week, testing our local conversation exporter on live ChatGPT immediately exposed a classic failure mode: relying solely on [data-message-author-role] or <article> wrappers broke on a subset of updated conversation views where inner .markdown containers were empty placeholders.
Instead of brittle single-selector scraping, extension/content/ai-bridge.js uses a 4-layer resilient extraction cascade:
- Semantic role selectors first (
[data-message-author-role], Claude's user/assistant test IDs, Gemini'suser-query/model-responsecustom elements). - Container deduplication (
dedupeRoots) so nested matching elements are never exported twice, while explicitly stripping UI chrome (button,form,textarea,#clipforai-dock,.sr-only):
function extractNodeMarkdown(node) {
if (!node) return "";
const clone = node.cloneNode(true);
clone
.querySelectorAll(
"button, [role='button'], form, textarea, [contenteditable='true'], .sr-only, [aria-hidden='true'], #clipforai-dock, #clipforai-toast"
)
.forEach((el) => el.remove());
return md.cleanBlankLines(md.domNodeToMarkdown(clone, { baseUrl: location.href }));
}
- Structural turn fallback: If primary attributes change overnight, inspect top-level turn containers inside
<main>, inferUservsAssistantfrom attributes/class hints, and preserve fenced code blocks, tables, and lists. - Non-empty
<main>guard: Even in the worst-case redesign, never silently drop a user's transcript or crash.
And when inserting clipped Markdown back into ProseMirror (Claude / ChatGPT) or Quill (Gemini), we fall back cleanly across document.execCommand("insertText"), InputEvent, and clipboard copy so a frontend refactor never loses your clipped notes.
Try the Converter Without Installing Anything
While the extension finishes Chrome Web Store review, I also published the exact same client-side HTML-to-Markdown engine as a standalone, zero-upload browser tool—useful when you just want to clean up messy docs or rich text and check token counts before pasting into an LLM:
- Online Tool: HTML & Webpage to Markdown Converter (100% In-Browser)
- Open-Source Repo (MIT): github.com/windwhyhere/clipforai
If you audit Chrome extensions before installing them—or have hit weird DOM quirks on Claude, ChatGPT, or Gemini—I'd love to hear what edge cases you've run into in the comments.
Sumber artikel open-source oleh Ethan Davis di DEV Community — Baca artikel asli. Topik:
#webdev#chrome#privacy#ai

Komentar