Add score-gated browsing controls to VSW extension - #10
Merged
Conversation
Co-authored-by: BotondCsereklye <178569310+BotondCsereklye@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances the vsw-link-capture browser extension with score-gated navigation controls, allowing users to scan targets first and only proceed with navigation when a scan meets a configurable minimum score. It also adds an optional “auto-scan after navigation” mode to register direct/JS-driven visits.
Changes:
- Added a new popup flow to “Scan and visit target” (manual domain/URL entry) with scan-before-visit behavior.
- Introduced configurable minimum score gating (and optional blocking) plus background polling for scan completion.
- Added automatic scanning of visited pages after top-level navigation and updated extension docs/version.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/vsw-link-capture/README.md | Documents the new scan/visit flow, auto-scan mode, and score gating settings. |
| extensions/vsw-link-capture/popup.js | Adds UI wiring for manual target scanning, new settings toggles, and persistence. |
| extensions/vsw-link-capture/popup.html | Adds manual target input panel and new settings controls to the popup. |
| extensions/vsw-link-capture/manifest.json | Bumps extension version to 0.3.0. |
| extensions/vsw-link-capture/background.js | Implements scan polling, score-based gate decisions, scan-target-and-visit handling, and visited-page auto-scan tracking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
171
to
+176
| if (result.ok) { | ||
| if (tabId !== undefined) { | ||
| rememberVisitedPage(tabId, rawUrl); | ||
| } | ||
|
|
||
| const gateDecision = evaluateGateDecision(result.detail, settings); |
Comment on lines
+46
to
+52
| chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | ||
| if (changeInfo.status !== "complete") { | ||
| return; | ||
| } | ||
|
|
||
| void handleVisitedPage(tabId, tab?.url || changeInfo.url || null); | ||
| }); |
Comment on lines
+371
to
+390
| const candidate = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`; | ||
| try { | ||
| const parsedUrl = new URL(candidate); | ||
| if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") { | ||
| return { ok: false, error: "Only http and https targets are supported." }; | ||
| } | ||
|
|
||
| if (!parsedUrl.hostname) { | ||
| return { ok: false, error: "Could not extract host from target." }; | ||
| } | ||
|
|
||
| return { | ||
| ok: true, | ||
| target: parsedUrl.hostname, | ||
| visitUrl: parsedUrl.toString(), | ||
| }; | ||
| } catch (_error) { | ||
| return { ok: false, error: "Please enter a valid domain or URL." }; | ||
| } | ||
| } |
| }; | ||
| } | ||
|
|
||
| const score = typeof detail.score === "number" ? detail.score : null; |
Comment on lines
102
to
110
| const settings = { | ||
| liveCaptureEnabled: liveCaptureToggle.checked, | ||
| blockOnScanFailure: blockOnFailureToggle.checked, | ||
| autoScanVisitedPages: autoScanVisitedPagesToggle.checked, | ||
| minimumAllowedScore: Number.parseInt(minimumAllowedScoreInput.value || "50", 10), | ||
| blockBelowMinimumScore: blockBelowMinimumScoreToggle.checked, | ||
| }; | ||
|
|
||
| const result = await chrome.runtime.sendMessage({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Why?
This makes the browser extension more useful for defensive browsing workflows. Users can scan a target first and only continue when the resulting report passes the configured score threshold.
Checks
Collaboration
This contribution was created together with BotondCsereklye.