policy

package
v1.234.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package policy supplies plugin collectors for the shared CEL and Starlark policy engine.

Index

Constants

View Source
const OperationTest = "test"

OperationTest gates running a plugin's conformance fixtures and authored tests. It acts on an explicit local development directory with no release provenance, so it is deliberately not subject to plugins.policy.require_signature: an author must be able to test an unsigned local plugin before there is anything to sign. Organizations restrict it with rules such as `input.operation == 'test'`, optionally combined with `input.development`. Compiling a plugin (`plugin build`) is not a policy operation: it admits nothing and runs no plugin code.

Variables

This section is empty.

Functions

func DevelopmentPath

func DevelopmentPath(project, directory string) string

DevelopmentPath renders a local plugin directory for policy input.

Inside the project directory it is a clean forward-slash path relative to it, with symlinks resolved, so a rule can compare it against relative allow-roots such as `build/`. A directory outside the project, or one that cannot be related to it, is returned absolute and slash-normalized instead. The result never contains a `..` segment, so a relative allow-root cannot match a directory that escapes the project.

func Login

func Login(ctx context.Context, host string) error

Login admits storing registry credentials without exposing the username or token.

func Package

func Package(ctx context.Context, operation, source string, definition *manifest.Config, options ...Option) error

Package checks inspected metadata before installing or activating executable code. It never treats a catalog entry or lockfile verification label as authenticated metadata.

func Source

func Source(ctx context.Context, operation, source string, options ...Option) error

Source checks the actual repository before network access or cached reuse. An empty source represents local development, including conformance testing.

Types

type Option

type Option func(*options)

Option supplies inspected evidence and the artifact origin.

func WithCache

func WithCache() Option

WithCache identifies verified cached bytes selected through a project lock.

func WithDigest

func WithDigest(digest string) Option

WithDigest supplies the inspected release index digest.

func WithExtensions

func WithExtensions(registry *extension.Registry) Option

WithExtensions supplies registered contracts for metadata-only capability discovery.

func WithLayout

func WithLayout() Option

WithLayout identifies an explicit local OCI import, whose claimed repository has not been contacted by this operation.

func WithPath

func WithPath(path string) Option

WithPath supplies the policy path of a local build, as returned by DevelopmentPath. It is exposed as input.path only for origin development and is ignored for every other origin.

type Registry

type Registry struct{ Next oci.Registry }

Registry admits each actual destination before OCI resolves credentials or performs I/O. It also covers discovery, publication, deletion, and signature attachment transport.

func (Registry) Delete

func (r Registry) Delete(ctx context.Context, ref name.Digest) error

Delete admits remote artifact deletion; local removal remains possible.

func (Registry) Get

Get admits fetching plugin or catalog metadata.

func (Registry) Head

func (r Registry) Head(ctx context.Context, ref name.Reference) (*v1.Descriptor, error)

Head admits reading an OCI descriptor.

func (Registry) Referrers

func (r Registry) Referrers(ctx context.Context, ref name.Digest) (v1.ImageIndex, error)

Referrers preserves signature discovery while enforcing destination policy.

func (Registry) Tags

func (r Registry) Tags(ctx context.Context, repository name.Repository) ([]string, error)

Tags admits release discovery.

func (Registry) WriteImage

func (r Registry) WriteImage(ctx context.Context, ref name.Reference, img v1.Image) error

WriteImage admits catalog and signature publication.

func (Registry) WriteIndex

func (r Registry) WriteIndex(ctx context.Context, ref name.Reference, index v1.ImageIndex) error

WriteIndex admits plugin publication.

Jump to

Keyboard shortcuts

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