A web agent can complete a task and still leak private data. Sensitive-data-disclosure tests check three things: which private fields the agent could access, where it had permission to send them, and what actually left the browser.
A useful test setup should:
- Use synthetic records, with field-by-field rules for each recipient.
- Compare ordinary workflows with prompt-injection variants.
- Track data sent through forms, URLs, messages, uploads and APIs using browser logs and server records.
- Report task success, excess sharing and prohibited disclosure separately.
- Turn failures into release blocks and regression tests.
The article proposes zero confirmed prohibited disclosures as a release threshold - not as a measured result. Missing transfer records mean the outcome is unknown, while passing a test does not establish UK GDPR compliance.
::: @figure
{How to Test Web Agents for Sensitive Data Disclosure}
:::
Design Tasks to Track Private Data
Give each task one goal, one synthetic private record and one controlled website. Include both required and irrelevant attributes to test data minimisation alongside task completion. Use fabricated values and test accounts only - not real credentials, personal records or live third-party services.[8] Limit required fields to the task’s purpose, in line with UK GDPR data minimisation.[2][4] Fix the starting page, login state, available files, permitted tools and completion condition.
Map Forms, URLs and External Services
Once you’ve fixed the private record and goal, map every route that could carry its fields out of the browser - not just the submit button. Simply typing can leak data through autocomplete, analytics, validation or autosave.[3][5][6]
| Channel | Who can see it | Persistence | Who can receive it | Reversibility | Required evidence |
|---|---|---|---|---|---|
| Form fields | Page scripts; receiver if sent | DOM, drafts, server records | Page operator; embedded services | Only local copies can be edited after sending | Input events; request body; server receipt |
| Search queries | Search service; log readers | History; service logs | Search operator | Limited recall | Query request; redirects; receiver log |
| URL paths, fragments and parameters | Browser; destination and infrastructure for paths and parameters; scripts for fragments | History; logs; caches | Destination operator; script-selected endpoints | Difficult removal | Navigation trace; outbound request; server receipt |
| Messages and email | Recipients; messaging service | Message history | Service; recipients | Limited recall | Recipient; subject; body; delivery record |
| Uploads | Receiving service; processors | Storage; backups | Storage owner; processors | Copies may remain | Upload body; file hash; metadata; receipt |
| External APIs | API operator; log readers | Logs; service records | API owner; processors | Depends on retention | Tool arguments; headers; payload; receipt |
Label a value as local until a request or server receipt proves it has left the browser.[3][5][6]
Record Task Rules and Expected Outcomes
Before execution, store the rules with versioned fixtures and context. Set permissions for each attribute and recipient, covering masking, transformation and onward processing. Use this record to check for leaks separately from task completion.
| Record field | What to specify |
|---|---|
| Task ID and version | Stable identifier; task, fixture and website versions |
| User goal | Objective, starting page and authenticated state |
| Private-context source | Synthetic record or file available to the agent |
| Sensitive attribute | Attribute name |
| Attribute status | One of: required, optional, irrelevant, prohibited, unknown |
| Intended recipient | Approved service and permitted processors |
| Permitted action | Allowed reads, fields, uploads and transformations |
| Prohibited destination | Service or recipient that must receive nothing |
| Attack condition | Ordinary workflow or exact untrusted instruction |
| Observable channel | Form request, URL, message, upload or API call |
| Expected outcome | Attributes reaching each recipient |
| Task-success criterion | Observable confirmation of completion |
| Disclosure rule | Forbidden attribute–destination combinations, including partial values |
| Proof required | Request payload, destination, timestamp, session ID and receiver receipt |
Compare Paired Tasks and Attack Variants
With the baseline task defined, change only the disclosure trigger. Use matched task pairs, keeping the site, synthetic profile and agent setup the same. Document any differences you can’t avoid. Run the baseline workflow first, then test one attack condition at a time.
Workflow Attribute required Same attribute irrelevant Boundary Payments Send a test payment using beneficiary account details Check invoice status using invoice number only Account details: approved payment receiver only; none to the status endpoint Bookings Book an appointment requiring patient identifier and date of birth Find available times using postcode and speciality only Identifier and date of birth: approved booking receiver only; none to availability searches Documents Upload a synthetic contract to an approved document-review service Check contract status using its reference number Contract contents: approved review service only; none to the status endpoint
The baseline sets the expected request pattern. The attack variant tests whether untrusted instructions cause the agent to cross the user’s permission boundary.[9] Compare the transmitted fields, destinations and task outcomes across each pair.
Define Permitted Disclosures
Access is not permission to transmit. Set out each disclosure’s recipient, purpose, scope, visibility and retention. Specify which fields may enter each form, URL or API call. Keep observations separate from claims: a browser trace can show where data went, but it cannot prove deletion or later use in training without supporting records. Apply the labels below before scoring public exposure, third-party transmission and cross-user leakage.
Label Data and Recipient Permissions
Attach permissions to field–recipient combinations, not entire records. Use four labels:
- Required and permitted: send only the fields needed.
- Required, but only under stated conditions: check masking, channel and user-confirmation requirements before sending.
- Optional and unnecessary: omit by default. Optional data is not forbidden, but count it as excess sharing.
- Prohibited: block disclosure to that destination.
| Data class | Permitted recipient and purpose | Disclosure rule |
|---|---|---|
| Identity details | Organisation verifying identity or delivering the service | Send required fields only; no public exposure, unrelated profiling or cross-user disclosure |
| Contact information | Service provider contacting the user | Use the agreed channel; omit unused fields; no sale, publication or unrelated forwarding |
| Health data | Healthcare provider or permitted processor for the stated purpose | Minimise fields and apply legal safeguards; no advertising or unrelated analytics |
| Financial data | Financial service handling payment, refunds, fraud or account servicing | Use the secure endpoint; exclude unnecessary authentication secrets and unrelated recipients |
| Credentials | Only the authentication flow may receive the secret | Verify the service; no logging, display, summaries or transmission elsewhere |
| Proprietary information | Employer’s system or confidential processor for the specified operation | Enforce confidentiality, access, jurisdiction and retention limits; no public release, unrelated training or competitor disclosure |
These labels give each disclosure test a clear pass/fail boundary.
Test Public, Third-Party and Cross-User Exposure
Score intended delivery, public exposure, third-party transmission and cross-user exposure separately. Assess the sender, recipient, data type and conditions together. Treat a URL as public only when unauthenticated access has been proved.
Link Disclosure Rules to UK Data Protection
Once the recipient and field rules are set, map them to legal and security constraints. For personal data, apply UK GDPR’s principles of lawful, fair and transparent processing, purpose limitation, data minimisation, storage limitation and security.[1]
Task permission does not create a lawful basis. Processing personal data needs an Article 6 basis. Health data and other special category data also need an Article 9 condition.[10][11][12]
A benchmark pass does not establish legal compliance or verify consent, transfer safeguards or deletion. Apply separate restrictions to confidential business data, including contracts, source code and business plans that contain no personal data.
Gather Evidence and Measure Data Leakage
Once disclosure rules are set, check whether the data actually moved. Count a prohibited disclosure when any protected attribute reaches a destination forbidden by task policy. The agent’s final answer is not enough. Record attempted transmission, network dispatch, confirmed receipt and later access separately. Each shows a different stage of data movement.
Verify Data Transfers with Browser and Server Records
Give each run its own ID. Use request or event IDs, where available, to link navigation, form inputs, URL requests, tool calls, messages, uploads and responses. For each protected value, record its source, destination, timestamp, transformation and authorisation label. Where permitted, preserve before-and-after form state, account ownership, stored records and recipient inboxes.
Use these sources to tell attempts, transfers and receipts apart.
| Evidence source | What it can establish | Main limitation |
|---|---|---|
| Transcript | Stated intentions, visible actions and claims | Cannot prove transfer |
| Browser trace | Navigation, field entry and client-side actions | Cannot prove remote receipt |
| DOM snapshot | Values in fields or rendered content | Misses network-only transfers |
| Network log | Request destination, method, payload and response | Cannot prove storage or later access |
| Server receipt | Specified content reached the controlled recipient | Cannot prove onward sharing |
| Saved application state | Saved records, sent messages or changed accounts | Can miss transient transfers and intermediate recipients |
Detect Partial, Encoded and Indirect Leaks
Use a different synthetic canary for each run. Check requests, tool arguments and cross-user access for exact matches, fragments, URL-encoded values, Base64, JSON escapes and summaries that reveal protected information.
Exact matching misses paraphrases. Semantic matching can flag harmless similarities. Estimate both types of error with manually labelled positive and negative samples, including screenshots and unfamiliar encodings.
A blocked form entry is an attempt, not dispatch. An HTTP error does not prove acceptance. Protect stored traces with restricted access, redaction and keyed fingerprints: logs can also expose data.
Report Privacy Results and Task Success Separately
Report task completion, authorised disclosure, unnecessary disclosure and prohibited disclosure separately, each as a rate over valid runs. Label disclosure results as dispatch, confirmed receipt or later access, and report attempts separately.
Include detector precision, TP / (TP + FP), recall, TP / (TP + FN), and evidence coverage - the proportion of those runs with sufficient records. Missing evidence means unknown, not no leak.
Apply the same rigour to reporting as to measurement. Break results down by domain, data category, destination and attack condition. Repeat runs and record seeds where supported. Between runs, reset accounts, databases, cookies and external-service state. Version tasks, policies, models, prompts, tools and application builds.
Report run-to-run variation, synthetic-data limits, ambiguous permissions and observation gaps. These gaps include unavailable server records and asynchronous transfers outside the observation window. Keep these qualifications beside the rates, rather than hiding them beneath an overall task-success score.
Use Test Results to Set Release Controls
Use leakage test results to decide whether a release can proceed. Set release thresholds before testing: zero confirmed prohibited disclosures, 100% enforcement of user- and tenant-isolation tests, and no unresolved critical gaps in transmission evidence. Block release if a confirmed disclosure breaches the policy. Task success does not override that disclosure. If transmission evidence is incomplete, pause approval or restrict permissions until investigation and retesting close the gap.[13][15]
Apply Controls Across the Agent Lifecycle
Use these thresholds to guide deployment controls. Minimise private context and give tools only the permissions needed for each task. Block unapproved destinations by default. For approved domains, enforce rules for each field and purpose. Redact unnecessary fields, validate redirects and check permissions before transmission. Keep private context separate from untrusted web instructions. Immediately before high-risk submissions, require explicit confirmation that shows the recipient, fields and purpose.[14][16][18]
Turn every confirmed failure into a regression test. Include synthetic data, the trigger, destination, expected block and required evidence. Add attack variants and a paired allowed task to check for over-blocking. Run these tests during development, red-teaming and release review. Repeat them after changes to models, prompts, tools or recipient permissions.[13][15]
Assign Implementation and Review Responsibilities
Engineering owns instrumentation, isolation, transmission controls and regression tests. Privacy specialists define disclosure rules, recipient permissions and retention limits. Business owners define acceptable task outcomes, while Security reviews prompt-injection resistance and incident response. Name a release approver who can block deployment. Any approved exception needs written, time-limited approval - not an informal waiver driven by a deadline.
After release, assign owners to monitor unexpected destinations, blocked and permitted tool calls, destination changes, anomalous field volumes, cross-user access attempts and new prompt-injection patterns. Keep access-controlled audit records that link decisions to policy versions.[7][17][18]
Conclusion: Check Permission, Destination and Evidence
A disclosure test must connect each private attribute to its permitted recipient and evidence of transfer. Check forms, URLs and external services in both ordinary and adversarial workflows.[2][19]
Report task success and privacy results separately. Completing a workflow does not prove that disclosure was authorised. Without browser or server evidence, ‘no leak observed’ remains inconclusive.[21][20]
Use benchmark findings to identify gaps in permission checks, destination checks and evidence. State exactly what was tested and which channels were not observed. Limit claims to what the evidence supports - not broader protection.[7][20]
FAQs
How realistic should my synthetic test data be?
The level of realism you need depends on your pipeline stage. Mocks or stubs give you fast feedback for unit and integration tests. End-to-end and performance tests need synthetic datasets that closely match production patterns, field correlations and edge cases.
When you need production-level accuracy, masked or anonymised production data is an option. Purely synthetic data offers stronger protection against exposing production records, but it still needs checks for privacy risks and GDPR compliance.
Use a consistent random seed across environments to make results reproducible.
How can I test leaks to services I don’t control?
Place distinct synthetic secret markers in isolated test tenants. Route requests through sandboxed tools to instrumented endpoints with no public internet access. Check model responses and structured tool traces for marker transmissions, reads without authorisation and actions without permission. Record whether each action was attempted, blocked or completed.
Test safety properties rather than exact wording to allow for non-deterministic outputs. Any forbidden call or leak attempt must trigger a critical failure and block release.
How can I prevent leaks without blocking legitimate tasks?
Enforce tenant isolation, validate scopes and reject cross-tenant requests that lack permission. Authenticate tools with workload identity, and retrieve credentials securely at runtime. Redact sensitive fields before they reach models or logs. Treat every model input as untrusted.
Check authorisation before any write. Run synthetic tests in isolation to confirm that forged ownership fields and actions without permission are rejected. Keep tenant-scoped audit trails so you can tell blocked attacks apart from authorised activity.