Help us shape the future of Go! Take the 2026 Go Developer Survey

permissions

package
v0.0.95 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package permissions defines recipe grants independently of JobDB's token format.

Index

Constants

View Source
const Version = 1

Variables

This section is empty.

Functions

func WithAccess

func WithAccess(ctx context.Context, access *Access) context.Context

Types

type Access

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

Access checks every use before consulting a resolver, including cached ones. Callbacks belong to the controller and are never serialized into task input.

func FromContext

func FromContext(ctx context.Context) *Access

func NewAccess

func NewAccess(ctx context.Context, grant JobDB, resolve ResolveFunc, submit SubmitFunc) *Access

func (*Access) CheckSecrets

func (a *Access) CheckSecrets(names []string) error

func (*Access) Context

func (a *Access) Context() context.Context

func (*Access) Grant

func (a *Access) Grant() JobDB

func (*Access) LimitDeadline

func (a *Access) LimitDeadline(deadline time.Time) context.CancelFunc

LimitDeadline narrows helper calls as soon as an operation-local timeout is known. Already issued credentials stay private to the trusted helper; later calls use a credential bounded by the narrower deadline.

func (*Access) Resolve

func (a *Access) Resolve(ctx context.Context, names []string) (jobdb.SecretResolveResult, error)

func (*Access) Submit

func (a *Access) Submit(ctx context.Context, job jobdb.SubmitJob) (jobref.Ref, error)

type Issuer

type Issuer interface {
	IssueRestrictedLease(context.Context, TaskDelegator, JobDB, time.Time) (jobdb.ExecutionLease, error)
}

Issuer is the single integration boundary for credential creation. The deadline is an optional operation limit; JobDB supplies execution bounds.

type JobDB

type JobDB struct {
	Secrets SecretPermissions `yaml:"secrets,omitempty" json:"secrets,omitempty"`
	Jobs    JobPermissions    `yaml:"jobs,omitempty" json:"jobs,omitempty"`
}

func (JobDB) Validate

func (p JobDB) Validate() error

type JobDBIssuer

type JobDBIssuer struct{}

JobDBIssuer uses task-scoped local attenuation. The caller context controls cancellation only; its request timeout must not become a credential deadline.

func (JobDBIssuer) IssueRestrictedLease

func (i JobDBIssuer) IssueRestrictedLease(ctx context.Context, task TaskDelegator, grant JobDB, deadline time.Time) (jobdb.ExecutionLease, error)

type JobPermissions

type JobPermissions struct {
	Submit bool `yaml:"submit,omitempty" json:"submit,omitempty"`
}

type Limit

type Limit struct {
	JobDB *JobDB `yaml:"jobdb,omitempty" json:"jobdb,omitempty"`
}

type ResolveFunc

type ResolveFunc func(context.Context, []string) (jobdb.SecretResolveResult, error)

type SecretPermissions

type SecretPermissions struct {
	Resolve []string `yaml:"resolve,omitempty" json:"resolve,omitempty"`
}

type Spec

type Spec struct {
	JobDB *JobDB `yaml:"jobdb,omitempty" json:"jobdb,omitempty"`
	Limit *Limit `yaml:"limit,omitempty" json:"limit,omitempty"`
}

Spec is common node metadata. A nil JobDB inherits; a nonnil empty grant denies.

func (Spec) JSONSchema

func (Spec) JSONSchema() *jsonschema.Schema

func (*Spec) UnmarshalYAML

func (p *Spec) UnmarshalYAML(n *yaml.Node) error

Reject unknown fields, nulls, aliases and merges rather than silently ignoring an intended restriction. This strictness is local to the permission subtree.

func (*Spec) Validate

func (p *Spec) Validate() error

type State

type State struct {
	Version int    `json:"version"`
	Grant   *JobDB `json:"grant,omitempty"`
	Limit   *JobDB `json:"limit,omitempty"`
}

State is immutable lexical policy, serialized with each task invocation. It preserves the distinction between explicit grants and automatic Git defaults.

func (State) Enter

func (s State) Enter(spec *Spec, boundary bool) (State, error)

func (State) Resolve

func (s State) Resolve(gitSecrets []string) (JobDB, error)

func (*State) UnmarshalJSON

func (s *State) UnmarshalJSON(raw []byte) error

type SubmitFunc

type SubmitFunc func(context.Context, jobdb.SubmitJob) (jobref.Ref, error)

type TaskDelegator

type TaskDelegator interface {
	CreateDelegation(context.Context, jobdb.CreateDelegationRequest) (jobdb.RenewableExecutionLease, error)
}

TaskDelegator is the live task's engine-owned delegation capability. A copy of workflow.TaskContext preserves it; a reconstructed context does not.

Jump to

Keyboard shortcuts

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