Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(browser): let Allow all open any public site in the browser

Shanu3a55dbbbacbe
diff --git a/crates/openhuman-core/src/modules/README.md b/crates/openhuman-core/src/modules/README.md
index 0ddd507320..f9224d9b74 100644
--- a/crates/openhuman-core/src/modules/README.md
+++ b/crates/openhuman-core/src/modules/README.md
@@ -216,7 +216,7 @@ download, its `dlopen`, or its resident memory.
| [`desktop.rs`](desktop.rs) | `tinycomputer` | The shared proxy for TinyComputer: loads it with an 8 second bound, reinitializes it when its configuration fingerprint changes, and exposes `call`, `permissions`, `state`, `jev_ready`. |
| [`computer_config.rs`](computer_config.rs) | `tinycomputer` | The private configuration: `jev` (decision model), `planner` (planner, rescue and output models), `browser` (Chrome path), `trace_path`. Rebuilt from `[computer]` and stored credentials on every call; `OPENHUMAN_COMPUTER_TRACE` turns tracing on. |
| [`computer.rs`](computer.rs) | `tinycomputer` | `status` for the Computer settings page: lifecycle state, configured routes, and optionally what the module reports through `Describe`. |
-| [`browser.rs`](browser.rs) | `tinycomputer` | `BrowserClient` for the `Browser*` members, over the desktop proxy, plus the shared website policy. |
+| [`browser.rs`](browser.rs) | `tinycomputer` | `BrowserClient` for the `Browser*` members, over the desktop proxy, plus the shared website policy: "Allow all" (the list's `*`) lets the browser open any public site, private and local addresses still refused. |
| [`browser_task.rs`](browser_task.rs) | `tinycomputer` | Browser tasks over `StartTask` / `AwaitTask` / `ContinueTask`: `start`, `wait`, `resume`, `cancel`, `report`. The host keeps the policy (surfaces, origins, action budget, approvals). |
| [`browser_task_report.rs`](browser_task_report.rs) | `tinycomputer` | What is kept when a task stops: a content-free log summary, and with tracing on the full report under `<workspace>/state/computer/tasks/`. |
| [`browser_sites.rs`](browser_sites.rs), [`browser_sites/store.rs`](browser_sites/store.rs) | `tinycomputer` | Per-site memory of plans and elements learned by finished tasks, in `<workspace>/state/computer/sites/<site>.json`, with 30-day expiry. Fed back on `StartTask`; never reaches the agent's memory or prompts. |
diff --git a/crates/openhuman-core/src/modules/browser.rs b/crates/openhuman-core/src/modules/browser.rs
index 3bc18bc3d3..125d23eb97 100644
--- a/crates/openhuman-core/src/modules/browser.rs
+++ b/crates/openhuman-core/src/modules/browser.rs
@@ -132,7 +132,7 @@ impl BrowserClient {
) -> Result<SessionInfo, BrowserCallError> {
self.ensure_ready().await?;
let domains = self.browser_domains();
- if domains.is_empty() && !browser_allow_all() {
+ if domains.is_empty() && !browser_allow_all() && !self.allows_any_site() {
return Err(BrowserCallError::Policy(
"allowed websites list is empty".into(),
));
@@ -321,6 +321,7 @@ impl BrowserClient {
)));
}
if !allow_all
+ && !self.allows_any_site()
&& !self.browser_domains().iter().any(|allowed| {
host.eq_ignore_ascii_case(allowed)
|| host
@@ -345,6 +346,18 @@ impl BrowserClient {
self.check_url(raw)
}
+ /// Whether the allowed websites are "Allow all" (`*`): the browser may
+ /// open any public site, as web fetch may. Private and local addresses
+ /// stay refused, here by `check_url` and in the module by its own `*`
+ /// rule. The browser itself is off until the user turns it on.
+ fn allows_any_site(&self) -> bool {
+ self.config
+ .http_request
+ .allowed_domains
+ .iter()
+ .any(|domain| domain.trim() == "*")
+ }
+
fn browser_domains(&self) -> Vec<String> {
self.config
.http_request
@@ -355,9 +368,11 @@ impl BrowserClient {
.collect()
}
- /// Origins a TinyComputer task may load: the allowed websites, in the
- /// module's `https://.host` spelling. Empty when none are allowed, which a
- /// task refuses, since an empty list means any origin to the module.
+ /// Origins a TinyComputer task may open pages on: `*` (any public site)
+ /// under "Allow all", else the allowed websites in the module's
+ /// `https://.host` spelling. Empty when none are allowed, which a task
+ /// refuses, since an empty list means any origin, private ones included,
+ /// to the module.
pub(crate) fn task_origins(&self) -> Vec<String> {
self.browser_origins()
}
@@ -372,6 +387,9 @@ impl BrowserClient {
// guard active before the caller supplies an explicit URL.
return vec!["https://.".to_owned()];
}
+ if self.allows_any_site() {
+ return vec!["*".to_owned()];
+ }
self.browser_domains()
.iter()
.map(|host| {
diff --git a/crates/openhuman-core/src/modules/browser_tests.rs b/crates/openhuman-core/src/modules/browser_tests.rs
index 60e98620d5..47674ee5ef 100644
--- a/crates/openhuman-core/src/modules/browser_tests.rs
+++ b/crates/openhuman-core/src/modules/browser_tests.rs
@@ -160,13 +160,51 @@ fn fresh_profile_is_the_default() {
}
#[test]
-fn shared_fetch_wildcard_does_not_open_browser_by_default() {
+fn allow_all_lets_the_browser_open_any_public_site() {
if browser_allow_all() {
return;
}
+ // "Allow all" is the shared list's `*`, as a fresh config has it; the
+ // browser itself stays off until the user turns it on.
let config = Config::default();
+ assert_eq!(config.http_request.allowed_domains, vec!["*".to_owned()]);
+ assert!(!config.browser.enabled);
let client = BrowserClient::new(Arc::new(config));
+ for url in [
+ "https://example.com/",
+ "https://www.makemytrip.com/flights/",
+ ] {
+ assert!(client.check_url(url).is_ok(), "{url}");
+ }
+ for url in [
+ "https://localhost/",
+ "https://192.168.1.1/",
+ "https://127.0.0.1/",
+ "http://example.com/",
+ ] {
+ assert!(client.check_url(url).is_err(), "{url}");
+ }
+ assert_eq!(client.task_origins(), vec!["*"]);
+
+ // A star beside named sites is still "Allow all".
+ let mut config = Config::default();
+ config.http_request.allowed_domains = vec!["selenium.dev".into(), "*".into()];
+ let client = BrowserClient::new(Arc::new(config));
+ assert!(client.check_url("https://example.com/").is_ok());
+ assert_eq!(client.task_origins(), vec!["*"]);
+}
+
+#[test]
+fn a_custom_list_still_keeps_the_browser_to_its_sites() {
+ if browser_allow_all() {
+ return;
+ }
+ let mut config = Config::default();
+ config.http_request.allowed_domains = vec!["oyorooms.com".into()];
+ let client = BrowserClient::new(Arc::new(config));
+ assert!(client.check_url("https://www.oyorooms.com/").is_ok());
assert!(client.check_url("https://example.com/").is_err());
+ assert_eq!(client.task_origins(), vec!["https://.oyorooms.com"]);
}
#[test]