From 7625473c045b179f5399ce107058d83e51626428 Mon Sep 17 00:00:00 2001 From: Coff0xc <184964491+Coff0xc@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:55:30 +0000 Subject: [PATCH] fix(extension): bound in-flight capture requests Requests that never finish stayed in the debugger map with their full post body. The map now drops the oldest entry past 500, and a stored body is cut at the ingest limit. --- CHANGELOG.md | 1 + extension/background.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af6fb65..9c6905e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented in this file. The format is b ### Fixed +- **Browser capture keeps a bounded request map**: unfinished debugger requests are capped at 500, and a stored request body is cut at the same 256 KiB limit as ingest. - **Docker Compose database passwords with URL-special characters**: `docker-compose.yml` no longer pastes `POSTGRES_PASSWORD` into `ARTEX_PG_DSN`. The server builds the URL from `ARTEX_PG_HOST`, `ARTEX_PG_PORT`, `ARTEX_PG_USER`, `ARTEX_PG_PASSWORD`, `ARTEX_PG_DBNAME` and `ARTEX_PG_SSLMODE`, percent-encoding the user and password, so `/`, `?`, `%`, `@`, `:` and spaces connect. An explicit `ARTEX_PG_DSN` still wins and is not rewritten. `ARTEX_PG_PASSWORD` is removed from the environment with the other startup secrets (#450). ## [0.7.0] - 2026-11-21 diff --git a/extension/background.js b/extension/background.js index f6d0312d..a3bcfc50 100644 --- a/extension/background.js +++ b/extension/background.js @@ -9,6 +9,7 @@ const FLUSH_AT = 10; // entries per batch const MAX_BODY = 256 * 1024; // matches the server-side ingest cap +const MAX_TRACKED = 500; // unfinished requests kept in memory const SKIP_MIME = ["image/", "font/", "audio/", "video/", "application/octet-stream"]; let session = { @@ -167,12 +168,18 @@ async function flush() { chrome.debugger.onEvent.addListener((source, method, params) => { if (!session.capturing || !source.tabId || source.tabId !== session.tabId) return; if (method === "Network.requestWillBeSent") { + let postData = params.request.postData || ""; + if (postData.length > MAX_BODY) postData = postData.slice(0, MAX_BODY); + if (!session.requests.has(params.requestId) && session.requests.size >= MAX_TRACKED) { + const oldest = session.requests.keys().next().value; + session.requests.delete(oldest); + } session.requests.set(params.requestId, { requestId: params.requestId, method: params.request.method, url: params.request.url, headers: params.request.headers, - postData: params.request.postData || "", + postData, }); } else if (method === "Network.responseReceived") { const info = session.requests.get(params.requestId);