Skip to content

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

fix: reject braille blank safe-first options

Emre Sokullu74909803b9e2
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 5cbfc7902..da53a4bd5 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -33853,7 +33853,9 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai
}
const rawOptions = Array.isArray(args?.options) ? args.options.slice(0, 4) : [];
const normalizedOptions = rawOptions.map(s => String(s).trim().slice(0, 200));
- const options = normalizedOptions.every(option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option))
+ const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option)
+ && !/[\p{Cf}\u2800]/u.test(option);
+ const options = normalizedOptions.every(hasVisibleOptionContent)
? normalizedOptions
: [];
const safeFirst = args?.safe_first === true && options.length > 0;
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index c027d9749..c5e1c0c81 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -30562,7 +30562,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
}
const rawOptions = Array.isArray(args?.options) ? args.options.slice(0, 4) : [];
const normalizedOptions = rawOptions.map(s => String(s).trim().slice(0, 200));
- const options = normalizedOptions.every(option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option))
+ const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option)
+ && !/[\p{Cf}\u2800]/u.test(option);
+ const options = normalizedOptions.every(hasVisibleOptionContent)
? normalizedOptions
: [];
const safeFirst = args?.safe_first === true && options.length > 0;
diff --git a/test/run.js b/test/run.js
index 42187bdef..3ddac4fe7 100644
--- a/test/run.js
+++ b/test/run.js
@@ -48820,6 +48820,17 @@ test('clarify result distinguishes waited timeout from user and Instant authoriz
);
assert.equal(invisibleOptionTimeout.authorized, false, `${AgentClass.name}: invisible safe_first option was accepted`);
+ await agent._recordClarificationAuthorization(tabId, 'user');
+ const brailleBlankOptionTimeout = await agent.executeTool(
+ tabId,
+ 'clarify',
+ { question: 'Continue?', options: ['\u2800'], safe_first: true },
+ (type, data) => {
+ if (type === 'clarify') agent.submitClarifyResponse(tabId, data.clarifyId, '\u2800', 'timeout');
+ },
+ );
+ assert.equal(brailleBlankOptionTimeout.authorized, false, `${AgentClass.name}: braille blank safe_first option was accepted`);
+
await agent._recordClarificationAuthorization(tabId, 'user');
const promotedOptionTimeout = await agent.executeTool(
tabId,