Skip to content

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

fix(sidepanel): redact bracketed credentials and OAuth auth-code params

Emre Sokullu6762ff075bd7
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.js
index 6d5e1e81a..c83c58e42 100644
--- a/src/chrome/src/ui/sidepanel.js
+++ b/src/chrome/src/ui/sidepanel.js
@@ -2990,7 +2990,7 @@ const TOOL_KEYS = {
carousel_navigate: 'tool.navigate',
};
-const SENSITIVE_PARAM_WORDS_RE = /(?:^|[_-])(?:key|api[_-]?key|token|secret|password|passwd|pwd|session|otp|signature|sig|auth|authorization)(?:[_-]|$)/i;
+const SENSITIVE_PARAM_WORDS_RE = /(?:^|[^a-z0-9])(?:key|api[_-]?key|token|secret|password|passwd|pwd|session|otp|signature|sig|auth|authorization|code)(?:[^a-z0-9]|$)/i;
// Strip credentials (userinfo, sensitive query/fragment values) before a URL
// is shown in the always-visible step label. The full value stays behind the
diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.js
index 9202ce6cd..b4ad28876 100644
--- a/src/firefox/src/ui/sidepanel.js
+++ b/src/firefox/src/ui/sidepanel.js
@@ -2851,7 +2851,7 @@ const TOOL_KEYS = {
carousel_navigate: 'tool.navigate',
};
-const SENSITIVE_PARAM_WORDS_RE = /(?:^|[_-])(?:key|api[_-]?key|token|secret|password|passwd|pwd|session|otp|signature|sig|auth|authorization)(?:[_-]|$)/i;
+const SENSITIVE_PARAM_WORDS_RE = /(?:^|[^a-z0-9])(?:key|api[_-]?key|token|secret|password|passwd|pwd|session|otp|signature|sig|auth|authorization|code)(?:[^a-z0-9]|$)/i;
// Strip credentials (userinfo, sensitive query/fragment values) before a URL
// is shown in the always-visible step label. The full value stays behind the
diff --git a/test/run.js b/test/run.js
index c17b2d384..ea8c95491 100644
--- a/test/run.js
+++ b/test/run.js
@@ -45068,6 +45068,7 @@ test('sidepanel friendlyToolLabel localizes get_accessibility_tree and actions a
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`);
+ assert.match(panel, /authorization\|code/, `${label}: URL credential redaction must cover auth code`);
assert.match(panel, /redactUrlForLabel\(args\.url\)/, `${label}: fetch/research labels must redact URL credentials`);
assert.match(panel, /function isTerminalDoneTool\(name\)/, `${label}: done_json must share terminal completion handling`);
assert.match(panel, /function restoreStepFriendlyLabel\(step\)/, `${label}: completed/failed steps must restore friendly label and clear progress marker`);