Skip to content

fix(security): drop <all_urls> host permission (least privilege) - #154

Open
zhongnansu wants to merge 1 commit into
mainfrom
fix/manifest-least-privilege
Open

fix(security): drop <all_urls> host permission (least privilege)#154
zhongnansu wants to merge 1 commit into
mainfrom
fix/manifest-least-privilege

Conversation

@zhongnansu

Copy link
Copy Markdown
Member

Change

Remove <all_urls> from manifest.json host_permissions. The array now contains exactly the two origins the extension actually calls:

  • https://dobby-ai-proxy.zhongnansu.workers.dev/*
  • https://api.openai.com/*

Why these are kept

  • api.openai.com — the bring-your-own-key path fetches OpenAI directly from the background service worker, so removing it would break BYOK.
  • content_scripts.matches is unchanged (still ["<all_urls>"]) so text-selection / screenshot triggers keep working on every page. This PR only narrows the extension's host/fetch reach, not where the content script injects.

Impact

Least-privilege tightening; reduces the "read your data on all websites" host grant and eases Chrome Web Store review. No behavior change for users.

🤖 Generated with Claude Code

Remove <all_urls> from host_permissions. Keep the proxy origin and
api.openai.com (the bring-your-own-key path fetches OpenAI directly from
the background worker, so removing it would break BYOK). content_scripts
matches is unchanged (still <all_urls>) so text selection still works on
every page. Narrows the extension's host reach and reduces the Chrome Web
Store 'read your data on all websites' warning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the infra Changes to infrastructure files label May 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 PR Preview — Ask AI Extension

Version: 1.2.1
Zip size: 342.6 KB

⬇️ Download artifact


Permissions

No permission changes detected. ✅


Preview Checklist

Before merging, manually test with the artifact above:

  • Load unpacked extension in chrome://extensions (developer mode)
  • Select text on any webpage and verify the trigger button appears
  • Click the trigger button and confirm the popup renders correctly
  • Right-click selected text and verify context menu items are present
  • Open a CSP-restricted page (e.g. chrome://extensions) and verify fallback works
  • Check the DevTools console for errors

Updated by PR Preview Bot — workflow run

@github-actions

Copy link
Copy Markdown
Contributor

📊 Code Coverage Report

File Coverage Status
proxy/src/index.js 98.0% 🟢
proxy/src/openai.js 100.0% 🟢
proxy/src/rate-limit.js 100.0% 🟢
proxy/src/validate.js 95.3% 🟢
src/options.js 97.6% 🟢
src/popup.js 100.0% 🟢
src/background/index.js 83.2% 🟢
src/content/api.js 88.2% 🟢
src/content/detection.js 99.3% 🟢
src/content/history.js 86.1% 🟢
src/content/image-capture.js 91.6% 🟢
src/content/presets.js 100.0% 🟢
src/content/prompt.js 97.4% 🟢
src/content/autosuggest/context.js 100.0% 🟢
src/content/autosuggest/debounce.js 100.0% 🟢
src/content/autosuggest/ghost-text.js 100.0% 🟢
src/content/autosuggest/index.js 75.9% 🔴
src/content/autosuggest/styles.js 100.0% 🟢
src/content/bubble/core.js 75.5% 🔴
src/content/bubble/history.js 85.3% 🟢
src/content/bubble/markdown.js 96.0% 🟢
src/content/bubble/stream.js 97.0% 🟢
src/content/bubble/styles.js 100.0% 🟢
src/content/shared/constants.js 100.0% 🟢
src/content/shared/dom-utils.js 100.0% 🟢
src/content/shared/preset-usage.js 91.8% 🟢
src/content/shared/state.js 100.0% 🟢
src/content/trigger/button.js 92.6% 🟢
src/content/trigger/progress-ring.js 100.0% 🟢
src/content/trigger/screenshot.js 98.6% 🟢
src/content/trigger/selection.js 72.8% 🔴
src/content/trigger/styles.js 100.0% 🟢
src/shared/autosuggest-limits.js 100.0% 🟢
src/shared/brand.js 100.0% 🟢
Overall 93.0% 🟢 PASS

Threshold: 80%

✅ Coverage meets the minimum threshold.


Updated by Code Coverage workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Changes to infrastructure files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant