// CONTENTS Part 09 · Security

// PART 09

Browser policy and upload validation

Chapter 39 / 60 2 min read English Part 09 of 15

Two attack surfaces get their own control plane: what the agent browser may do, and what an uploaded file may expand into. Both are enforced server-side.

Browser policy and budgets

Agentic browsing is controlled by the botbrowserpolicy crate (Cargo feature browser-policy). The crate does not drive a browser. It is a control plane: an external driver service reports each completed step, and the crate decides whether that step may be recorded, charges it against a budget, and persists what the page said.

Task lifecycle: POST /api/browser/tasks → queued; pause/resume/cancel transition states; advance records one step (only while running); finish stores result + citations; GET …/:id/events is an SSE stream. A policy or budget violation during advance marks the task failed and stores the reason.

Policy document

The per-task policy is embedded in the task’s plan JSONB under key policy; absent fields fall back to defaults:

Field Default Meaning
allowed_domains [] empty means “allow everything not denied”; otherwise exact host or dot-suffix subdomain
denied_domains [] always wins over the allow list
max_steps 60 step cap for the task
max_cost_units 10_000 cost cap, in milli-units as reported by the driver
allow_credential_pages false disables the credential-phishing guard

Only http and https are accepted; file://, javascript:, ftp:// and malformed URLs are rejected. The credential guard is deliberately narrow: for checkout tasks, any URL containing the substring login is refused unless allow_credential_pages is set — simple over-blocking, accepted as the cost of a simple rule; it is not a phishing detector.

Enforcement and known gaps

Everything is enforced server-side inside advance_task, before the step is appended. Documented gaps: the global policy document is stored but not applied (only the per-task policy is enforced); task ownership is not checked on pause/resume/cancel/advance/finish (any authenticated user who knows a UUID can act on that task); the task’s domains column is informational; there is no pricing (cost caps depend on driver-reported cost_milli).

Upload validation

Control Value
Single file cap 100 MiB (MAX_FILE_SIZE_BYTES)
Upload cap 50 MiB (MAX_UPLOAD_SIZE_BYTES)
Request body cap 10 MiB (MAX_REQUEST_BODY_BYTES)
Knowledge-base document cap 50 MiB (MAX_KB_DOCUMENT_SIZE_BYTES); 100,000 documents per bot
Indexer floor files above 10 MiB are skipped for indexing; unsupported types are skipped, not truncated

Large office documents are admitted by a cgroup-aware guard before parsing (OOXML expands on the request path): a per-class upload cap, a peak-heap budget derived from the cgroup ceiling (three eighths, 32 MiB floor), and RAII permits per class. Refusals are typed: 413 office_payload_too_large, 507 office_memory_budget_exceeded, 429 office_busy (with Retry-After: 1). The response body carries only error, i18n_key, message, class and size fields — no document name, text or tenant id.

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move