Documentation
¶
Overview ¶
Package checkscript runs user-authored passive scanner checks written in Starlark — a small, Python-like, deterministic language. It is the extension "standard": every custom check is a Starlark file that defines
def check(flow):
# inspect flow, return a list of finding(...) (or [])
Starlark is sandboxed by design — a check cannot read files, open sockets, see the clock, or import anything we don't hand it — so checks are safe to share and run. Execution is additionally bounded (step limit) to stop runaway loops.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeDir ¶ added in v0.9.0
MergeDir copies *.star files from src into dst without overwriting files already in dst. A missing src dir is not an error. Returns how many were copied.
Types ¶
type Check ¶
type Check struct {
ID string
// contains filtered or unexported fields
}
Check is a compiled Starlark check.
func Compile ¶
Compile parses and compiles a check's source, validating that it defines a callable check(flow). The script's top level runs once here (sandboxed).
func LoadDir ¶
LoadDir compiles every `*.star` check in dir (sorted by name for determinism). It returns the compiled checks plus a filename→error map for any that failed to compile, so the caller can surface broken checks without aborting the rest. A missing directory yields no checks and no error.
type Flow ¶
type Flow struct {
ID int64
Method string
Scheme string
Host string
Port int
Path string
Status int
Mime string
ReqHeaders map[string][]string
ResHeaders map[string][]string
ReqBody string
ResBody string
}
Flow is the read-only view of a captured exchange handed to a check.