Skip to content

Commit 948b72e

Browse files
j-mendezclaude
andcommitted
feat(agent): action handler hardening — duration caps, JS escape, timeout guards
- Cap LLM-controlled durations: Wait/ClickHold ≤30s, SetViewport ≤8K, OpenPage ≤20 URLs - Add js_escape() for safe querySelector/KeyboardEvent interpolation (defense in depth) - Replace raw page.evaluate() with eval_with_timeout in Fill/Type/Clear actions - Check Fill type_str result instead of swallowing errors - WaitForNavigation: use PageWaitStrategy::Load instead of fixed sleep(1000ms) - Navigate: wrap page.goto() with 30s timeout to prevent indefinite blocking - Screenshot: wrap page.screenshot() with 15s timeout in both capture methods - Semaphore: replace .ok() with match + log::warn on closed semaphore (5 sites) - Log level: upgrade extraction/fetch/synthesis failure logs from debug to warn chore(release): 2.45.28 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e88e2b9 commit 948b72e

File tree

11 files changed

+520
-90
lines changed

11 files changed

+520
-90
lines changed

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spider/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spider"
3-
version = "2.45.27"
3+
version = "2.45.28"
44
authors = ["j-mendez <jeff@spider.cloud>"]
55
description = "A web crawler and scraper, building blocks for data curation workloads."
66
repository = "https://github.com/spider-rs/spider"
@@ -120,11 +120,11 @@ features = ["serde", "headers", "dynamic-versions"]
120120

121121
[dependencies.spider_agent_types]
122122
path = "../spider_agent_types"
123-
version = "2.45.27"
123+
version = "2.45.28"
124124

125125
[dependencies.spider_agent]
126126
path = "../spider_agent"
127-
version = "2.45.27"
127+
version = "2.45.28"
128128
optional = true
129129
default-features = false
130130

spider_agent/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spider_agent"
3-
version = "2.45.27"
3+
version = "2.45.28"
44
authors = ["j-mendez <jeff@spider.cloud>"]
55
description = "A concurrent-safe multimodal agent for web automation and research."
66
repository = "https://github.com/spider-rs/spider"
@@ -28,8 +28,8 @@ parking_lot = "0.12"
2828
base64 = "0.22"
2929

3030
# Extracted types and HTML processing
31-
spider_agent_types = { version = "2.45.27", path = "../spider_agent_types" }
32-
spider_agent_html = { version = "2.45.27", path = "../spider_agent_html" }
31+
spider_agent_types = { version = "2.45.28", path = "../spider_agent_types" }
32+
spider_agent_html = { version = "2.45.28", path = "../spider_agent_html" }
3333

3434
# HTML processing (still needed for engine internals)
3535
lol_html = "2"

spider_agent/src/agent.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,12 @@ impl Agent {
302302
});
303303
}
304304
Err(e) => {
305-
log::debug!("Extraction failed for {}: {}", result.url, e);
305+
log::warn!("Extraction failed for {}: {}", result.url, e);
306306
}
307307
}
308308
}
309309
Err(e) => {
310-
log::debug!("Fetch failed for {}: {}", result.url, e);
310+
log::warn!("Fetch failed for {}: {}", result.url, e);
311311
}
312312
}
313313
}
@@ -320,7 +320,7 @@ impl Agent {
320320
Some(summary)
321321
}
322322
Err(e) => {
323-
log::debug!("Synthesis failed: {}", e);
323+
log::warn!("Synthesis failed: {}", e);
324324
None
325325
}
326326
}
@@ -1249,4 +1249,5 @@ mod tests {
12491249
assert!(tools.contains(&"spider_cloud_ai_browser".to_string()));
12501250
assert!(tools.contains(&"spider_cloud_ai_links".to_string()));
12511251
}
1252+
12521253
}

0 commit comments

Comments
 (0)