jsonnetsecure

package
v0.0.717 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 24 Imported by: 11

Documentation

Index

Constants

View Source
const (
	GiB uint64 = 1024 * 1024 * 1024
)
View Source
const (
	KiB = 1024
)

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

func SetVirtualMemoryLimit added in v0.0.717

func SetVirtualMemoryLimit(limitBytes uint64) error

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 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
}

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

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