Documentation
¶
Overview ¶
Package isolate runs spec parsing in a child process (SPEC §5.3, T2).
libopenapi parses on goroutines it starts itself, and a panic on one of them cannot be recovered: in-process, one hostile spec would crash plugit (pb33f/libopenapi#705). The parent re-executes the plugit binary with ChildArg, sends the spec on stdin and reads the manifest from stdout. A crash, malformed output, oversized output or a timeout in the child becomes an ordinary error in the parent.
The child gets an almost empty environment, so secrets held in the parent's env vars never reach the code that handles untrusted input.
Index ¶
Constants ¶
const ( DefaultTimeout = 30 * time.Second DefaultMaxOutput = 256 << 20 )
Defaults applied when the corresponding Runner field is zero.
const ChildArg = "__parse"
ChildArg is the hidden first argument that turns plugit into a parse child.
Variables ¶
var ( ErrParserCrashed = errors.New("spec parser crashed") ErrParseTimeout = errors.New("spec parser timed out") )
Sentinel errors callers can match with errors.Is.