feat(browser): add URL whitelist configuration for browser navigation - #53653
Open
tkwkeven wants to merge 1 commit into
Open
feat(browser): add URL whitelist configuration for browser navigation#53653tkwkeven wants to merge 1 commit into
tkwkeven wants to merge 1 commit into
Conversation
Adds browser.url_whitelist config option to restrict browser navigation
to specific domains. When configured, only URLs matching the whitelist
patterns are allowed; all other URLs are blocked.
- Add check_url_whitelist() and _load_url_whitelist() in website_policy.py
- Integrate whitelist check into browser_navigate after existing blocklist
- Supports glob patterns like *.toutiao.com, example.com
- Cached with TTL matching existing blocklist cache
- Fail-open on config errors (consistent with blocklist behavior)
Config example:
browser:
url_whitelist:
- "*.toutiao.com"
- "*.douyin.com"
- "example.com"
Use case: multi-tenant deployments or automation workflows that should
only access specific domains.
Contributor
|
Thanks for adding an opt-in browser boundary. The allowlist idea is still needed on current main, but the submitted implementation does not yet provide the stated navigation restriction. Problems
Suggested changes
Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
browser.url_whitelistconfig option to restrict browser navigation to specific domains. When configured, only URLs matching the whitelist patterns are allowed; all other URLs are blocked.Changes
check_url_whitelist()and_load_url_whitelist()intools/website_policy.pybrowser_navigateintools/browser_tool.py(after existing blocklist check)*.toutiao.com,example.comConfig Example
Use Case
Multi-tenant deployments or automation workflows that should only access specific domains. Complements the existing website blocklist (deny specific) with a whitelist (allow only specific).
Testing
Unit tests for whitelist matching. Running in production for 2+ months.