Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix(sidepanel): redact userinfo from protocol-relative URLs
Emre Sokullu643fa40b7cbb
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.jsindex 22a34abc5..e97b95598 100644--- a/src/chrome/src/ui/sidepanel.js+++ b/src/chrome/src/ui/sidepanel.js@@ -2999,7 +2999,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confifunction redactUrlForLabel(url, depth = 0) {if (depth > 3) return String(url || '');return String(url || '')- .replace(/^([a-z][a-z0-9+.-]*:\/\/)(?:[^/?#\s]*@)+/i, '$1')+ .replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1').replace(SENSITIVE_PATH_SEGMENT_RE, '$1…').replace(/([?&#])([^=&#\s]+)=([^&#\s]*)/g, (match, prefix, param, val) => {let decoded = param;diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.jsindex c1e54bb89..554d3b0cb 100644--- a/src/firefox/src/ui/sidepanel.js+++ b/src/firefox/src/ui/sidepanel.js@@ -2860,7 +2860,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confifunction redactUrlForLabel(url, depth = 0) {if (depth > 3) return String(url || '');return String(url || '')- .replace(/^([a-z][a-z0-9+.-]*:\/\/)(?:[^/?#\s]*@)+/i, '$1')+ .replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1').replace(SENSITIVE_PATH_SEGMENT_RE, '$1…').replace(/([?&#])([^=&#\s]+)=([^&#\s]*)/g, (match, prefix, param, val) => {let decoded = param;diff --git a/test/run.js b/test/run.jsindex c5f66bc08..6b54868b1 100644--- a/test/run.js+++ b/test/run.js@@ -45066,6 +45066,7 @@ test('sidepanel friendlyToolLabel localizes get_accessibility_tree and actions aassert.match(panel, /function redactUrlForLabel\(url/, `${label}: URL step labels must redact credentials`);assert.match(panel, /SENSITIVE_PATH_SEGMENT_RE/, `${label}: URL credential redaction must sanitize sensitive path tokens`);assert.match(panel, /\(\?:\[\^\/\?#\\s\]\*@\)\+/, `${label}: URL userinfo redaction must strip through final authority delimiter`);+ assert.match(panel, /\(\?:\[a-z\]\[a-z0-9\+\.-\]\*:\)\?\\\/\\\//, `${label}: URL userinfo redaction must cover protocol-relative URLs`);assert.match(panel, /decodeURIComponent/, `${label}: URL credential redaction must decode parameter names`);assert.match(panel, /SENSITIVE_PARAM_WORDS_RE/, `${label}: URL credential redaction must inspect sensitive parameter names`);assert.match(panel, /signature\|sig/, `${label}: URL credential redaction must cover signatures`);