fix: address code review feedback for browser extension

- Removed unused variables in capture.js (clonedDoc, styles array)
- Added explicit return values for message handlers in content.js
- Added detailed comment explaining 500ms render delay before PDF conversion
- Updated PERMISSIONS.md with comprehensive explanation of host_permissions requirement
- Updated test.html with web clipping test scenarios
- Improved code consistency and documentation

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 23:27:57 +00:00
parent 5380c6de6c
commit 7fc8dd655a
5 changed files with 167 additions and 145 deletions
+69 -45
View File
@@ -7,10 +7,10 @@ This document explains the permissions requested by the DocuElevate browser exte
The extension requests the following permissions in `manifest.json`:
### activeTab
- **Purpose**: Get the URL of the currently active tab
- **Usage**: When you click the extension icon, it reads the current tab's URL to display in the popup
- **Privacy**: Only accesses the active tab when you explicitly open the popup
- **Alternative**: Without this, the extension couldn't show you which file you're sending
- **Purpose**: Get the URL and content of the currently active tab
- **Usage**: When you click the extension icon, it reads the current tab's URL and content for clipping
- **Privacy**: Only accesses the active tab when you explicitly use the extension
- **Alternative**: Without this, the extension couldn't show you which file you're sending or clip pages
### storage
- **Purpose**: Save your configuration (server URL and session cookie)
@@ -19,61 +19,80 @@ The extension requests the following permissions in `manifest.json`:
- **Alternative**: Without this, you'd need to reconfigure the extension every time
### contextMenus
- **Purpose**: Add "Send to DocuElevate" to the right-click menu
- **Usage**: Creates a context menu item for quick access
- **Privacy**: No data access; only adds a menu item
- **Purpose**: Add context menu options for sending URLs and clipping pages
- **Usage**: Creates context menu items for quick access (Send URL, Clip Full Page, Clip Selection)
- **Privacy**: No data access; only adds menu items
- **Alternative**: Without this, you'd only have the toolbar icon
### notifications
- **Purpose**: Show success/error notifications
- **Usage**: Displays browser notifications when files are sent successfully or errors occur
- **Usage**: Displays browser notifications when files are sent or clipped successfully, or when errors occur
- **Privacy**: Only shows notifications based on your actions
- **Alternative**: Without this, you wouldn't get feedback from context menu actions
## No Host Permissions
### scripting (New in v1.1.0)
- **Purpose**: Inject content capture code into web pages for clipping
- **Usage**: When you click "Clip Page" or "Clip Selection", this permission allows the extension to execute code that captures page HTML
- **Privacy**: Code only executes when you explicitly clip a page; no tracking or monitoring
- **Scope**: Only runs in the active tab, only when you trigger clipping
- **Alternative**: Without this, web page clipping wouldn't be possible
The extension has an **empty `host_permissions` array** (`[]`).
## Host Permissions (v1.1.0)
### Why Empty?
### <all_urls> - Required for Web Clipping
- **Privacy-First**: The extension doesn't request blanket access to all websites
- **User-Controlled**: You configure the DocuElevate server URL, not us
- **Minimal Permissions**: Only accesses the server you explicitly configure
- **Dynamic Access**: API requests are made from popup/background scripts, not from web pages
**Why Required**: The `<all_urls>` host permission is necessary for the web clipping feature to work on any website you visit.
### How It Works
**Specific Use Cases**:
1. **Page Content Capture**: To clip a web page, the extension must access the page's HTML and CSS
2. **PDF Conversion**: The browser's printToPDF API requires host permissions to convert page content
3. **Dynamic Content**: Ensures clipped pages include all styles and content, regardless of the website
1. You configure your DocuElevate server URL in the extension
2. The extension stores this URL in local storage
3. When you send a file, the extension makes a direct API request to your configured server
4. No need for static host permissions because the extension doesn't inject scripts or modify web pages
**Security Safeguards**:
- **User-Initiated Only**: Content access only happens when you explicitly click "Clip Page" or "Clip Selection"
- **No Automatic Access**: The extension doesn't monitor or track your browsing
- **Local Processing**: Page content is captured and converted to PDF locally in your browser
- **No Third-Party Transmission**: Content goes only to your configured DocuElevate server
- **Temporary Access**: Content is processed immediately and not stored by the extension
### Comparison to Other Extensions
**Alternative Options**:
- **activeTab Only**: If you only want URL sending (not web clipping), the extension could work with just `activeTab` permission
- **Manual Permission**: You could be prompted per-site, but this would be cumbersome for frequent use
Many similar extensions request:
- `"<all_urls>"` or `"*://*/*"` - Access to all websites
- `"http://*/*"` and `"https://*/*"` - Access to all HTTP/HTTPS sites
DocuElevate requests:
-`[]` - No blanket host permissions
- ✅ Only access to your configured server (via fetch API)
**Privacy Guarantee**: Even with `<all_urls>`, the extension:
- Does NOT monitor your browsing
- Does NOT collect page content automatically
- Does NOT track which sites you visit
- Only accesses content when you explicitly clip a page
## Permission Justification
| Permission | Required? | Justification |
|------------|-----------|---------------|
| activeTab | ✅ Yes | Must read current tab URL to send files |
| activeTab | ✅ Yes | Must read current tab URL and content |
| storage | ✅ Yes | Must save configuration to function |
| contextMenus | ⚠️ Optional | Nice to have for quick access |
| notifications | ⚠️ Optional | Nice to have for feedback |
| scripting | ✅ Yes (for clipping) | Required to capture page content for web clipping |
| host_permissions: <all_urls> | ✅ Yes (for clipping) | Required for web clipping to work on any website |
## Security Benefits
1. **No Web Page Access**: Extension can't read or modify content on websites you visit
2. **No Browsing History**: Extension doesn't track your browsing
3. **No Cross-Site Access**: Extension only talks to your configured server
4. **User-Controlled**: All communication is initiated by you
5. **Transparent**: All code is visible in the extension folder
1. **User-Initiated Access**: Extension only accesses page content when you explicitly click "Clip"
2. **Local Processing**: Pages converted to PDF in your browser, not on a server
3. **User-Controlled Server**: Extension only talks to your configured DocuElevate server
4. **No Automatic Tracking**: Extension doesn't monitor your browsing or collect data in the background
5. **Transparent Code**: All code is visible in the extension folder for audit
## How Web Clipping Works Securely
1. **You Trigger**: You click "Clip Page" or "Clip Selection"
2. **Content Capture**: Extension captures page HTML (only when you click)
3. **Local Conversion**: Your browser converts HTML to PDF using built-in API
4. **Direct Upload**: PDF is sent only to your configured DocuElevate server
5. **Temporary Tab**: A hidden tab is created temporarily for PDF conversion, then immediately closed
**No data leaves your machine except to your own DocuElevate server.**
## How to Verify Permissions
@@ -93,31 +112,35 @@ DocuElevate requests:
## Reducing Permissions Further
If you want even fewer permissions:
If you want fewer permissions or don't need web clipping:
1. **Remove contextMenus**: Delete the `contextMenus` permission from `manifest.json`
- Trade-off: Lose right-click menu option
1. **Disable Web Clipping**: Use v1.0.0 instead of v1.1.0
- No scripting permission
- No host_permissions (<all_urls>)
- Trade-off: Can only send URLs, not clip pages
2. **Remove contextMenus**: Delete the `contextMenus` permission from `manifest.json`
- Trade-off: Lose right-click menu options
- You'd only have the toolbar icon
2. **Remove notifications**: Delete the `notifications` permission
3. **Remove notifications**: Delete the `notifications` permission
- Trade-off: No success/error notifications
- You'd only see status in the popup
3. **Remove content script**: Delete the `content_scripts` section
- Trade-off: None (it's not actively used currently)
- Reduces extension footprint slightly
## Privacy Statement
The DocuElevate browser extension:
The DocuElevate browser extension (v1.1.0):
- ✅ Does NOT collect any personal data
- ✅ Does NOT track your browsing history
- ✅ Does NOT monitor web pages you visit
- ✅ Does NOT send data to third parties
- ✅ Does NOT modify web page content
- ✅ Does NOT modify web page content (except when you explicitly clip)
- ✅ Does NOT inject ads or tracking scripts
- ✅ Only accesses page content when you explicitly click "Clip"
- ✅ Only communicates with YOUR configured DocuElevate server
- ✅ Stores configuration locally on your device only
- ✅ Converts pages to PDF locally in your browser
## Questions?
@@ -126,7 +149,8 @@ If you have concerns about permissions or privacy, please:
- Review the source code in the `browser-extension` folder
- Open an issue on [GitHub](https://github.com/christianlouis/DocuElevate/issues)
- Check the [Browser Extension Guide](../docs/BrowserExtension.md)
- Use v1.0.0 if you don't need web clipping features
---
Last updated: 2024
Last updated: 2024 (v1.1.0)