A capability is one thing a plugin may do, written as a stable string such as
launch.args, cdp:Network or page.script:example.com. A plugin declares the
ones it needs in its metadata; a
PluginSet grants them and checks them against what
the host supports. Items are in seleniumbase_rs_plugin, defined in
capability.rs, host.rs and switch_policy.rs of
crates/seleniumbase-rs-plugin/src/.
For a native Rust plugin, capabilities are a declared contract, not a sandbox:
the plugin can still call std directly. This version checks the required
capabilities when the set is checked, and each change before_launch makes;
the request guard refuses Fetch.* and merges Network.setBlockedURLs. It
does not compare a plugin’s send, evaluate, add_init_script or packages
with what it declared (see Limits). Only
WebAssembly plugins are sandboxed.
Capability#
enum non_exhaustive seleniumbase_rs_plugin::Capability
One thing a plugin may do. Every variant has a string form (Display and
FromStr), a risk, and an enforcement. A
CapabilitySet keeps them sorted in the order of the variants above.
| Variant | String | Risk | WASM | Native |
|---|---|---|---|---|
LaunchArgs: add browser switches (the refused list applies) | launch.args | Low | yes | enforced |
LaunchPrefs: set browser preferences | launch.prefs | Medium | yes | enforced |
LaunchHeadless: change headless mode | launch.headless | Medium | yes | enforced |
LaunchNetwork: host rules, WebRTC policy, QUIC | launch.network | High | yes | enforced |
LaunchProxy: set the proxy | launch.proxy | High | yes | enforced |
LaunchExtensions: load extensions | launch.extensions | High | no | enforced |
LaunchProfile: use the profile folder | launch.profile | Medium | no | enforced |
PageScript(HostScope::Hosts(..)): scripts on these hosts | page.script:a.com,b.com | Low | yes | enforced |
PageScript(HostScope::Everywhere): scripts on every site | page.script:* | High | yes | enforced |
PageEvaluate: evaluate JavaScript in pages | page.evaluate | Medium | yes | enforced |
PageNavigate: navigate pages | page.navigate | Medium | yes | enforced |
Cdp(domain): use one DevTools domain | cdp:Network | Medium; Critical for Target and Browser | yes, unless Critical | enforced |
NetObserve: observe requests and responses | net.observe | Low | yes | enforced |
NetSensitive: see cookies and authorization headers | net.sensitive | High | yes | enforced |
NetBodies: read response bodies | net.bodies | High | yes | enforced |
NetIntercept: intercept and change requests | net.intercept | Medium | yes | enforced |
NetFulfill: answer requests without the network | net.fulfill | High | yes | enforced |
CookiesRead | cookies.read | High | yes | enforced |
CookiesWrite | cookies.write | High | yes | enforced |
StorageClear | storage.clear | Medium | yes | enforced |
Contexts: create browser contexts | contexts | Medium | yes | enforced |
TestHooks: hook test start and end | test.hooks | Low | yes | enforced |
Task: run as a task | task | Medium | yes | enforced |
ArtifactsWrite: write files to the run’s output | artifacts.write | Medium | yes | enforced |
HostNet(NetScope::Loopback) | host.net:loopback | High | no | declared only |
HostNet(NetScope::Any) | host.net:any | High | no | declared only |
HostFsRead(scope): read host files | host.fs.read:temp, host.fs.read:run-output, host.fs.read:/a,/b | High | no | declared only |
HostFsWrite(scope): write host files | host.fs.write:temp, … | High | no | declared only |
HostProcess: start host processes | host.process | Critical | no | declared only |
Clock: read the clock | clock | Low | yes | enforced |
Random: use randomness | random | Low | yes | enforced |
State { persist: false }: keep state for the run | state | Low | yes | enforced |
State { persist: true }: keep state across runs | state:persist | Low | yes | enforced |
Raw(RawKind::Cdp): any DevTools command | raw:cdp | Critical | no | enforced |
Raw(RawKind::Switches): any switch not refused for everyone | raw:switches | Critical | no | enforced |
“WASM” is wasm_grantable(); “Native” is enforcement(false).
Capability::risk#
fnHow dangerous the capability is, as in the table above.
PluginSet::with and Registry::plugin_set never grant a Critical
capability; PluginSet::with_trusted must name each one.
Capability::wasm_grantable#
fnWhether a WASM module or manifest may be granted it: not when it is
Critical, nor for host.process, host.fs.read, host.fs.write,
host.net, launch.extensions and launch.profile.
Capability::enforcement#
fnWhether the plugin is a WASM module (true) or native Rust (false).
DeclaredOnly for host.net, host.fs.read, host.fs.write and
host.process on a native plugin; Enforced otherwise.
PluginSet::audit and sbrs plugin info report enforcement(false).
Capability::covers#
fnThe capability a plugin needs.
Whether holding self allows wanted.
Equal capabilities cover each other. Beyond that:
| Holding | Covers |
|---|---|
page.script:* | every page.script |
page.script:HOSTS | page.script of a subset of those hosts |
host.net:any | host.net:loopback too |
raw:cdp | every cdp:DOMAIN |
host.fs.read or host.fs.write of declared paths | the same with a subset of the paths |
raw:cdp does not cover raw:switches, and temp or run-output cover only
themselves.
Display and FromStr#
impl impl fmt::Display for Capability, impl FromStr for Capability
The string forms in the table round-trip: text.parse::<Capability>()?.to_string() == text.
The grammar is HEAD or HEAD:ARG, split at the first ::
page.script:*is every site;page.script:a.com,b.comis a host list (empty entries are dropped);page.script:alone is refused.cdp:DOMAINneeds a domain; the domain is kept as written.host.fs.read:SCOPEandhost.fs.write:SCOPEtaketemp,run-output, or comma-separated paths.host.net:takesloopbackorany;state:takespersist;raw:takescdporswitches.- Any other text is
ParseCapabilityError.
ParseCapabilityError#
struct seleniumbase_rs_plugin::ParseCapabilityError
The text that does not parse.
CapabilitySet#
struct seleniumbase_rs_plugin::CapabilitySet
A set of capabilities, sorted and without repeats: the capabilities and
optional of Metadata, and the grants of a plugin in a set. Build one with
collect(), new and insert, or legacy.
CapabilitySet::new#
fnThe empty set.
CapabilitySet::legacy#
fnWhat a plugin that declares nothing is treated as having: launch.args,
launch.prefs, launch.headless, launch.proxy, launch.extensions,
page.script:*, page.evaluate and raw:cdp.
CapabilitySet::insert#
fnThe capability to add; a repeat changes nothing.
CapabilitySet::covers#
fnThe capability a plugin needs.
Whether some member covers it (Capability::covers).
CapabilitySet::iter#
fnThe members, in order.
CapabilitySet::is_empty#
fnWhether the set is empty.
CapabilitySet::union#
fnThe other set.
The members of both.
CapabilitySet::without_critical#
fnThe members that are not Risk::Critical: the default grants are
capabilities.union(&optional).without_critical().
HostScope#
enum seleniumbase_rs_plugin::HostScope
Which sites a page script may run on: the scope of Capability::PageScript.
NetScope#
enum seleniumbase_rs_plugin::NetScope
Which network peers a plugin may talk to from the host: the scope of
Capability::HostNet.
PathScope#
enum seleniumbase_rs_plugin::PathScope
Which files a plugin may use: the scope of Capability::HostFsRead and
HostFsWrite.
RawKind#
enum seleniumbase_rs_plugin::RawKind
The kind of raw access a plugin has: the scope of Capability::Raw. Both are
Critical.
Risk#
enum seleniumbase_rs_plugin::Risk
How dangerous a capability is. Ordered from Low to Critical.
Enforcement#
enum seleniumbase_rs_plugin::Enforcement
Whether the host stops a plugin that goes beyond a capability, as
Capability::enforcement classifies it.
HostInfo#
struct seleniumbase_rs_plugin::HostInfo
What the host that runs a set supports, passed to
PluginSet::check_with so the set can refuse a
plugin whose required capabilities the host cannot provide
(PluginError::Unsupported).
| Capabilities | cdp() | webdriver(Chromium) | webdriver(Firefox or Safari) | embedded() |
|---|---|---|---|---|
page.script, page.evaluate, test.hooks, clock, random | yes | yes | yes | yes |
cdp:*, raw:* | yes | yes | no | no |
net.*, contexts | yes | no | no | no |
Every other capability (launch.*, page.navigate, cookies.*, storage.clear, task, artifacts.write, host.*, state) | yes | yes | yes | no |
HostInfo::cdp#
fn constThe pure CDP engine, which supports everything. PluginSet::check uses it.
HostInfo::webdriver#
fnThe browser’s family.
HostKind::WebDriverChromium for Chromium, HostKind::WebDriverOther for
any other family.
HostInfo::embedded#
fn constA Tauri webview. The WebDriver engine re-checks a set against it when the
server answers browserName: tauri.
HostInfo::kind#
fn constThe kind of host.
HostInfo::name#
fn constA short name for messages: the CDP engine, WebDriver with Chromium,
WebDriver with Firefox or Safari, an embedded webview.
HostInfo::supports#
fnA capability a plugin requires.
HostKind#
enum non_exhaustive seleniumbase_rs_plugin::HostKind
switch_policy#
mod seleniumbase_rs_plugin::switch_policy
The one list of browser switches that no plugin may add, and of the features no
plugin may turn on or off. PluginSet::before_launch applies it to every
plugin, legacy ones included, unless the plugin holds raw:switches.
seleniumbase-rs has a test (tests/plugin_switch_policy.rs) that fails when a
switch its own stealth layer forbids is missing from REFUSED_SWITCHES.
REFUSED_SWITCHES#
const seleniumbase_rs_plugin::switch_policy::REFUSED_SWITCHES
Switch names (no dashes, lower case) refused for every plugin:
| Kind | Switches |
|---|---|
| Process launchers | renderer-cmd-prefix, utility-cmd-prefix, zygote-cmd-prefix, gpu-launcher, ppapi-plugin-launcher, plugin-launcher, browser-subprocess-path, nacl-gdb, nacl-gdb-script |
| Sandbox and security | no-sandbox, disable-setuid-sandbox, disable-gpu-sandbox, no-zygote, disable-web-security, ignore-certificate-errors, ignore-certificate-errors-spki-list, disable-site-isolation-trials, allow-file-access-from-files, unsafely-treat-insecure-origin-as-secure, allow-running-insecure-content, single-process, js-flags |
Network (use the LaunchSettings fields) | proxy-server, proxy-pac-url, host-resolver-rules, host-rules |
| Remote debugging | remote-debugging-port, remote-debugging-address, remote-debugging-pipe, remote-allow-origins |
| Extensions and profile | load-extension, load-component-extension, disable-extensions-except, user-data-dir |
| Logs and dumps | log-net-log, net-log-capture-mode, enable-logging, log-file, disk-cache-dir, crash-dumps-dir |
REFUSED_FEATURES#
const seleniumbase_rs_plugin::switch_policy::REFUSED_FEATURES
Feature names (lower case) that may not be disabled or enabled, through
--disable-features=, --enable-features=, or the disable_features and
enable_features fields of LaunchSettings.
switch_name#
fn seleniumbase_rs_plugin::switch_policy::switch_name
A command-line argument.
The switch name of arg: surrounding spaces, the leading -- or - and any
=value removed, in lower case. None when arg is not a switch.
refusal#
fn seleniumbase_rs_plugin::switch_policy::refusal
A command-line argument a plugin adds.
Why arg is refused, or None when it is allowed: the switch `--NAME` is refused for every plugin, or, for a --disable-features= or
--enable-features= list naming a refused feature, the feature `NAME` may not be changed by a plugin. Every spelling counts: -name, upper case,
surrounding spaces.
feature_refused#
fn seleniumbase_rs_plugin::switch_policy::feature_refused
A feature name, as in --disable-features=; anything after a : is ignored.
Whether the feature is in REFUSED_FEATURES, compared in lower case.