Documentation
¶
Index ¶
- func AllLibraryNames() []string
- func CheckMainEntryMetadata(p *scriptling.Scriptling, loader *pack.Loader, ...) error
- func CheckScriptMetadata(p *scriptling.Scriptling, loader *pack.Loader, ...) error
- func Factories(libdirs []string, allowedPaths []string, disabledLibs []string, ...)
- func RegisterSys(p *scriptling.Scriptling, argv []string)
- func Scriptling(p *scriptling.Scriptling, libdirs []string, registerInteract bool, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllLibraryNames ¶ added in v0.5.7
func AllLibraryNames() []string
AllLibraryNames returns the names of all built-in CLI libraries.
func CheckMainEntryMetadata ¶ added in v0.24.0
func CheckMainEntryMetadata(p *scriptling.Scriptling, loader *pack.Loader, manager *scriptlingplugin.Manager, entry pack.MainEntry) error
CheckMainEntryMetadata verifies the metadata block of a package main entry: a script entry's bytes directly, a module entry through the module source the loader would import. Entries whose code carries no block run as before. A module that cannot be loaded is not an error here — the import itself reports that failure with the module named.
func CheckScriptMetadata ¶ added in v0.24.0
func CheckScriptMetadata(p *scriptling.Scriptling, loader *pack.Loader, manager *scriptlingplugin.Manager, source []byte) error
CheckScriptMetadata verifies the inline metadata block in source against the environment p actually provides: its registered libraries, the built-in CLI libraries, modules resolvable through loader, and the plugins loaded in manager. Source without a block passes unchanged. The CLI's one-shot runs, its server setup scripts, and package main entries all check through here, so the verdict cannot drift between modes.
The check belongs after the interpreter is fully wired and before the source executes — callers must not register libraries or load plugins after it.
func Factories ¶
func Factories(libdirs []string, allowedPaths []string, disabledLibs []string, secretRegistry *secretprovider.Registry, log logger.Logger, dockerSock, podmanSock string, netPolicy ...*netsecurity.Config)
Factories configures the global sandbox and background factories. Call this once at startup, before any scripts execute.
func RegisterSys ¶ added in v0.18.0
func RegisterSys(p *scriptling.Scriptling, argv []string)
RegisterSys registers the sys library (sys.argv, sys.platform, etc.) on the given Scriptling instance with the provided argv. Pass nil argv to register with an empty list. This is a thin wrapper so callers in other packages don't need to import extlibs directly.
func Scriptling ¶
func Scriptling(p *scriptling.Scriptling, libdirs []string, registerInteract bool, allowedPaths []string, disabledLibs []string, secretRegistry *secretprovider.Registry, log logger.Logger, dockerSock, podmanSock string, netPolicy ...*netsecurity.Config)
Scriptling configures a Scriptling instance with the built-in CLI libraries. libdirs: Directories for on-demand library loading (first entry is typically the script dir or cwd) registerInteract: Whether to register the agent interact library allowedPaths: Filesystem path restrictions for os, pathlib, glob, sandbox (nil = no restrictions) disabledLibs: Library names to skip registration (nil = all enabled) log: Logger instance for the logging library
Types ¶
This section is empty.