Help us shape the future of Go! Take the 2026 Go Developer Survey

sliccbrowsers

package module
v1.18.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

slicc-browsers

The browser knowledge that SLICC's tools share. SLICC drives a real Chromium browser over the Chrome DevTools Protocol (CDP), and several programs, written in different languages, need to agree on the same facts:

  • which browsers exist, where they are installed, and how to launch them for SLICC;
  • how to find a browser that is already running with a debugging port, and which one to pick;
  • which origins browser control must never touch, starting with seven's own origin and the vault;
  • how to prove that a CDP guard really keeps a client away from them.

These programs can't share code, so they share data: one catalog, three sets of test vectors and their JSON schemas, published as a Go module, a Rust crate and an npm package at the same version.

who uses it for
slicc-cli (Go) slicc browsers, slicc launch, and its CDP relay's guard
slicc-cdp (Rust, also wasm32-wasip1) playwright-cli list and open, and its guard
slicc-agent refusing protected origins in its browser tools
slicc-bios, slicc-extension their CDP guards, tested against the guard vectors

What's inside

file what it is
catalog.json every known Chromium browser and Electron app, with install paths per OS, discovery and ranking rules, seven's launch flags and prefs, profile locations and the protected origins
corpus/, corpus.json discovery conformance cases: a fake machine each, with the ranked browser list it must produce
protected.json, protected.mjs protected-origin test vectors, and a reference matcher in JavaScript
guard-vectors.json the CDP scenarios every guard must pass
guard-runner.mjs, guard-driver.mjs, fixture-server.mjs a reference runner for the guard vectors, its helpers, and the test server they run against
schema/ JSON Schema (2020-12) for each file above, and for the --json output of slicc browsers and playwright-cli list

Install

Go
go get github.com/ai-ecoverse/slicc-browsers
import sliccbrowsers "github.com/ai-ecoverse/slicc-browsers"

c := sliccbrowsers.Default()
chrome, ok := c.Browser("chrome")
rank := c.Priority("chrome")

The files are embedded, so nothing is read from disk at run time.

  • Default() parses the embedded catalog once and panics if it can't, which CI rules out; Load() returns the error instead, and Parse(b) reads another copy.
  • Corpus(), Protected() and Guard() return the vectors as typed structs.
  • CatalogJSON(), CorpusJSON(), ProtectedJSON(), GuardVectorsJSON() and the …SchemaJSON() functions return the raw files.
Rust
[dependencies]
slicc-browsers = { version = "1", features = ["serde"] }

[dev-dependencies]
slicc-browsers = { version = "1", features = ["corpus"] }
feature adds
none CATALOG and the schemas as &str constants, with no dependencies
serde typed Catalog, catalog(), Catalog::browser and Catalog::priority
corpus the vectors (CORPUS, PROTECTED, GUARD_VECTORS) and the modules corpus, protected and guard, for tests

Every feature builds for wasm32-wasip1. Keep corpus in [dev-dependencies] so it stays out of release builds.

npm
npm install @ai-ecoverse/slicc-browsers
import catalog from '@ai-ecoverse/slicc-browsers' with { type: 'json' };
import { protectedOrigins } from '@ai-ecoverse/slicc-browsers/protected.mjs';
export what it is
., ./catalog.json, ./corpus.json, ./protected.json, ./guard-vectors.json the data
./schema/<name>.schema.json the schemas
./protected.mjs the protected-origin matcher
./seven.mjs isSevenLabel(seven, label): whether a sliccy.ai host label can be a seven instance
./guard-runner, ./guard-driver.mjs the guard vector runner and its helpers
./fixture, ./fixture-client the test server (Node only) and a client for a remote one

Everything except ./fixture runs in a browser as well as in Node. protected.mjs and seven.mjs import nothing, so an extension or a service worker can ship either file on its own.

The catalog

catalog.json holds everything a program needs to know about browsers:

  • Browsers. Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, in priority order. Each has its macOS bundle, Windows install roots and registry keys, Linux binaries, .desktop ids, flatpak and snap names, and its default user-data dir.
  • Electron apps: known apps by bundle id, and the ones that block remote debugging.
  • Ranking: endpoints with a seven tab come first, then other running endpoints, then installed Chrome, other installed Chromium browsers, Electron apps, and SLICC six's profile last. Browsers older than Chromium 116 are left out.
  • Discovery: DevToolsActivePort files, the ports to probe, the process scan, and how endpoints are named, normalized and merged.
  • Seven: which sliccy.ai hosts are seven instances, and the switches, disabled features and profile prefs a launch for seven needs.
  • Profiles and platforms: where SLICC keeps its browser profiles, and the config dirs and registry keys per OS.
  • Protected origins: see below.

The catalog is "schema": 1. Minor releases only add fields; changing or removing one takes schema 2 and a major release. slicc-cli keeps no browser tables of its own: to add or change a browser, change catalog.json, release, and bump the dependency.

