ARTEX - AI autonomous penetration testing system (English translation; upstream: Autumn-27/ARTEX, AGPL-3.0)
Go aiai-agentsautonomous-agentsbug-bountydockergolanglinuxllmmcpnextjspenetration-testingpentestpostgresqlreareactred-teamsecuritysecurity-automationsqlitetypescript
fix(extension): accept object-shaped response headers from CDP
Xiaobodef23f6b380c
diff --git a/extension/background.js b/extension/background.jsindex 4514b30..f6d0312 100644--- a/extension/background.js+++ b/extension/background.js@@ -92,7 +92,17 @@ function truncate(s) {async function queueExchange(info, response) {const respHeaders = {};- for (const h of response.headers || []) respHeaders[h.name.toLowerCase()] = h.value;+ // CDP hands back response.headers as a plain object (dict), not an array of+ // {name,value} records; iterating it with for...of throws "object is not+ // iterable" and no exchange is ever queued. Accept both shapes.+ const rawHeaders = response.headers || {};+ if (Array.isArray(rawHeaders)) {+ for (const h of rawHeaders) {+ if (h && h.name != null) respHeaders[String(h.name).toLowerCase()] = h.value;+ }+ } else {+ for (const [k, v] of Object.entries(rawHeaders)) respHeaders[String(k).toLowerCase()] = v;+ }const mime = respHeaders["content-type"] || "";let reqBody = info.postData || "";