Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

fix(sidepanel): trim URLs before redacting userinfo

Emre Sokullu6e125be21022
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.js
index e95810309..c7e2fdc8e 100644
--- a/src/chrome/src/ui/sidepanel.js
+++ b/src/chrome/src/ui/sidepanel.js
@@ -2999,6 +2999,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confi
function redactUrlForLabel(url, depth = 0) {
if (depth > 3) return '…';
return String(url || '')
+ .trim()
.replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1')
.replace(SENSITIVE_PATH_SEGMENT_RE, '$1…')
.replace(/([?&#])([^=&#\s]+)=([^&#\s]*)/g, (match, prefix, param, val) => {
diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.js
index e8ffdadf6..4d088e19a 100644
--- a/src/firefox/src/ui/sidepanel.js
+++ b/src/firefox/src/ui/sidepanel.js
@@ -2860,6 +2860,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confi
function redactUrlForLabel(url, depth = 0) {
if (depth > 3) return '…';
return String(url || '')
+ .trim()
.replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1')
.replace(SENSITIVE_PATH_SEGMENT_RE, '$1…')
.replace(/([?&#])([^=&#\s]+)=([^&#\s]*)/g, (match, prefix, param, val) => {