Documentation
¶
Index ¶
- Constants
- Variables
- func DisallowGlobalUnicast(ip net.IP) (bool, error)
- func DisallowInterfaceLocalMulticast(ip net.IP) (bool, error)
- func DisallowLinkLocalMulticast(ip net.IP) (bool, error)
- func DisallowLinkLocalUnicast(ip net.IP) (bool, error)
- func DisallowLoopback(ip net.IP) (bool, error)
- func DisallowMulticast(ip net.IP) (bool, error)
- func DisallowPrivate(ip net.IP) (bool, error)
- func DisallowUnspecified(ip net.IP) (bool, error)
- func ScanStderr(data []byte, atEOF bool) (advance int, token []byte, err error)
- type CheckFileError
- type CheckFileOptions
- type CheckSnippetOptions
- type Checker
- type ErrorGlobalUnicast
- type ErrorInterfaceLocalMulticast
- type ErrorInvalidIP
- type ErrorLinkLocalMulticast
- type ErrorLinkLocalUnicast
- type ErrorLoopback
- type ErrorMulticast
- type ErrorNameUnmatched
- type ErrorNoIP
- type ErrorPrivate
- type ErrorUnspecified
- type HostPort
- type IPPolicy
- type IPPolicyPermissioner
- type PermissionDescriptor
- type PermissionName
- type Permissioner
- type RunFileError
- type RunFileOptions
- type RunFileResult
- type RunGoValueOptions
- type RunGoValueResult
- type Runner
- type StdStream
- type SysKind
Constants ¶
View Source
const StdStreamLimit int64 = 1 * 1024 * 1024
StdStreamLimit is 1MiB.
Variables ¶
View Source
var ErrAllHost = errors.New("network permission without host is disallowed")
Functions ¶
Types ¶
type CheckFileError ¶
func (*CheckFileError) Error ¶
func (e *CheckFileError) Error() string
func (*CheckFileError) Unwrap ¶
func (e *CheckFileError) Unwrap() error
type CheckFileOptions ¶
type CheckFileOptions struct { // TargetScript is the filename of the target script. TargetScript string }
type CheckSnippetOptions ¶
type CheckSnippetOptions struct { // TargetScript is the content of the target script. TargetScript string }
type Checker ¶
type Checker struct{}
func (*Checker) CheckFile ¶
func (c *Checker) CheckFile(ctx context.Context, opts CheckFileOptions) error
func (*Checker) CheckSnippet ¶
func (c *Checker) CheckSnippet(ctx context.Context, opts CheckSnippetOptions) error
type ErrorGlobalUnicast ¶
func (*ErrorGlobalUnicast) Error ¶
func (e *ErrorGlobalUnicast) Error() string
type ErrorInterfaceLocalMulticast ¶
func (*ErrorInterfaceLocalMulticast) Error ¶
func (e *ErrorInterfaceLocalMulticast) Error() string
type ErrorInvalidIP ¶
type ErrorInvalidIP struct {
Value string
}
func (*ErrorInvalidIP) Error ¶
func (e *ErrorInvalidIP) Error() string
type ErrorLinkLocalMulticast ¶
func (*ErrorLinkLocalMulticast) Error ¶
func (e *ErrorLinkLocalMulticast) Error() string
type ErrorLinkLocalUnicast ¶
func (*ErrorLinkLocalUnicast) Error ¶
func (e *ErrorLinkLocalUnicast) Error() string
type ErrorLoopback ¶
func (*ErrorLoopback) Error ¶
func (e *ErrorLoopback) Error() string
type ErrorMulticast ¶
func (*ErrorMulticast) Error ¶
func (e *ErrorMulticast) Error() string
type ErrorNameUnmatched ¶
type ErrorNameUnmatched struct { Expected PermissionName Actual PermissionName }
func (*ErrorNameUnmatched) Error ¶
func (e *ErrorNameUnmatched) Error() string
type ErrorPrivate ¶
func (*ErrorPrivate) Error ¶
func (e *ErrorPrivate) Error() string
type ErrorUnspecified ¶
func (*ErrorUnspecified) Error ¶
func (e *ErrorUnspecified) Error() string
type IPPolicyPermissioner ¶
type IPPolicyPermissioner struct {
// contains filtered or unexported fields
}
func DisallowIPPolicy ¶
func DisallowIPPolicy(policies ...IPPolicy) IPPolicyPermissioner
func (IPPolicyPermissioner) RequestPermission ¶
func (p IPPolicyPermissioner) RequestPermission(ctx context.Context, pd PermissionDescriptor) (bool, error)
type PermissionDescriptor ¶
type PermissionDescriptor struct { Name PermissionName `json:"name"` // run Command string `json:"command,omitempty"` // read, write, ffi Path string `json:"path,omitempty"` // net Host *HostPort `json:"host,omitempty"` // env Variable string `json:"variable,omitempty"` // sys Kind SysKind `json:"kind,omitempty"` }
func LineToPermissionDescriptor ¶
func LineToPermissionDescriptor(line string) (*PermissionDescriptor, bool)
func ParsePermissionDescriptor ¶
func ParsePermissionDescriptor(name string, target string) (*PermissionDescriptor, bool)
type PermissionName ¶
type PermissionName string
const ( PermissionNameRun PermissionName = "run" PermissionNameRead PermissionName = "read" PermissionNameWrite PermissionName = "write" PermissionNameNet PermissionName = "net" PermissionNameEnv PermissionName = "env" PermissionNameSys PermissionName = "sys" PermissionNameFfi PermissionName = "ffi" PermissionNameHrtime PermissionName = "hrtime" )
type Permissioner ¶
type Permissioner interface {
RequestPermission(ctx context.Context, pd PermissionDescriptor) (bool, error)
}
type RunFileError ¶
func (*RunFileError) Error ¶
func (e *RunFileError) Error() string
func (*RunFileError) Unwrap ¶
func (e *RunFileError) Unwrap() error
type RunFileOptions ¶
type RunFileResult ¶
func (*RunFileResult) Wrap ¶
func (r *RunFileResult) Wrap(err error) error
type RunGoValueOptions ¶
type RunGoValueOptions struct { // TargetScript is the content of the target script. TargetScript string // Input is the input. Input interface{} }
type RunGoValueResult ¶
type Runner ¶
type Runner struct { // Permissioner manages the permissions of the target script. Permissioner Permissioner }
func (*Runner) RunFile ¶
func (r *Runner) RunFile(ctx context.Context, opts RunFileOptions) (*RunFileResult, error)
func (*Runner) RunGoValue ¶
func (r *Runner) RunGoValue(ctx context.Context, opts RunGoValueOptions) (*RunGoValueResult, error)
type SysKind ¶
type SysKind string
const ( SysKindAll SysKind = "" SysKindLoadavg SysKind = "loadavg" SysKindHostname SysKind = "hostname" SysKindSystemMemoryInfo SysKind = "systemMemoryInfo" SysKindNetworkInterfaces SysKind = "networkInterfaces" SysKindosRelease SysKind = "osRelease" //nolint:revive SysKindosUid SysKind = "uid" //nolint:revive SysKindosGid SysKind = "gid" )
func ParseSysKind ¶
Click to show internal directories.
Click to hide internal directories.