Discovery

A program lists the browsers it can attach to, from four sources: DevToolsActivePort files in known user-data dirs and SLICC profiles, --cdp URLs, a probe of ports 9222 to 9229, and the process list. It ranks the endpoints, adds the installed browsers it could launch, and prints the list in the shape of schema/browsers.schema.json. slicc-cli's README describes that output. Seven's tabs are reported by origin only, never with a path, query or title.

The process source

The process scan finds browsers that something else started with --remote-debugging-port. It reads ps on Unix and Get-CimInstance Win32_Process on Windows, skips wrappers such as node, npx or a shell, and takes the port and the --user-data-dir from the command line, even when the path has spaces. With port 0 it reads the port from that dir's DevToolsActivePort. The exact parsing rules are in catalog.json's discovery.process and the corpus's process-* cases. Tests always fake the process list.

SLICC six's profiles

SLICC six, the previous generation, launches Chrome in a profile of its own (browser-coding-agent-chrome under six's profile root, or SLICC_USER_DATA_DIR). Discovery lists such an endpoint, marks it six: true and ranks it last, but never picks it by itself. Only an explicit request, such as slicc --profile six, uses it. The roots per OS are in catalog.json's profiles.six.

The corpus

Each case in corpus/<case>/ is a fake machine: a home directory, DevToolsActivePort files, fake /json/version and /json/list answers, a fake process list, --cdp URLs and installed browsers. expected.json holds the ranked list it must produce. case.json's needs say what a program must support to run the case (process, probe, six, tabs, …), and a program skips cases it can't run.

For each case, a test harness:

  1. writes the case's files into a temporary home;
  2. points discovery at that home and the case's environment only;
  3. feeds it the fake process list, and routes every HTTP request and TCP dial to the fakes;
  4. compares the result with expected.json.

Both libraries come with helpers for this:

cases, _ := sliccbrowsers.Corpus()
for _, c := range cases {
    if !c.Runs(runtime.GOOS, sliccbrowsers.NeedFlag, sliccbrowsers.NeedProcess) {
        continue
    }
    l := sliccbrowsers.Layout{OS: runtime.GOOS, Home: t.TempDir(), Getenv: func(k string) string { return c.Input.Env[k] }}
    // write c.Files(l); fake c.PSOutput(l, os.Getpid()); use c.Transport() and c.DialContext;
    // compare with c.ExpectedJSON(l)
}
use slicc_browsers::corpus::{corpus, Layout, NEED_PROCESS, NEED_PROFILES};

let cat = slicc_browsers::catalog();
for case in corpus().cases {
    if !case.runs(os, &[NEED_PROFILES, NEED_PROCESS]) {
        continue;
    }
    let env = |k: &str| case.input.env.get(k).cloned();
    let layout = Layout { os, home, env: &env, catalog: &cat };
    // write case.files(&layout); fake case.ps_output(…); answer with case.http_get(…);
    // compare with case.expected(&layout)
}

slicc-cli's test/integration/corpus_test.go is a complete harness. The corpus never uses ports 9222 to 9229, where a developer's own Chrome may be listening.

Protected origins

Browser control must never navigate to, open, attach to, or read the cookies or storage of:

  • seven and the vault: every sliccy.ai host, on any port and scheme, and vault.sliccy.ai by name;
  • the browser's own privileged pages: chrome:// and the other Chromium browsers' equivalents, devtools://, chrome-extension:// (where password managers and wallets live), file://, and Chrome's own UI targets. The new tab page is the one exception;
  • a program's extra seven origins, such as slicc-cli's --origin.

URLs are judged the way the browser parses them, so blob:, view-source: and about: aliases, backslashes, encoded dots and full-width letters can't sneak past. A URL the guard can't parse counts as protected wherever the browser might load it. A tab that seven opened keeps seven's origin when it goes to about:blank. A refused call fails with slicc: refused: target is on seven's origin.

catalog.json's protectedOrigins holds the rules, and protected.json the vectors: URLs, targets, cookie domains and storage keys, each with the expected answer. protected.mjs is the reference implementation:

import catalog from '@ai-ecoverse/slicc-browsers' with { type: 'json' };
import { protectedOrigins } from '@ai-ecoverse/slicc-browsers/protected.mjs';

const guard = protectedOrigins(catalog.protectedOrigins, ['http://127.0.0.1:5710']);
guard.url('https://seven.sliccy.ai/');
guard.cookieDomain('.sliccy.ai');
guard.target({ url: 'about:blank', opener: 'protected' });

It also offers storageKey(key) and unparseable(text). A Go or Rust implementation needs a WHATWG URL parser, not net/url, and must pass every vector in protected.json.

Guard vectors

A guard sits between a CDP client, such as an agent's browser tool, and the browser, and keeps the client away from protected origins. guard-vectors.json holds more than a hundred attacks on that promise, and every guard must pass them all. They include navigation, redirect chains, popups and frames, request interception, cookie and storage access, privileged pages, error pages, foreign extension worlds, debugger and instrumentation tricks, and session overrides that would leak into a protected page.

Each vector runs twice. The control runs it against an ordinary origin, where it must work. The guarded leg runs it through the guard against a protected target, where it must be refused or have no effect. A liveness check, made outside the guard, proves the protected target was really there. A row passes only when all three do, so a guard can't pass by breaking everything, and a test can't pass by never reaching the target.

When a vector compares ordinary and protected fixture markers, those markers do not contain one another. Protected-marker checks still examine complete probe replies, including errors, and the vector's client events and messages, including encoded values.

Running them

The reference runner works with any guard that speaks CDP:

import set from '@ai-ecoverse/slicc-browsers/guard-vectors.json' with { type: 'json' };
import { run } from '@ai-ecoverse/slicc-browsers/guard-runner';
import { fixtureServer } from '@ai-ecoverse/slicc-browsers/fixture';

const fixture = await fixtureServer();
const execution = await run(set, {
  clientFactory: (row) => connectGuardAndObserver(row),
  targets: originsFor(fixture),
  capabilities: { autoAttach: true, browserSession: true, browserContexts: true, discovery: true },
  parallel: 4,
  fixture,
});
console.log(execution.summary({ guard: 'my-guard', sha: process.env.GITHUB_SHA }).line);
await fixture.close();

You supply:

  • a guarded client per row: your guard's CDP connection, with send(method, params, sessionId), waitEvent(predicate, ms) and an events array;
  • an unguarded observer: a direct CDP connection to the same browser, which runs the controls and checks liveness;
  • origins: the fixture server reachable as seven, the vault and an ordinary site. Point the protected hostnames at it with Chrome's --host-resolver-rules, so no test ever touches the real seven;
  • capabilities: what your transport can do. A row that needs something you don't declare is skipped as not-supported:<capability>.
capability means the transport can
autoAttach auto-attach to child targets such as popups and iframes
browserSession send commands to the browser session, not only to a page
browserContexts create isolated browser contexts
discovery report target creation and changes without a session
chromeUrlsAttach attach to chrome:// pages (CDP over a DevTools port can; chrome.debugger can't)
extensionWorld host a foreign extension's content script on the test page
clientExit close the guarded client in the middle of a row
siteIsolationOff, inboundDelay, forwardAudit run without site isolation, hold the browser's messages to the guard, and audit what the guard forwarded

forwardAudit permits observer restore after a client history timeout only with terminal historyTrigger: { id: "history-trigger", complete: true, forwarded: false } proof from audit({ historyTrigger: command, probes: [], final: false }), keeping the probe ledger open; missing proof, forwarding or a late successful reply never qualifies as refusal.

Reading the result

Each row reports control, guarded and live as pass, fail, skip, incomplete (the test couldn't gather its own evidence) or not-run (vectors described only in words). summary() turns the rows into one line:

GUARD-PASS my-guard@1a2b3c4 (vectors @ai-ecoverse/slicc-browsers@1.18.5)

The run passes only when every row passes and none is missing. A skip with a reason the runner would never give, such as a made-up capability, is reported as forged, and skipped and incomplete rows are counted on the line, so the line can't overstate what was tested.

To find out what a vector checks, read it in guard-vectors.json: each one lists its steps, each observation's means, its live condition and its expected outcome. schema/guard-vectors.schema.json defines the format.

Development

You need Go 1.26, Rust stable with the wasm32-wasip1 target, Node 24 or later, and Chrome or Chromium for the browser tests: they take CHROME_PATH, or the Chrome for Testing that npx slicc-cdp install-browser installs, and run it headless unless CI is set (SLICC_HEADLESS=1 or 0 overrides).

command what it does
npm run corpus rebuilds corpus.json from corpus/
npm run validate checks every file against its schema and the rules a schema can't express, and runs protected.json through protected.mjs
npm run lint Biome, the slicc lint rules, gofmt, go vet for Linux, macOS and Windows, golangci-lint, cargo fmt, clippy and a wasm32-wasip1 check of each feature
npm test every file in test/integration/: validation, the Node, Go and Rust tests, and the reference runner against real Chromium with no guard, where every control must pass and every protection must fail
npm run build the Go module, the crate (also for wasm32-wasip1), and the npm package

A new discovery behaviour gets a corpus case, and a new guard behaviour gets a guard vector.

CI and releases

CI is slicc-shared-web's pipeline, called from .github/workflows/ci.yml. A pull request gets lint, then npm test split over shards by timing, then a Claude and a Codex review; the merge queue runs lint and the tests again. Tests run on Linux only.

Every merge to main that warrants it is released by semantic-release in the same workflow, as one version for all three packages. The vX.Y.Z tag is the Go release, and npm gets the package with provenance through trusted publishing. Then ci.yml publishes the crate to crates.io, also with trusted publishing, and asks the Go module proxy and pkg.go.dev for the new tag. Pushed tags are never moved or deleted: a bad release is fixed by the next one.

License

Apache-2.0

Documentation

Index

Constants

View Source
const (
	NeedUserDataDirs = "user-data-dirs"
	NeedProfiles     = "seven-profiles"
	NeedFlag         = "flag"
	NeedProcess      = "process"
	NeedProbe        = "probe"
	NeedOrigins      = "origins"
	NeedInstalled    = "installed"
	NeedSix          = "six"
	NeedTabs         = "tabs"
)
View Source
const (
	GuardTargetSeven               = "seven"
	GuardTargetVault               = "vault"
	GuardTargetVaultX              = "vault-x"
	GuardTargetApex                = "apex"
	GuardTargetOwn                 = "own"
	GuardTargetChromeNewtab        = "chrome-newtab"
	GuardTargetChromeNewTabPage    = "chrome-new-tab-page"
	GuardTargetChromeSettings      = "chrome-settings"
	GuardTargetChromePasswords     = "chrome-passwords"
	GuardTargetChromeSearch        = "chrome-search"
	GuardTargetNetworkError        = "network-error"
	GuardTargetChromeExtensionPage = "chrome-extension-page"
	GuardTargetFileRoot            = "file-root"
	GuardOrdinary                  = "ordinary"
	GuardSameSite                  = "ordinary-same-site"
	GuardKindCDP                   = "cdp"
	GuardKindText                  = "text"
	GuardViaGuard                  = "guard"
	GuardViaUnguarded              = "unguarded"
	GuardScopeAny                  = "any"
	GuardControl                   = "control"
	GuardGuarded                   = "guarded"

	GuardCapAutoAttach       = "autoAttach"
	GuardCapBrowserSession   = "browserSession"
	GuardCapBrowserContexts  = "browserContexts"
	GuardCapChromeURLsAttach = "chromeUrlsAttach"
	GuardCapExtensionWorld   = "extensionWorld"
	GuardCapDiscovery        = "discovery"
	GuardCapClientExit       = "clientExit"
	GuardCapSiteIsolationOff = "siteIsolationOff"
	GuardCapInboundDelay     = "inboundDelay"
	GuardCapForwardAudit     = "forwardAudit"
	GuardClientExit          = "exit"
	GuardPageScript          = "script"
	GuardSessionPage         = "page"
	GuardSessionBrowser      = "browser"
	GuardSessionEither       = "page-or-browser"
	GuardSessionChild        = "child"
)
View Source
const (
	OpenerProtected   = "protected"
	OpenerUnprotected = "unprotected"
	OpenerUnknown     = "unknown"
)
View Source
const Schema = 1

Variables

This section is empty.

Functions

func BrowsersSchemaJSON

func BrowsersSchemaJSON() []byte

func CatalogJSON

func CatalogJSON() []byte

func CatalogSchemaJSON

func CatalogSchemaJSON() []byte

func CorpusJSON

func CorpusJSON() []byte

func GuardVectorsJSON added in v1.6.0

func GuardVectorsJSON() []byte

func GuardVectorsSchemaJSON added in v1.6.0

func GuardVectorsSchemaJSON() []byte

func ProtectedJSON added in v1.3.0

func ProtectedJSON() []byte

func ProtectedSchemaJSON added in v1.3.0

func ProtectedSchemaJSON() []byte

Types

type App

type App struct {
	BundleID string `json:"bundleId"`
	Name     string `json:"name"`
}

type Browser

type Browser struct {
	ID              string  `json:"id"`
	Name            string  `json:"name"`
	Channel         string  `json:"channel"`
	Engine          string  `json:"engine"`
	ChromiumVersion bool    `json:"chromiumVersion"`
	MacOS           MacOS   `json:"macos"`
	Windows         Windows `json:"windows,omitzero"`
	Linux           Linux   `json:"linux,omitzero"`
}

type Case

type Case struct {
	Name     string          `json:"name"`
	Input    Input           `json:"case"`
	Expected json.RawMessage `json:"expected"`
}

func Corpus

func Corpus() ([]Case, error)

func (Case) CDP

func (c Case) CDP(l Layout) []string

func (Case) CIMOutput

func (c Case) CIMOutput(l Layout, self int) string

func (Case) Commands

func (c Case) Commands(l Layout, self int) []FakeProcess

func (Case) DialContext

func (c Case) DialContext(_ context.Context, network, addr string) (net.Conn, error)

func (Case) Env

func (c Case) Env(l Layout) map[string]string

func (Case) ExpectedJSON

func (c Case) ExpectedJSON(l Layout) ([]byte, error)

func (Case) Files

func (c Case) Files(l Layout) map[string]string

func (Case) PSOutput

func (c Case) PSOutput(l Layout, self int) string

func (Case) Runs

func (c Case) Runs(goos string, supported ...string) bool

func (Case) Server

func (c Case) Server(hostPort string) (Server, bool)

func (Case) Transport

func (c Case) Transport() http.RoundTripper

type Catalog

type Catalog struct {
	Schema           int              `json:"schema"`
	MinChromiumMajor int              `json:"minChromiumMajor"`
	Browsers         []Browser        `json:"browsers"`
	Electron         Electron         `json:"electron"`
	Rank             Rank             `json:"rank"`
	Discovery        Discovery        `json:"discovery"`
	Seven            Seven            `json:"seven"`
	ProtectedOrigins ProtectedOrigins `json:"protectedOrigins"`
	Profiles         Profiles         `json:"profiles"`
	Launch           Launch           `json:"launch"`
	Platforms        Platforms        `json:"platforms"`
}

func Default

func Default() *Catalog

func Load

func Load() (*Catalog, error)

func Parse

func Parse(b []byte) (*Catalog, error)

func (*Catalog) Browser

func (c *Catalog) Browser(id string) (Browser, bool)

func (*Catalog) Priority

func (c *Catalog) Priority(id string) int

type CookieVector added in v1.3.0

type CookieVector struct {
	Domain    string `json:"domain"`
	Protected bool   `json:"protected"`
}

type DiscardException

type DiscardException struct {
	Path []string `json:"path"`
	Type string   `json:"type"`
	Form string   `json:"form"`
}

type Discovery

type Discovery struct {
	ActivePortFile     string         `json:"activePortFile"`
	ProbePorts         []int          `json:"probePorts"`
	SourceRank         map[string]int `json:"sourceRank"`
	ChromeMajorPattern string         `json:"chromeMajorPattern"`
	Names              Names          `json:"names"`
	Process            Process        `json:"process"`
}

type Electron

type Electron struct {
	MacOSApps    []App    `json:"macosApps"`
	DebugBlocked []string `json:"debugBlocked"`
	IDPrefix     string   `json:"idPrefix"`
}

type ElectronLaunch

type ElectronLaunch struct {
	PortFlag      string `json:"portFlag"`
	MinPort       int    `json:"minPort"`
	ReservedPorts []int  `json:"reservedPorts"`
}

type ErrorPageRule added in v1.11.0

type ErrorPageRule struct {
	URL    string `json:"url"`
	Target string `json:"target"`
	Redact string `json:"redact"`
}

type FakeProcess

type FakeProcess struct {
	PID     int    `json:"pid"`
	Self    bool   `json:"self,omitempty"`
	Command string `json:"command"`
}

type GuardAnswer added in v1.6.0

type GuardAnswer struct {
	URL    string          `json:"url"`
	Stage  string          `json:"stage,omitempty"`
	CDP    string          `json:"cdp,omitempty"`
	Params json.RawMessage `json:"params,omitempty"`
	Hold   bool            `json:"hold,omitempty"`
}

type GuardControlRun added in v1.6.0

type GuardControlRun struct {
	Origin   string        `json:"origin"`
	Via      string        `json:"via"`
	Expected GuardExpected `json:"expected"`
}

type GuardExpected added in v1.6.0

type GuardExpected struct {
	Checks map[string]GuardOutcome
	Text   string
}

func (GuardExpected) MarshalJSON added in v1.6.0

func (e GuardExpected) MarshalJSON() ([]byte, error)

func (*GuardExpected) UnmarshalJSON added in v1.6.0

func (e *GuardExpected) UnmarshalJSON(b []byte) error

type GuardGuess added in v1.6.0

type GuardGuess struct {
	Between []string        `json:"between"`
	CDP     string          `json:"cdp"`
	Params  json.RawMessage `json:"params"`
}

type GuardHop added in v1.6.0

type GuardHop struct {
	Origin string `json:"origin"`
	Code   int    `json:"code"`
}

type GuardObservable added in v1.6.0

type GuardObservable struct {
	Own *bool `json:"own,omitempty"`
}

type GuardObservation added in v1.6.0

type GuardObservation struct {
	Means      string          `json:"means"`
	Check      json.RawMessage `json:"check"`
	DependsOn  []string        `json:"dependsOn,omitzero"`
	Requires   []string        `json:"requires,omitempty"`
	EitherWhen json.RawMessage `json:"eitherWhen,omitempty"`
}

type GuardOutcome added in v1.6.0

type GuardOutcome struct {
	Value  bool
	Either bool
}

func (GuardOutcome) MarshalJSON added in v1.6.0

func (o GuardOutcome) MarshalJSON() ([]byte, error)

func (*GuardOutcome) UnmarshalJSON added in v1.6.0

func (o *GuardOutcome) UnmarshalJSON(b []byte) error

type GuardPaused added in v1.7.6

type GuardPaused struct {
	URL string `json:"url"`
	MS  int    `json:"ms"`
}

type GuardRefusal added in v1.6.0

type GuardRefusal struct {
	Match         string `json:"match"`
	OnlyProtected bool   `json:"onlyProtected,omitempty"`
}

type GuardSettle added in v1.6.0

type GuardSettle struct {
	Beacon    string          `json:"beacon,omitempty"`
	Served    string          `json:"served,omitempty"`
	Or        json.RawMessage `json:"or,omitempty"`
	Title     string          `json:"title,omitempty"`
	MS        int             `json:"ms,omitempty"`
	Variant   bool            `json:"variant,omitempty"`
	Session   string          `json:"session,omitempty"`
	Required  bool            `json:"required,omitempty"`
	DependsOn []string        `json:"dependsOn,omitempty"`
}

type GuardSkip added in v1.6.0

type GuardSkip struct {
	Target string `json:"target"`
	Reason string `json:"reason"`
}

type GuardSource added in v1.6.0

type GuardSource struct {
	Repo string `json:"repo"`
	Ref  string `json:"ref"`
	Path string `json:"path"`
}

type GuardStep added in v1.6.0

type GuardStep struct {
	Client         string          `json:"client,omitempty"`
	RedirectSecret string          `json:"redirectSecret,omitempty"`
	ErrorPage      string          `json:"errorPage,omitempty"`
	Secret         string          `json:"secret,omitempty"`
	Unparseable    bool            `json:"unparseable,omitempty"`
	ExtensionWorld string          `json:"extensionWorld,omitempty"`
	FrameRead      string          `json:"frameRead,omitempty"`
	BFCacheRestore string          `json:"bfcacheRestore,omitempty"`
	Origin         string          `json:"origin,omitempty"`
	Text           string          `json:"text,omitempty"`
	CDP            string          `json:"cdp,omitempty"`
	Params         json.RawMessage `json:"params,omitempty"`
	Refusable      bool            `json:"refusable,omitempty"`
	Refusal        *GuardRefusal   `json:"refusal,omitempty"`
	Page           string          `json:"page,omitempty"`
	URL            string          `json:"url,omitempty"`
	Hops           []GuardHop      `json:"hops,omitempty"`
	From           string          `json:"from,omitempty"`
	Context        string          `json:"context,omitempty"`
	Expression     string          `json:"expression,omitempty"`
	Credentials    string          `json:"credentials,omitempty"`
	Status         bool            `json:"status,omitempty"`
	Background     *bool           `json:"background,omitempty"`
	Answer         *GuardAnswer    `json:"answer,omitempty"`
	Children       []GuardStep     `json:"children,omitempty"`
	Where          *GuardWhere     `json:"where,omitempty"`
	Settle         *GuardSettle    `json:"settle,omitempty"`
	Wait           *int            `json:"wait,omitempty"`
	Paused         *GuardPaused    `json:"paused,omitempty"`
	Guess          *GuardGuess     `json:"guess,omitempty"`
	Session        string          `json:"session,omitempty"`
	As             string          `json:"as,omitempty"`
	On             string          `json:"on,omitempty"`
	Requires       []string        `json:"requires,omitempty"`
}

type GuardTarget added in v1.6.0

type GuardTarget struct {
	Host        string `json:"host,omitempty"`
	URL         string `json:"url,omitempty"`
	Description string `json:"description"`
}

type GuardVector added in v1.6.0

type GuardVector struct {
	ID              string                      `json:"id"`
	Family          string                      `json:"family"`
	Kind            string                      `json:"kind"`
	Scope           string                      `json:"scope"`
	Setup           []GuardStep                 `json:"setup"`
	Trigger         []GuardStep                 `json:"trigger"`
	Targets         []string                    `json:"targets"`
	Requires        []string                    `json:"requires,omitempty"`
	Observe         map[string]GuardObservation `json:"observe,omitempty"`
	Live            string                      `json:"live"`
	LiveCheck       json.RawMessage             `json:"liveCheck,omitempty"`
	Control         GuardControlRun             `json:"control"`
	Expected        GuardExpected               `json:"expected"`
	Skip            *GuardSkip                  `json:"skip,omitempty"`
	DefaultContext  bool                        `json:"defaultContext,omitempty"`
	DesignDependent []string                    `json:"designDependent,omitempty"`
	Observable      *GuardObservable            `json:"observable,omitempty"`
	AppliesTo       []string                    `json:"appliesTo,omitempty"`
}

type GuardVectors added in v1.6.0

type GuardVectors struct {
	SchemaVersion int                    `json:"schemaVersion"`
	SetVersion    string                 `json:"setVersion"`
	Sources       []GuardSource          `json:"sources"`
	Targets       map[string]GuardTarget `json:"targets"`
	Variants      map[string]int         `json:"variants"`
	Capabilities  map[string]string      `json:"capabilities"`
	Placeholders  map[string]string      `json:"placeholders"`
	Vectors       []GuardVector          `json:"vectors"`
}

func Guard added in v1.6.0

func Guard() (*GuardVectors, error)

type GuardWhere added in v1.7.4

type GuardWhere struct {
	OpenerID  string `json:"openerId,omitempty"`
	URLPrefix string `json:"urlPrefix,omitempty"`
}

type Input

type Input struct {
	Description string            `json:"description"`
	OS          []string          `json:"os,omitempty"`
	Needs       []string          `json:"needs"`
	Env         map[string]string `json:"env,omitempty"`
	Files       map[string]string `json:"files,omitempty"`
	CDP         []string          `json:"cdp,omitempty"`
	Origins     []string          `json:"origins,omitempty"`
	ProbePorts  []int             `json:"probePorts,omitempty"`
	Processes   []FakeProcess     `json:"processes,omitempty"`
	HTTP        map[string]Server `json:"http,omitempty"`
	Installed   json.RawMessage   `json:"installed,omitempty"`
	Auto        *string           `json:"auto,omitempty"`
}

type KeyVector added in v1.3.0

type KeyVector struct {
	Key       string `json:"key"`
	Protected bool   `json:"protected"`
}

type Launch

type Launch struct {
	ChromiumArgs        []string       `json:"chromiumArgs"`
	Headless            string         `json:"headless"`
	DisableFeaturesFlag string         `json:"disableFeaturesFlag"`
	Electron            ElectronLaunch `json:"electron"`
}

type Layout

type Layout struct {
	OS      string
	Home    string
	Getenv  func(string) string
	Catalog *Catalog
}

func (Layout) Config

func (l Layout) Config() string

func (Layout) Expand

func (l Layout) Expand(s string) string

func (Layout) Join

func (l Layout) Join(parts ...string) string

func (Layout) SevenProfiles

func (l Layout) SevenProfiles() string

func (Layout) SixProfiles added in v1.2.0

func (l Layout) SixProfiles() string

func (Layout) Token

func (l Layout) Token(name string) (string, bool)

func (Layout) UserDataDirs

func (l Layout) UserDataDirs(id string) []string

func (Layout) WindowsRoot

func (l Layout) WindowsRoot(name string) string

type Linux

type Linux struct {
	Bins        []string `json:"bins,omitempty"`
	DesktopIDs  []string `json:"desktopIds,omitempty"`
	Flatpak     string   `json:"flatpak,omitempty"`
	Snap        string   `json:"snap,omitempty"`
	SnapDataDir []string `json:"snapDataDir,omitempty"`
	ConfigDir   []string `json:"configDir,omitempty"`
	Debs        []string `json:"debs,omitempty"`
}

type LinuxPlatform

type LinuxPlatform struct {
	Config Location `json:"config"`
}

type Location

type Location struct {
	Env      string   `json:"env,omitempty"`
	Home     []string `json:"home,omitempty"`
	Absolute string   `json:"absolute,omitempty"`
}

type MacOS

type MacOS struct {
	BundleID   string   `json:"bundleId"`
	App        string   `json:"app"`
	Executable string   `json:"executable"`
	DataDir    []string `json:"dataDir,omitempty"`
}

type MacOSPlatform

type MacOSPlatform struct {
	Config Location `json:"config"`
}

type Names

type Names struct {
	ElectronUserAgent string            `json:"electronUserAgent"`
	Electron          string            `json:"electron"`
	Products          map[string]string `json:"products"`
	Fallback          string            `json:"fallback"`
}

type Platforms

type Platforms struct {
	MacOS   MacOSPlatform   `json:"macos"`
	Windows WindowsPlatform `json:"windows"`
	Linux   LinuxPlatform   `json:"linux"`
}

type Pref

type Pref struct {
	Path  []string        `json:"path"`
	Value json.RawMessage `json:"value"`
	Form  string          `json:"form,omitempty"`
}

type Process

type Process struct {
	Unix            []string `json:"unix"`
	Windows         []string `json:"windows"`
	PortFlag        string   `json:"portFlag"`
	UserDataDirFlag string   `json:"userDataDirFlag"`
	ValueQuotes     []string `json:"valueQuotes"`
	ValueStop       string   `json:"valueStop"`
	Wrappers        []string `json:"wrappers"`
	WrapperSuffixes []string `json:"wrapperSuffixes"`
}

type Profiles

type Profiles struct {
	Root              []string `json:"root"`
	SnapRoot          []string `json:"snapRoot"`
	LegacyRoot        []string `json:"legacyRoot"`
	SixProfilePattern string   `json:"sixProfilePattern"`
	NamePattern       string   `json:"namePattern"`
	Six               Six      `json:"six"`
}

type ProtectedOrigins added in v1.3.0

type ProtectedOrigins struct {
	ErrorPage          ErrorPageRule `json:"errorPage"`
	Domains            []string      `json:"domains"`
	Hosts              []string      `json:"hosts"`
	Schemes            []string      `json:"schemes"`
	InnerSchemes       []string      `json:"innerSchemes"`
	AnySchemes         []string      `json:"anySchemes"`
	ProtectedSchemes   []string      `json:"protectedSchemes"`
	SchemeExceptions   []string      `json:"schemeExceptions"`
	AboutScheme        string        `json:"aboutScheme"`
	TargetTypes        []string      `json:"targetTypes"`
	Inheriting         []string      `json:"inheriting"`
	Unparseable        string        `json:"unparseable"`
	UnparseableRefusal string        `json:"unparseableRefusal"`
	Refusal            string        `json:"refusal"`
}

type ProtectedVectors added in v1.3.0

type ProtectedVectors struct {
	ErrorPage          ErrorPageRule  `json:"errorPage"`
	Unparseable        string         `json:"unparseable"`
	UnparseableRefusal string         `json:"unparseableRefusal"`
	Schema             int            `json:"schema"`
	Origins            []string       `json:"origins"`
	URLs               []URLVector    `json:"urls"`
	Targets            []TargetVector `json:"targets"`
	CookieDomains      []CookieVector `json:"cookieDomains"`
	StorageKeys        []KeyVector    `json:"storageKeys"`
}

func Protected added in v1.3.0

func Protected() (*ProtectedVectors, error)

type Rank

type Rank struct {
	Tiers    Tiers  `json:"tiers"`
	ChromeID string `json:"chromeId"`
}

type Registry

type Registry struct {
	Hives             []string `json:"hives"`
	StartMenuInternet []string `json:"startMenuInternet"`
	OpenCommand       string   `json:"openCommand"`
	AppPaths          string   `json:"appPaths"`
	AppPathNames      []string `json:"appPathNames"`
}

type Server

type Server struct {
	Version json.RawMessage `json:"version,omitempty"`
	List    json.RawMessage `json:"list,omitempty"`
}

type Seven

type Seven struct {
	OriginScheme          string             `json:"originScheme"`
	OriginHostPattern     string             `json:"originHostPattern"`
	ExcludedLabels        []string           `json:"excludedLabels"`
	ExcludedLabelPrefixes []string           `json:"excludedLabelPrefixes,omitempty"`
	SitePattern           string             `json:"sitePattern"`
	Switches              []string           `json:"switches"`
	DisabledFeatures      []string           `json:"disabledFeatures"`
	Prefs                 []Pref             `json:"prefs"`
	DiscardExceptions     []DiscardException `json:"discardExceptions"`
	CleanExit             []Pref             `json:"cleanExit"`
}

func (*Seven) IsSevenLabel added in v1.5.0

func (s *Seven) IsSevenLabel(label string) bool

type Six added in v1.2.0

type Six struct {
	Roots          SixRoots `json:"roots"`
	DefaultName    string   `json:"defaultName"`
	DefaultPort    int      `json:"defaultPort"`
	PortSuffix     string   `json:"portSuffix"`
	UserDataDirEnv string   `json:"userDataDirEnv"`
}

type SixRoot added in v1.2.0

type SixRoot struct {
	Base Location `json:"base"`
	Path []string `json:"path"`
}

type SixRoots added in v1.2.0

type SixRoots struct {
	MacOS   SixRoot `json:"macos"`
	Linux   SixRoot `json:"linux"`
	Windows SixRoot `json:"windows"`
}

type TargetVector added in v1.3.0

type TargetVector struct {
	DocumentURL    string `json:"documentURL,omitempty"`
	UnreachableURL string `json:"unreachableURL,omitempty"`
	Navigating     bool   `json:"navigating,omitempty"`
	URL            string `json:"url"`
	Type           string `json:"type,omitempty"`
	Previous       bool   `json:"previous,omitempty"`
	Opener         string `json:"opener,omitempty"`
	Protected      bool   `json:"protected"`
}

type Tiers

type Tiers struct {
	SevenOpen int `json:"sevenOpen"`
	Endpoint  int `json:"endpoint"`
	Chrome    int `json:"chrome"`
	Chromium  int `json:"chromium"`
	Electron  int `json:"electron"`
	Six       int `json:"six"`
}

type URLVector added in v1.3.0

type URLVector struct {
	URL       string `json:"url"`
	Protected bool   `json:"protected"`
}

type Windows

type Windows struct {
	Roots             []string   `json:"roots,omitempty"`
	Executables       [][]string `json:"executables,omitempty"`
	DataRoot          string     `json:"dataRoot,omitempty"`
	DataDir           []string   `json:"dataDir,omitempty"`
	StartMenuInternet []string   `json:"startMenuInternet,omitempty"`
}

type WindowsPlatform

type WindowsPlatform struct {
	Config   Location            `json:"config"`
	Roots    map[string]Location `json:"roots"`
	Registry Registry            `json:"registry"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL