mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
* Add http_credentials to browser context. * Detect index change caused by page change in `multi_act` * Fix: Add sameSite cookie validation and auto-correction * added drag drop action * added drag drop action * pre-commit run -a (again) * added active_tab state management * add anthropic RateLimitError to list of defined rate limit errors * Add Retry handling to bedrock example * fix pydantic issue causing config to be overwritten * fix config setup * Add botocore, organize imports * ignore langchain beta warnings * silence pydantic deprecation warnings * Update bedrock_claude for ruff * ruff checks * Update pyproject.toml and bedrock_claude.py * ignore signal registration errors in edge case environments * ruff fixes * add example of getting 2FA code from 1password * add rebrowser and creepjs to stealth tests * Fix typos discovered by codespell * uv add --dev codespell * Update browser_use/browser/context.py * lint * Add explanations override_system_message and extend_system_message * Update custom-functions.mdx .get_current_page() is an async function which have to be awaited. * Fix: Remove unnecessary await from _verified_api_keys * Fix: Correct indentation for cookie loading log message in BrowserContext * Fix: resolve undefined response variable in Deepseek model raw tool calling mode * fix: increment consecutive_failure on every step error * Fix azure example not working due to agent memory changes * dont expose debug port on all addresses and keep security enabled by default * custom browser addition --------- Co-authored-by: Bartlomiej Wietrak <bartekwietrak@gmail.com> Co-authored-by: Alin Jiang <alineveryday@outlook.com> Co-authored-by: dipfocus <dipfocus@gmail.com> Co-authored-by: PaperBoardOfficial <hiremohitforsoftwarerole@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: Alezander9 <alexander.j.yue@gmail.com> Co-authored-by: dheerajoruganty <db2winfb@gmail.com> Co-authored-by: Nick Sweeting <git@sweeting.me> Co-authored-by: Dheeraj Oruganty <53569374+dheerajoruganty@users.noreply.github.com> Co-authored-by: Bart <46058081+b0rgcube@users.noreply.github.com> Co-authored-by: Nick Sweeting <github@sweeting.me> Co-authored-by: pppp606 <ppppp303@gmail.com> Co-authored-by: Oswy <74738120+oswy-cpu@users.noreply.github.com> Co-authored-by: BurnyCoder <happymancz@email.cz> Co-authored-by: zhushijie <mr.zhushijie@gmail.com> Co-authored-by: john-rtr <jonathan.ratier@gmail.com> Co-authored-by: mathisarends-viadee <mathis.arends@viadee.de> Co-authored-by: lorenss-m <saeclmusic@gmail.com> Co-authored-by: Magnus Müller <67061560+MagMueller@users.noreply.github.com>
51 lines
1.7 KiB
Plaintext
51 lines
1.7 KiB
Plaintext
---
|
|
title: "Sensitive Data"
|
|
description: "Handle sensitive information securely by preventing the model from seeing actual passwords."
|
|
icon: "shield"
|
|
---
|
|
|
|
## Handling Sensitive Data
|
|
|
|
When working with sensitive information like passwords, you can use the `sensitive_data` parameter to prevent the model from seeing the actual values while still allowing it to reference them in its actions.
|
|
|
|
Here's an example of how to use sensitive data:
|
|
|
|
```python
|
|
from dotenv import load_dotenv
|
|
from langchain_openai import ChatOpenAI
|
|
from browser_use import Agent
|
|
|
|
load_dotenv()
|
|
|
|
# Initialize the model
|
|
llm = ChatOpenAI(
|
|
model='gpt-4o',
|
|
temperature=0.0,
|
|
)
|
|
|
|
# Define sensitive data
|
|
# The model will only see the keys (x_name, x_password) but never the actual values
|
|
sensitive_data = {'x_name': 'magnus', 'x_password': '12345678'}
|
|
|
|
# Use the placeholder names in your task description
|
|
task = 'go to x.com and login with x_name and x_password then write a post about the meaning of life'
|
|
|
|
# Pass the sensitive data to the agent
|
|
agent = Agent(task=task, llm=llm, sensitive_data=sensitive_data)
|
|
|
|
async def main():
|
|
await agent.run()
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|
|
```
|
|
|
|
In this example:
|
|
1. The model only sees `x_name` and `x_password` as placeholders.
|
|
2. When the model wants to use your password it outputs x_password - and we replace it with the actual value.
|
|
3. When your password is visible on the current page, we replace it in the LLM input - so that the model never has it in its state.
|
|
|
|
Warning: Vision models still see the image of the page - where the sensitive data might be visible.
|
|
|
|
This approach ensures that sensitive information remains secure while still allowing the agent to perform tasks that require authentication.
|