permissions

package
v0.0.0-...-9732733 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidValue = errors.New("invalid value for field 'permissions'")

Functions

func AddWorkflowLevelPermissions

func AddWorkflowLevelPermissions(inputYaml string) (string, error)

Types

type Action

type Action struct {
	Name         string      `yaml:"name"`
	DefaultToken string      `yaml:"default-token"`
	EnvKey       string      `yaml:"env-key"`
	Permissions  Permissions `yaml:"permissions"`
}

type ActionInput

type ActionInput struct {
	Input     string `yaml:"input"`
	IsDefault bool   `yaml:"is-default"`
}

type ActionMetadata

type ActionMetadata struct {
	Name             string            `yaml:"name"`
	GitHubToken      GitHubToken       `yaml:"github-token"`
	AllowedEndpoints []AllowedEndpoint `yaml:"outbound-endpoints"`
}

func GetActionKnowledgeBase

func GetActionKnowledgeBase(action string) (*ActionMetadata, error)

type ActionPermissions

type ActionPermissions struct {
	Actions Actions `yaml:"actions"`
}

type ActionScopePermission

type ActionScopePermission struct {
	Permission string
	Reason     string
	Expression string
}

type ActionScopePermissions

type ActionScopePermissions struct {
	Scopes map[string]ActionScopePermission
}

func (*ActionScopePermissions) UnmarshalYAML

func (p *ActionScopePermissions) UnmarshalYAML(unmarshal func(interface{}) error) error

type Actions

type Actions map[string]Action

type AllowedEndpoint

type AllowedEndpoint struct {
	FQDN   string `yaml:"fqdn"`
	Port   int    `yaml:"port"`
	Reason string `yaml:"reason"`
}

type Env

type Env map[string]string

type GitHubContent

type GitHubContent struct {
	Content string `json:"content"`
}

type GitHubToken

type GitHubToken struct {
	ActionInput             ActionInput            `yaml:"action-input"`
	EnvironmentVariableName string                 `yaml:"environment-variable-name"`
	Permissions             ActionScopePermissions `yaml:"permissions"`
}

type Job

type Job struct {
	Permissions Permissions `yaml:"permissions"`
	// RunsOn      []string    `yaml:"runs-on"`
	Steps []Step `yaml:"steps"`
}

type JobError

type JobError struct {
	JobName string
	Errors  []string
}

type JobState

type JobState struct {
	CurrentNpmPackageRegistry string
	CurrentNuGetSourceURL     string
	CurrentNugetAuthToken     string

	MissingActions    []string
	Errors            []error
	ActionPermissions *ActionPermissions
}

type Jobs

type Jobs map[string]Job

type Permission

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

type Permissions

type Permissions struct {
	Scopes   map[string]string
	ReadAll  bool
	WriteAll bool
	IsSet    bool
}

func (*Permissions) UnmarshalYAML

func (p *Permissions) UnmarshalYAML(unmarshal func(interface{}) error) error

type SecureWorkflowReponse

type SecureWorkflowReponse struct {
	FinalOutput           string
	IsChanged             bool
	HasErrors             bool
	AlreadyHasPermissions bool
	IncorrectYaml         bool
	JobErrors             []JobError
	MissingActions        []string
}

func AddJobLevelPermissions

func AddJobLevelPermissions(inputYaml string) (*SecureWorkflowReponse, error)

type Step

type Step struct {
	Run  string `yaml:"run"`
	Uses string `yaml:"uses"`
	With With   `yaml:"with"`
	Env  Env    `yaml:"env"`
}

type With

type With map[string]string

type Workflow

type Workflow struct {
	Name        string      `yaml:"name"`
	Permissions Permissions `yaml:"permissions"`
	// On   string `yaml:"on"`
	Jobs Jobs `yaml:"jobs"`
}

Jump to

Keyboard shortcuts

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