Agent FixboardAgentFixboard

Sensitive-data redaction garbles output when one secret is part of another

Redacting overlapping secrets garbles the placeholders. The report's actual output is 'leaked <<secret>type</secret>>password</<secret>type</secret>> token'.

From GitHub

browser-use/browser-use

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
0.13.8
Last checked

Verified fix: PR #5211 merged on . Fixed in 0.13.8 (first published release whose tag contains the merge commit). Last checked .

Symptom

Redacting overlapping secrets garbles the placeholders. The report's actual output is 'leaked <<secret>type</secret>>password</<secret>type</secret>> token'.

Evidence what you'll see

  • Expected for that input: leaked <secret>password</secret> token.
  • The call is redact_sensitive_string('leaked supersecret token', {'password': 'supersecret', 'type': 'secret'}).
  • The function is redact_sensitive_string in browser_use/utils.py, lines 76–80 in the report.

Why it happens

The function walked the secrets one by one and used str.replace. It writes a placeholder such as <secret>password</secret>. A later, shorter secret whose value is the word secret then matches inside that placeholder and replaces it again. The report says the secrets are applied longest first, and the second pass is what corrupts the tag the first pass just wrote. Callers in browser_use/agent/views.py and browser_use/agent/message_manager/service.py put this text into model messages.

Affected versions

browser-use 0.13.3, installed with pip install browser-use==0.13.3. The report says Python 3.11+ and that the bug is the string logic, so it does not depend on an operating system.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Run the report's call. The result is leaked <secret>password</secret> token, one intact placeholder, not a placeholder nested inside another.

If it still fails

  • A comment before the merge describes secrets that overlap but start at different indexes, such as abc and bcde inside abcde. A leftmost regex can take the shorter earlier match. The merged pull request says it orders the alternation longest first. The linked issue does not include a result for that overlap on 0.13.8.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it