Skip to content

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

Fingerprint appended text and disabled controls of a submission

Claude389751eb4dc1
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 7f7194f17..3d66ef543 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -33412,7 +33412,12 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
} catch { return []; }
})();
const valueOf = el => {
- if (el === pendingEl && pendingValue != null) return String(pendingValue);
+ // set_field({submit, clear:false}) appends to what the field holds.
+ if (el === pendingEl && pendingValue != null) {
+ const appended = toolName === 'set_field' && args?.clear === false;
+ const existing = el?.isContentEditable && !('value' in el) ? String(el.textContent || '') : String(el?.value ?? '');
+ return appended ? existing + String(pendingValue) : String(pendingValue);
+ }
const type = String(el?.type || '').toLowerCase();
if (type === 'checkbox' || type === 'radio') return `${el.checked ? 1 : 0}:${el.value ?? ''}`;
if (type === 'file') return Array.from(el.files || []).map(file => [file.name, file.size, file.lastModified, file.type].join(':')).join('|');
@@ -33425,8 +33430,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// named "action" cannot stand in for the form's.
const destination = ['formaction', 'formmethod', 'formenctype', 'formtarget']
.map(name => [submitter?.getAttribute?.(name) ?? null, form?.getAttribute?.(name.slice(4)) ?? null]);
+ // A disabled control (its own or its fieldset's) is not sent, so the
+ // state is part of what goes out.
+ const disabled = el => { try { return el?.matches?.(':disabled') === true; } catch { return false; } };
const sent = window.__wbSubmissionValueKey + JSON.stringify([destination, controls.map(el => [
- String(el?.getAttribute?.('name') || ''), String(el?.type || el?.tagName || ''), valueOf(el)])]);
+ String(el?.getAttribute?.('name') || ''), String(el?.type || el?.tagName || ''), disabled(el), valueOf(el)])]);
// cyrb53, a 53-bit string hash; the frame's key makes it opaque.
let h1 = 0xdeadbeef;
let h2 = 0x41c6ce57;
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 0d77da164..194b98acf 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -30316,7 +30316,12 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
} catch { return []; }
})();
const valueOf = el => {
- if (el === pendingEl && pendingValue != null) return String(pendingValue);
+ // set_field({submit, clear:false}) appends to what the field holds.
+ if (el === pendingEl && pendingValue != null) {
+ const appended = toolName === 'set_field' && args?.clear === false;
+ const existing = el?.isContentEditable && !('value' in el) ? String(el.textContent || '') : String(el?.value ?? '');
+ return appended ? existing + String(pendingValue) : String(pendingValue);
+ }
const type = String(el?.type || '').toLowerCase();
if (type === 'checkbox' || type === 'radio') return `${el.checked ? 1 : 0}:${el.value ?? ''}`;
if (type === 'file') return Array.from(el.files || []).map(file => [file.name, file.size, file.lastModified, file.type].join(':')).join('|');
@@ -30329,8 +30334,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// named "action" cannot stand in for the form's.
const destination = ['formaction', 'formmethod', 'formenctype', 'formtarget']
.map(name => [submitter?.getAttribute?.(name) ?? null, form?.getAttribute?.(name.slice(4)) ?? null]);
+ // A disabled control (its own or its fieldset's) is not sent, so the
+ // state is part of what goes out.
+ const disabled = el => { try { return el?.matches?.(':disabled') === true; } catch { return false; } };
const sent = window.__wbSubmissionValueKey + JSON.stringify([destination, controls.map(el => [
- String(el?.getAttribute?.('name') || ''), String(el?.type || el?.tagName || ''), valueOf(el)])]);
+ String(el?.getAttribute?.('name') || ''), String(el?.type || el?.tagName || ''), disabled(el), valueOf(el)])]);
// cyrb53, a 53-bit string hash; the frame's key makes it opaque.
let h1 = 0xdeadbeef;
let h2 = 0x41c6ce57;
diff --git a/test/declined-submission-identity.mjs b/test/declined-submission-identity.mjs
index 320a62805..d8b17fd41 100644
--- a/test/declined-submission-identity.mjs
+++ b/test/declined-submission-identity.mjs
@@ -81,6 +81,23 @@ for (const build of ['chrome', 'firefox']) {
assert.notEqual((await probe('click', { selector: '#go' })).submissionIdentity, previous, `a new ${name}`);
}
});
+
+ await t.test('an append-mode set_field and a disabled field change what goes out', async () => {
+ await page.setContent('<form method="post" action="/notes">'
+ + '<input id="note" name="note" aria-label="Note" value="first"><input id="extra" name="extra" aria-label="Extra" value="kept">'
+ + '<button id="go">Save</button></form>');
+ await page.evaluate(() => { window.__wb_ax_lookup = ref => (ref === 'ref_note' ? document.querySelector('#note') : null); });
+ const submit = args => probe('set_field', { ref_id: 'ref_note', text: ' more', submit: true, ...args });
+ const appendFirst = (await submit({ clear: false })).submissionIdentity;
+ const replaceFirst = (await submit({})).submissionIdentity;
+ await page.evaluate(() => { document.querySelector('#note').value = 'second'; });
+ assert.notEqual((await submit({ clear: false })).submissionIdentity, appendFirst, 'appending to other text sends other text');
+ assert.equal((await submit({})).submissionIdentity, replaceFirst, 'replacing the text sends the same text');
+ // A field the page disables is no longer sent.
+ const enabled = (await probe('click', { selector: '#go' })).submissionIdentity;
+ await page.evaluate(() => { document.querySelector('#extra').disabled = true; });
+ assert.notEqual((await probe('click', { selector: '#go' })).submissionIdentity, enabled, 'a disabled field');
+ });
} finally {
await browser.close();
}