🧩 Browser Extension (Manifest V3)
The ChildSafeNet browser extension enforces real-time URL protection by communicating with the backend API and applying blocking decisions based on Parent settings and AI predictions.
1. Supported Browsers
- Google Chrome (Chromium-based)
- Microsoft Edge (Chromium-based)
The extension uses Manifest V3 (MV3) architecture with a background service worker.
2. Installation (Developer Mode)
After installation ensure:
- Extension is enabled
- No errors appear in the extension card
3. Pairing Flow
The extension must be paired with the Web Dashboard before protection becomes active.
Flow Overview
Web Dashboard generates pairing token
Dashboard sends token to extension via
window.postMessage
Content script listens and forwards token to background service worker
Background stores token in
chrome.storage.local
Extension responds with
CSN_PAIR_RESULT
Dashboard updates status (Paired / Failed)
4. Storage
The extension stores:
- Pairing token
- Mode sync state
- API base URL (if configurable)
Stored in:
chrome.storage.local
No sensitive data should be stored in plaintext beyond necessary tokens.
5. Scan Flow (Runtime)
The following diagram illustrates the real-time decision pipeline used by the browser extension.
User Browser
↓
Browser Extension
↓
Background Service Worker
↓
POST /api/scan
↓
Backend API
↓
AI Risk Engine
↓
Decision
↙ ↘
ALLOW BLOCK
↓ ↓
Page block.html
/api/scanIf decision = BLOCK
- Extension redirects to
block.html
If decision = ALLOW
- Page loads normally
Scan result logged on backend
The extension does not decide independently — the API is authoritative.
6. Enable / Disable Protection
Protection can be toggled:
- From Web Dashboard (recommended)
- From Extension popup (if implemented)
When disabled:
- Extension may still log URLs (optional)
- Blocking is skipped
7. Common Issues & Troubleshooting
NOT READY
Meaning: Content script not injected.
Fix:
- Check
host_permissionsinmanifest.json - Reload extension
- Reload page
Pair failed / Port closed
Possible causes:
- Background service worker stopped
- API unreachable
- Token expired
- Runtime error
Fix:
- Open extension details
- Click Service Worker
- Open console and inspect logs
- Verify API URL and CORS configuration
No logs appear in dashboard
Check:
- JWT token valid
- Pairing successful
- Correct user account
- API reachable
8. Security Notes
- Use HTTPS in production
- Do not expose API keys in extension
- Validate all responses server-side
- Limit CORS origins
9. Manifest V3 Key Components
- manifest.json
- background.js (service worker)
- content.js
- popup.html / popup.js (optional)
- block.html
10. Best Practices
- Keep service worker lightweight
- Avoid long-running blocking tasks
- Handle network errors gracefully
- Implement retry logic if needed
- Provide clear UX for blocked pages