Skip to content

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

Placeholder guard: only a whole card answer supplies the value

Claude08c31d650e24
diff --git a/docs/security-model.md b/docs/security-model.md
index bca4f4aa5..a8cfb2dff 100644
--- a/docs/security-model.md
+++ b/docs/security-model.md
@@ -223,7 +223,7 @@ The primary threat: a malicious page crafts content that, when read by the agent
| **`done()` verification** | Decision and tool-free LLM checks prefer vision, then AX. Confident pending/failed outcomes require read-only recovery before another submission. Accepted task-bound proof can satisfy generic evidence despite an unrelated comment form, while explicit recipient, payment, download, authorization and workflow contracts remain required. Existing dialog/form checks are the final fallback. |
| **Grouped search approval** | A same-site GET form with no credential, payment or hidden token field, and no side-effect action address, shares one task-scoped approval for its navigation, typing and submit when the page's structure marks it as a search: a search landmark, a search-typed field or one whose keyboard says search, code names such as `q` or `query`, a search address, or a submit control a model read, in any language, as only searching or filtering. Words in a field's visible label decide nothing. Every other form keeps its fresh confirmation. |
| **Duplicate-submit guard** | A second text click on the same caption within 45 seconds on the same tab and URL is blocked when a model read the caption, in any language, as committing something (sending, saving, paying, publishing, creating, confirming and so on). A caption read as anything else, or that could not be read, stays repeatable; app-observed popups, links, fields and draft tools are always repeatable. Both builds. |
-| **Placeholder-value guard** | A form submission whose edited field still holds that field's own placeholder text, the page's example such as `[email protected]` in an email box, is not sent and gets no card unless the user supplied that value for the current task: as a whole answer on one of its cards, or, for a value with a digit or symbol, written as a whole in its messages. An earlier, unrelated turn does not count. A plain word the request only names ("sign me up for email updates" beside a placeholder `Email`) does not supply it. A field counts as edited when the submit probe sees it differ from its default or WebBrain's own write put the value into that same field (by its ref, or its name and id) in this run. This holds with confirmations off and in scheduled runs too. The probe checks every field of the form, not only the eight its summary shows, and never reports a password. The model is told to ask the user for the value. A placeholder without a letter or shorter than three characters (a `1` in a quantity box) does not count, and grouped searches keep their approval. Both builds. |
+| **Placeholder-value guard** | A form submission whose edited field still holds that field's own placeholder text, the page's example such as `[email protected]` in an email box, is not sent and gets no card unless the user gave that value as a whole answer on one of the current task's cards. The words of a request do not count, whether they give the value or refuse it ("do not use [email protected]"): a text match cannot tell which, in any language, so the model asks and the answer decides. An earlier, unrelated turn's answers do not count either. A field counts as edited when the submit probe sees it differ from its default or WebBrain's own write put the value into that same field (by its ref, or its name and id) in this run. This holds with confirmations off and in scheduled runs too. The probe checks every field of the form, not only the eight its summary shows, and never reports a password. The model is told to ask the user for the value. A placeholder without a letter or shorter than three characters (a `1` in a quantity box) does not count, and grouped searches keep their approval. Both builds. |
| **CLICK occlusion test** | Before clicking, the resolver calls `elementFromPoint()`. If another element is visually on top, the click is refused. |
| **Modal-scoped click** | When a dialog is open, text clicks are scoped to that subtree so the agent doesn't click a dimmed background element. |
| **Universal preamble** | Every system prompt includes guidance on cookie banners and paywalls — two common injection vectors that look like benign page content. |
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 210908877..b85c88077 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -52446,14 +52446,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
}
// The edited fields of a submission that hold their own placeholder text
- // when the user did not supply that value for the current task: the
- // page's example typed in as the user's. A field counts as edited when
- // the probe saw it differ from its default or WebBrain's own write put
- // that value into that same field in this run (a framework may copy a
- // typed value into defaultValue). The probe's complete list is read when
- // it sent one; the summary's changed fields stop at eight. A placeholder
- // without a letter, or shorter than three characters (a "1" in a quantity
- // box), is not an example of this kind.
+ // when the user did not give that value as an answer on one of the
+ // current task's cards: the page's example typed in as the user's. A
+ // field counts as edited when the probe saw it differ from its default or
+ // WebBrain's own write put that value into that same field in this run (a
+ // framework may copy a typed value into defaultValue). The probe's
+ // complete list is read when it sent one; the summary's changed fields
+ // stop at eight. A placeholder without a letter, or shorter than three
+ // characters (a "1" in a quantity box), is not an example of this kind.
_placeholderValueFields(tabId, submitInfo) {
const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();
const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields
@@ -52464,33 +52464,20 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& (field?.changed === true || this._placeholderWritten(tabId, field, value));
});
if (!fields.length) return [];
- // Only the active task's own words and the user's answers to its cards
- // can supply a value; an earlier, unrelated turn cannot.
+ // Only a whole answer the user gave on one of the active task's cards
+ // supplies such a value. The words of a request are not read for it:
+ // whether a mention gives the value or refuses it ("do not use
+ // [email protected]") is not something a text match can tell, in any
+ // language, so the model asks and the answer decides.
const messages = this.conversations.get(tabId) || [];
const binding = this._activeTaskBinding(messages);
- const taskMessages = binding.taskIndex < 0 ? []
- : (binding.pinnedIndices || []).map(index => messages[index])
- .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));
- const requests = binding.taskIndex < 0 ? [] : [binding.requestText,
- ...(Array.isArray(binding.updates) ? binding.updates.map(update => update?.text) : []),
- ...taskMessages.map(message => this._plannerUserAuthoredText(message))].map(normalize).filter(Boolean);
const answers = binding.taskIndex < 0 ? [] : [
...(Array.isArray(binding.answers) ? binding.answers : []),
...messages.slice(binding.taskIndex).flatMap(message => (message?.role === 'user' && Array.isArray(message.webbrainTaskClarifications)
? message.webbrainTaskClarifications : [])
.filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => item?.answer)),
].map(normalize).filter(Boolean);
- const supplied = value => {
- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');
- // A plain word or phrase ("Email", "Your name") is named in requests
- // without being given; it counts only as a whole answer to a card.
- // A value with a digit or symbol ("[email protected]") counts where
- // the user wrote it as a whole.
- const specific = /[^\p{L}\s]/u.test(value);
- return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));
- };
- return fields.filter(field => !supplied(normalize(field.value)));
+ return fields.filter(field => !answers.includes(normalize(field.value)));
}
// A value WebBrain typed into a field that equals the field's own
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 9f2984380..04998639b 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -45716,14 +45716,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
}
// The edited fields of a submission that hold their own placeholder text
- // when the user did not supply that value for the current task: the
- // page's example typed in as the user's. A field counts as edited when
- // the probe saw it differ from its default or WebBrain's own write put
- // that value into that same field in this run (a framework may copy a
- // typed value into defaultValue). The probe's complete list is read when
- // it sent one; the summary's changed fields stop at eight. A placeholder
- // without a letter, or shorter than three characters (a "1" in a quantity
- // box), is not an example of this kind.
+ // when the user did not give that value as an answer on one of the
+ // current task's cards: the page's example typed in as the user's. A
+ // field counts as edited when the probe saw it differ from its default or
+ // WebBrain's own write put that value into that same field in this run (a
+ // framework may copy a typed value into defaultValue). The probe's
+ // complete list is read when it sent one; the summary's changed fields
+ // stop at eight. A placeholder without a letter, or shorter than three
+ // characters (a "1" in a quantity box), is not an example of this kind.
_placeholderValueFields(tabId, submitInfo) {
const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();
const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields
@@ -45734,33 +45734,20 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& (field?.changed === true || this._placeholderWritten(tabId, field, value));
});
if (!fields.length) return [];
- // Only the active task's own words and the user's answers to its cards
- // can supply a value; an earlier, unrelated turn cannot.
+ // Only a whole answer the user gave on one of the active task's cards
+ // supplies such a value. The words of a request are not read for it:
+ // whether a mention gives the value or refuses it ("do not use
+ // [email protected]") is not something a text match can tell, in any
+ // language, so the model asks and the answer decides.
const messages = this.conversations.get(tabId) || [];
const binding = this._activeTaskBinding(messages);
- const taskMessages = binding.taskIndex < 0 ? []
- : (binding.pinnedIndices || []).map(index => messages[index])
- .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));
- const requests = binding.taskIndex < 0 ? [] : [binding.requestText,
- ...(Array.isArray(binding.updates) ? binding.updates.map(update => update?.text) : []),
- ...taskMessages.map(message => this._plannerUserAuthoredText(message))].map(normalize).filter(Boolean);
const answers = binding.taskIndex < 0 ? [] : [
...(Array.isArray(binding.answers) ? binding.answers : []),
...messages.slice(binding.taskIndex).flatMap(message => (message?.role === 'user' && Array.isArray(message.webbrainTaskClarifications)
? message.webbrainTaskClarifications : [])
.filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => item?.answer)),
].map(normalize).filter(Boolean);
- const supplied = value => {
- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');
- // A plain word or phrase ("Email", "Your name") is named in requests
- // without being given; it counts only as a whole answer to a card.
- // A value with a digit or symbol ("[email protected]") counts where
- // the user wrote it as a whole.
- const specific = /[^\p{L}\s]/u.test(value);
- return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));
- };
- return fields.filter(field => !supplied(normalize(field.value)));
+ return fields.filter(field => !answers.includes(normalize(field.value)));
}
// A value WebBrain typed into a field that equals the field's own
diff --git a/test/run.js b/test/run.js
index dfdc8de4a..713405ad0 100644
--- a/test/run.js
+++ b/test/run.js
@@ -82732,13 +82732,17 @@ test('a field holding its own placeholder text is not submitted', async () => {
completeList = null;
field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: true };
- // A value the user gave, in a message or in a card answer, asks as usual.
+ // Words in a request do not supply the value, whether they give it or
+ // refuse it; a whole answer on one of the task's cards does.
agent.conversations.set(tabId, [...task, { role: 'user', content: 'Use [email protected] for it.' }]);
- await submit('user-message');
- assert.equal(prompts, 2, `${AgentClass.name}: a value from the user's message was refused`);
+ assert.equal((await submit('user-message')).placeholderValue, true, `${AgentClass.name}: a request's words supplied the value`);
+ agent.conversations.set(tabId, [...task, { role: 'user', content: 'Do not use [email protected]; use another address.' }]);
+ assert.equal((await submit('refused-in-request')).placeholderValue, true, `${AgentClass.name}: a refused value was submitted`);
agent.conversations.set(tabId, [system, { ...task[1], webbrainTaskClarifications: [{ question: 'Which email?', answer: '[email protected]', source: 'text' }] }]);
await submit('user-answer');
- assert.equal(prompts, 3, `${AgentClass.name}: a value from the user's card answer was refused`);
+ assert.equal(prompts, 2, `${AgentClass.name}: a value from the user's card answer was refused`);
+ agent.conversations.set(tabId, [system, { ...task[1], webbrainTaskClarifications: [{ question: 'Which email?', answer: 'Not [email protected]', source: 'text' }] }]);
+ assert.equal((await submit('refused-in-answer')).placeholderValue, true, `${AgentClass.name}: an answer refusing the value supplied it`);
// Another value, a page default WebBrain did not change, and a placeholder
// that is only a number ask as usual.
@@ -82749,17 +82753,17 @@ test('a field holding its own placeholder text is not submitted', async () => {
await submit('page-default');
field = { label: 'Quantity', placeholder: '1', value: '1', changed: true };
await submit('number');
- assert.equal(prompts, 6, `${AgentClass.name}: an ordinary value skipped its card`);
+ assert.equal(prompts, 5, `${AgentClass.name}: an ordinary value skipped its card`);
- // Naming a plain word in the request does not supply it as the value; a
- // whole card answer does.
+ // A plain word the request names is no answer either; a whole card
+ // answer is.
agent.conversations.set(tabId, [system, { role: 'user', content: 'Sign me up for email updates.' }]);
field = { label: 'Email', placeholder: 'Email', value: 'Email', changed: true };
assert.equal((await submit('named-word')).placeholderValue, true, `${AgentClass.name}: a word the request only named exempted the field`);
agent.conversations.set(tabId, [system, { role: 'user', content: 'Sign me up for email updates.',
webbrainTaskClarifications: [{ question: 'What should the email field say?', answer: 'Email', source: 'text' }] }]);
await submit('answered-word');
- assert.equal(prompts, 7, `${AgentClass.name}: a whole card answer was refused`);
+ assert.equal(prompts, 6, `${AgentClass.name}: a whole card answer was refused`);
// A framework can copy the typed value into the field's default, so the
// probe sees no edit; WebBrain's own write in this run still counts.
@@ -82773,11 +82777,11 @@ test('a field holding its own placeholder text is not submitted', async () => {
// placeholder, holding it as its page default, is not one WebBrain wrote.
field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false, ref: 'ref_202', name: 'email', id: '' };
await submit('other-field');
- assert.equal(prompts, 8, `${AgentClass.name}: a write to one field counted for another`);
+ assert.equal(prompts, 7, `${AgentClass.name}: a write to one field counted for another`);
field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false, ref: 'ref_101', name: 'email', id: '' };
agent.currentRunId.set(tabId, 'next-run');
await submit('next-run');
- assert.equal(prompts, 9, `${AgentClass.name}: a write from another run still counted`);
+ assert.equal(prompts, 8, `${AgentClass.name}: a write from another run still counted`);
// An earlier, unrelated turn cannot supply the value for the current task.
field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: true };