jsonnetsecure

package
v0.0.632 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProcessPoolClosed = errors.New("jsonnetsecure: process pool closed")
)

Functions

func JsonnetTestBinary added in v0.0.511

func JsonnetTestBinary(t testing.TB) string

func NewJsonnetCmd added in v0.0.511

func NewJsonnetCmd() *cobra.Command

Types

type DefaultProvider added in v0.0.511

type DefaultProvider struct {
	Subcommand string
	Pool       Pool
}

DefaultProvider provides a secure VM by calling the currently running the current binary with the provided subcommand.

func (*DefaultProvider) JsonnetVM added in v0.0.511

func (p *DefaultProvider) JsonnetVM(ctx context.Context) (VM, error)

type ErrorImporter

type ErrorImporter struct{}

ErrorImporter errors when calling "import".

func (*ErrorImporter) Import

func (importer *ErrorImporter) Import(importedFrom, importedPath string) (contents jsonnet.Contents, foundAt string, err error)

Import fetches data from a map entry. All paths are treated as absolute keys.

type Option added in v0.0.511

type Option func(o *vmOptions)

func WithJsonnetBinary added in v0.0.511

func WithJsonnetBinary(jsonnetBinaryPath string) Option

func WithProcessArgs added in v0.0.511

func WithProcessArgs(args ...string) Option

func WithProcessIsolatedVM added in v0.0.511

func WithProcessIsolatedVM(ctx context.Context) Option

func WithProcessPool added in v0.0.611

func WithProcessPool(p Pool) Option

type Pool added in v0.0.611

type Pool interface {
	Close()
	// contains filtered or unexported methods
}

func NewProcessPool added in v0.0.611

func NewProcessPool(size int) Pool

type ProcessVM added in v0.0.511

type ProcessVM struct {
	// contains filtered or unexported fields
}

func (*ProcessVM) EvaluateAnonymousSnippet added in v0.0.511

func (p *ProcessVM) EvaluateAnonymousSnippet(filename string, snippet string) (_ string, err error)

func (*ProcessVM) ExtCode added in v0.0.511

func (p *ProcessVM) ExtCode(key string, val string)

func (*ProcessVM) ExtVar added in v0.0.511

func (p *ProcessVM) ExtVar(key string, val string)

func (*ProcessVM) TLACode added in v0.0.511

func (p *ProcessVM) TLACode(key string, val string)

func (*ProcessVM) TLAVar added in v0.0.511

func (p *ProcessVM) TLAVar(key string, val string)

type TestProvider added in v0.0.511

type TestProvider struct {
	// contains filtered or unexported fields
}

TestProvider provides a secure VM by running go build on github. com/ory/x/jsonnetsecure/cmd.

func NewTestProvider added in v0.0.511

func NewTestProvider(t testing.TB) *TestProvider

func (*TestProvider) JsonnetVM added in v0.0.511

func (p *TestProvider) JsonnetVM(ctx context.Context) (VM, error)

type VM added in v0.0.511

type VM interface {
	EvaluateAnonymousSnippet(filename string, snippet string) (json string, formattedErr error)
	ExtCode(key string, val string)
	ExtVar(key string, val string)
	TLACode(key string, val string)
	TLAVar(key string, val string)
}

func MakeSecureVM

func MakeSecureVM(opts ...Option) VM

func NewProcessPoolVM added in v0.0.611

func NewProcessPoolVM(opts *vmOptions) VM

func NewProcessVM added in v0.0.511

func NewProcessVM(opts *vmOptions) VM

type VMProvider added in v0.0.511

type VMProvider interface {
	// JsonnetVM creates a new secure process-isolated Jsonnet VM whose
	// execution is bound to the provided context, i.e.,
	// cancelling the context will terminate the VM process.
	JsonnetVM(context.Context) (VM, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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