The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
browser-extension: accept loopback endpoints on the scheme's default port
Claude2b713b26b72d
diff --git a/browser-extension/README.md b/browser-extension/README.mdindex 5701665c..3ed6c23c 100644--- a/browser-extension/README.md+++ b/browser-extension/README.md@@ -325,7 +325,7 @@ dashboard), including interleaved sessions with no cross-contamination.the data source; and if the interceptor failed to run at all, a page script could offer thecontent script its own port while the document is still loading.- **Loopback-only delivery.** The OTLP endpoint must be `http(s)` on `127.0.0.1`, `localhost` or- `[::1]` with an explicit port. The service worker enforces this when settings are saved and again+ `[::1]` (any port). The service worker enforces this when settings are saved and againbefore every send (redirects are refused), and it takes settings changes only from theextension's own popup and options pages, never from a content script.diff --git a/browser-extension/src/options/options.html b/browser-extension/src/options/options.htmlindex 3f9105bb..5fe6872e 100644--- a/browser-extension/src/options/options.html+++ b/browser-extension/src/options/options.html@@ -29,7 +29,7 @@<label for="endpoint">OTLP logs endpoint</label><input type="text" id="endpoint" data-testid="endpoint" />- <p class="hint">Loopback only: an http(s) URL on 127.0.0.1, localhost or [::1] with a port.</p>+ <p class="hint">Loopback only: an http(s) URL on 127.0.0.1, localhost or [::1].</p><label>Sites</label><label class="site"><input type="checkbox" id="site_claude_web" /><span>claude.ai</span></label>diff --git a/browser-extension/src/shared/validate.ts b/browser-extension/src/shared/validate.tsindex ffcab5d3..93fcd473 100644--- a/browser-extension/src/shared/validate.ts+++ b/browser-extension/src/shared/validate.ts@@ -59,8 +59,11 @@ export function parseHost(raw: unknown): string | null {const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]']);/**- * The only endpoints the extension may deliver to: http(s) on loopback, with an- * explicit port and no credentials. Chat content never leaves the machine from+ * The only endpoints the extension may deliver to: http(s) on loopback, with+ * no credentials. A URL without a port uses the scheme's default port, which+ * is still loopback; the WHATWG parser reports an explicit default port+ * (:80 on http, :443 on https) as no port at all, so requiring one would+ * refuse those spellings. Chat content never leaves the machine from* the browser; anything beyond it is the local collector's job.*/export function isAllowedEndpoint(raw: unknown): raw is string {@@ -73,7 +76,6 @@ export function isAllowedEndpoint(raw: unknown): raw is string {}if (u.protocol !== 'http:' && u.protocol !== 'https:') return false;if (!LOOPBACK_HOSTS.has(u.hostname)) return false;- if (u.port === '') return false;if (u.username !== '' || u.password !== '') return false;return true;}@@ -110,7 +112,7 @@ export function parseSettingsPatch(raw: unknown): PatchResult {return {ok: false,error:- 'endpoint must be an http(s) URL on 127.0.0.1, localhost or [::1] with a port, such as http://127.0.0.1:4318/v1/logs',+ 'endpoint must be an http(s) URL on 127.0.0.1, localhost or [::1], such as http://127.0.0.1:4318/v1/logs',};}out.endpoint = value;diff --git a/browser-extension/test/unit/validate.test.ts b/browser-extension/test/unit/validate.test.tsindex 017bf764..a1570cd6 100644--- a/browser-extension/test/unit/validate.test.ts+++ b/browser-extension/test/unit/validate.test.ts@@ -63,14 +63,18 @@ describe('isAllowedEndpoint', () => {'http://localhost:4318/v1/logs','https://127.0.0.1:4318/v1/logs','http://[::1]:4318/v1/logs',+ 'http://127.0.0.1/v1/logs',+ 'http://127.0.0.1:80/v1/logs',+ 'https://localhost:443/v1/logs',+ 'https://localhost/v1/logs',+ 'http://[::1]/v1/logs',])('allows %s', (u) => {expect(isAllowedEndpoint(u)).toBe(true);});it.each([['a remote host', 'https://collector.example.com:4318/v1/logs'],- ['no port', 'http://127.0.0.1/v1/logs'],- ['a default port spelled out', 'http://127.0.0.1:80/v1/logs'],+ ['a remote host on a default port', 'https://collector.example.com:443/v1/logs'],['another loopback-looking host', 'http://127.0.0.1.example.com:4318/v1/logs'],['credentials', 'http://user:[email protected]:4318/v1/logs'],['a non-http scheme', 'ftp://127.0.0.1:4318/'],diff --git a/docs/runtimes/browser-extension.mdx b/docs/runtimes/browser-extension.mdxindex 3b7f109f..9f393489 100644--- a/docs/runtimes/browser-extension.mdx+++ b/docs/runtimes/browser-extension.mdx@@ -121,7 +121,7 @@ The extension is configured in its own UI, not by `beacon`. There is no CLI comm| Surface | How to open it | Settings ||---------|----------------|----------|| Popup | Click the extension's toolbar icon | Capture on or off, content retention (`full`, `redacted`, `metadata`), plus live queue depth and active stream count |-| Options page | Right-click the icon and choose **Options**, or use **Details** then **Extension options** in `chrome://extensions` | OTLP logs endpoint (loopback only: `http(s)` on `127.0.0.1`, `localhost` or `[::1]` with a port), and per-site checkboxes for claude.ai and chatgpt.com |+| Options page | Right-click the icon and choose **Options**, or use **Details** then **Extension options** in `chrome://extensions` | OTLP logs endpoint (loopback only: `http(s)` on `127.0.0.1`, `localhost` or `[::1]`), and per-site checkboxes for claude.ai and chatgpt.com |Both sites are enabled by default. Turn one off in the options page to collect from the other alone.