Commit Graph
9542 Commits
Author SHA1 Message Date
Lucien Coffe 7f5abfc9cf fix: use dashes in CLI flag names for consistency
Rename --block_private_networks to --block-private-networks and
--block_cidrs to --block-cidrs to match the existing flag naming
convention (e.g. --http-proxy, --proxy-bearer-token).
2026-04-08 12:10:46 +02:00
Lucien Coffe fb6c4e4978 feat: add allow-list exclusions to --block_cidrs
CIDRs prefixed with '-' are treated as allow rules that exempt matching
IPs from blocking. Allow rules take precedence over both
--block_private_networks and custom block CIDRs.

Example: --block_private_networks --block_cidrs -10.0.0.42/32
blocks all private ranges except 10.0.0.42.

Adds 3 new tests for allow-list behavior.
2026-04-08 12:10:46 +02:00
Lucien Coffe f5cfc4d315 feat: add --block_private_networks and --block_cidrs CLI flags
Block outbound HTTP requests to specified IP ranges before TCP handshake
using libcurl CURLOPT_OPENSOCKETFUNCTION callback. Fires after DNS
resolution, reads resolved IP directly from sockaddr, does bitwise CIDR
comparison. Fail-closed: unknown address families are blocked.

--block_private_networks blocks RFC1918, localhost, link-local, ULA.
--block_cidrs blocks additional comma-separated CIDRs.
IPv4-mapped IPv6 (::ffff:x.x.x.x) is unwrapped to prevent bypass.
2026-04-08 12:10:42 +02:00
Pierre Tachoire 16685019d4 Merge pull request #2107 from lightpanda-io/bump-v8
update zig-v8 deps
2026-04-08 12:10:15 +02:00
Adrià Arrufat 0aa96bff79 config: remove --no-record agent argument 2026-04-08 11:55:58 +02:00
Pierre Tachoire cffb6976a4 update zig-v8 deps 2026-04-08 11:41:08 +02:00
Adrià Arrufat 3cc46f10e2 agent: remove unused allocator from findNodeIdByText 2026-04-08 11:00:00 +02:00
Adrià Arrufat 91264c4995 agent: use zenai.provider.Client directly 2026-04-08 10:34:34 +02:00
Adrià Arrufat a147f91acc agent: add explicit type to url variable 2026-04-08 08:37:52 +02:00
Adrià Arrufat bfe223c8ad agent: simplify client init and tool execution 2026-04-08 08:33:08 +02:00
Adrià Arrufat 1aca921327 agent: use Command union for recording 2026-04-08 08:20:06 +02:00
Adrià Arrufat 3b78f429b2 Merge branch 'main' into agent 2026-04-08 06:36:17 +02:00
Pierre Tachoire 1a285cc9ea Merge pull request #2099 from lightpanda-io/finalizer_order
Clear identity before forcing finalizers
2026-04-07 18:09:31 +02:00
Karl Seguin def713db15 Clear identity before forcing finalizers
We need to remove v8 finalizer callbacks upfront so that, as we tear things down
there's no chance for v8 to try to finalize something which has already been
finalized or is gone.
2026-04-07 21:51:38 +08:00
Adrià Arrufat 1650702e39 Merge branch 'main' into agent 2026-04-07 14:46:22 +02:00
Adrià Arrufat 67918f004b Merge pull request #2097 from lightpanda-io/simplify-cli-args
Config: remove mcp version flag and simplify usage
2026-04-07 14:41:56 +02:00
Adrià Arrufat afd6c11b34 Config: remove mcp version flag and simplify usage 2026-04-07 12:24:19 +02:00
Adrià Arrufat a344f280d7 Config: remove redundant no_record field 2026-04-07 12:06:59 +02:00
Adrià Arrufat c6e9825e14 Merge branch 'main' into agent 2026-04-07 12:03:48 +02:00
Adrià Arrufat 7083e54aab browser: pass node registry to tools and reset on navigation 2026-04-07 11:27:45 +02:00
Adrià Arrufat fa14b0865c agent: use runTools for tool execution loop 2026-04-07 10:13:43 +02:00
Karl Seguin 38e3b59ddb Merge pull request #2095 from lightpanda-io/fix_mo_record_release
Don't release pending MutationObserver records
2026-04-07 15:46:00 +08:00
Pierre Tachoire 8b8c659507 Merge pull request #2094 from lightpanda-io/readme-docker
README: expose browser on localhost w/ docker
2026-04-07 09:27:33 +02:00
Karl Seguin 6491ab84ea Don't release pending MutationObserver records
These have not been handed to v8 yet (hence the pending) and can be freed
directly. This is correctly handled in IntersectionObserver.
2026-04-07 15:23:30 +08:00
Pierre Tachoire 3b3917321b Merge pull request #2062 from lightpanda-io/xhr-timeout
Add XMLHttpRequest.timeout with curl enforcement
2026-04-07 09:21:31 +02:00
Pierre Tachoire 65151e9a4c README: expose browser on localhost w/ docker 2026-04-07 09:19:57 +02:00
Adrià Arrufat adabc24897 agent: add ollama provider and base-url support 2026-04-07 08:55:33 +02:00
Karl Seguin cfcd633ff6 Merge pull request #2093 from lightpanda-io/event_manager_base
Extract non-DOM event dispatchig
2026-04-07 14:52:49 +08:00
Pierre Tachoire 8781d7e73b Add XMLHttpRequest.timeout with curl enforcement
Implement the XHR timeout property end-to-end: the JS-visible
getter/setter stores the value, send() passes it to the HTTP client,
and curl enforces it via CURLOPT_TIMEOUT_MS. On timeout, a `timeout`
event is dispatched instead of `error`, per the XHR spec.
2026-04-07 08:47:10 +02:00
Adrià Arrufat 3fde7fb6b5 Config: remove --api-key CLI flag 2026-04-07 08:34:15 +02:00
Adrià Arrufat e6228cafaf Config: simplify common options access 2026-04-07 08:14:14 +02:00
Adrià Arrufat 048cb46950 Refactor: extract shared tool execution layer from MCP and agent
Both MCP tools.zig and agent ToolExecutor.zig duplicated the same 20 tool
handlers. This extracts the shared logic into src/browser/tools.zig so new
tools only need to be added once. Reduces total code by ~620 lines while
keeping all 465 tests passing.
2026-04-07 08:05:36 +02:00
Adrià Arrufat 9a442ac5f1 agent: add new browser interaction tools
Adds hover, press, selectOption, setChecked, and findElement tools.
Increases backendNodeId search window in CommandExecutor to 500.
2026-04-07 07:46:40 +02:00
Adrià Arrufat b5b8e79899 Config: support agent mode in wsMaxConcurrent 2026-04-07 07:32:47 +02:00
Karl Seguin de52c13379 Extract non-DOM event dispatchig
This is standalone work that can be done to enable workers. Workers need a
subset of EventManager, specifically, dispatching events for non DOM objects.
This commit extracts the non-DOM dispatching into an EventManagerBase which
EventManager uses (via composition) and which, in the future, WorkerGlobalScope
will be able to use directly.
2026-04-07 13:03:22 +08:00
Adrià Arrufat f7a4f1345f Merge branch 'main' into agent 2026-04-07 06:49:56 +02:00
Karl Seguin f28a753e1d Merge pull request #2091 from NYCU-Chung/fix/cookie-public-suffix
fix(cookie): reject Set-Cookie domains that are public suffixes
2026-04-07 11:34:30 +08:00
Karl Seguin 8f1e3941ce Merge pull request #2063 from lightpanda-io/websocket
WebSocket WebAPI
2026-04-07 08:55:02 +08:00
Karl Seguin b98eb1292d Merge pull request #2085 from tmchow/feat/2082-handle-javascript-dialog
feat: emit Page.javascriptDialogOpening CDP events for JS dialogs
2026-04-07 08:54:36 +08:00
Karl Seguin 60c2ba22d4 Merge pull request #2086 from lightpanda-io/child_node_node_list_arena
Move the NodeList created from a ChildNode to the ChildNode's arena
2026-04-07 08:44:21 +08:00
Karl Seguin 583525e5ee Merge pull request #2090 from lightpanda-io/rc_assertion
add assertion on RC (to catch release overflow)
2026-04-07 08:38:02 +08:00
Karl Seguin de8a5eeec1 zig fmt 2026-04-07 07:28:31 +08:00
Karl Seguin 36d3be5534 add assertion on RC (to catch release overflow) 2026-04-07 07:28:31 +08:00
Karl Seguin 12cb3eac07 Merge pull request #2092 from lightpanda-io/cdp_keyboard_event_lifetime
Don't release un-acquired reference on CDP input event.
2026-04-07 07:12:07 +08:00
Trevin Chow 7208934bda fix: return CDP error from handleJavaScriptDialog instead of silent no-op
Dialogs auto-dismiss in headless mode, so there is no pending dialog
by the time the CDP client sends Page.handleJavaScriptDialog. Return
an explicit error so the client knows the action had no effect.
2026-04-06 11:08:27 -07:00
Karl Seguin f813d34897 Don't release un-acquired reference on CDP input event. 2026-04-06 23:06:03 +08:00
Karl Seguin 8489ec380b Merge pull request #2087 from lightpanda-io/invalid_datetime
protect against index out of bound on invalid datetime
2026-04-06 21:50:41 +08:00
Karl Seguin 8568dc1285 Merge pull request #2088 from lightpanda-io/domainless_cookies
Better handling of cookies with empty domains
2026-04-06 21:50:21 +08:00
NYCU-Chung d917728053 fix(cookie): reject Set-Cookie domains that are public suffixes
parseDomain() rejects bare TLDs (e.g. Domain=.io) but accepts
multi-level public suffixes like .co.uk, .com.au, .co.jp.

Per RFC 6265bis §5.7.3.10, user agents should reject cookies whose
domain attribute is a public suffix. Chrome, Firefox, and Safari all
enforce this using the Public Suffix List.

The PSL data is already imported (Cookie.zig:26) and used in
findSecondLevelDomain(), but parseDomain() does not consult it.

This causes behavior differences vs Chrome when automating .co.uk /
.com.au / .co.jp sites via CDP — cookies that Chrome silently drops
are accepted by Lightpanda, polluting the cookie jar across unrelated
sites in the same session.
2026-04-06 20:39:56 +08:00
Karl Seguin c4fd37127e Better handling of cookies with empty domains 2026-04-06 16:56:09 +08:00