registry

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAuthorizationRevisions = errors.New("authorization revisions are invalid")
	ErrAuthorizationRevisionConflict = errors.New("authorization revision conflict")
	ErrAuthorizationSchemaIncomplete = errors.New("authorization schema is incomplete")
)
View Source
var ErrManagementRevisionConflict = errors.New("management revision conflict")
View Source
var ErrNotFound = errors.New("plugin record not found")
View Source
var ErrOwnerScopeMismatch = errors.New("plugin registry owner scope mismatch")
View Source
var ErrSourceSecurityFloorRollback = errors.New("source security floor rollback")

Functions

func RunnableTrustState

func RunnableTrustState(state TrustState) bool

func ValidateSourceSecurityFloorTransition added in v0.5.0

func ValidateSourceSecurityFloorTransition(existing SourceSecurityFloor, next SourceSecurityFloor) error

ValidateSourceSecurityFloorTransition checks a candidate floor without mutating the registry. Callers that need to stage other work before the floor is persisted can use this read-only preflight; PutSourceSecurityFloor remains the final atomic validation boundary.

Types

type AuthorizationDecision added in v0.5.0

type AuthorizationDecision struct {
	State              AuthorizationState        `json:"state"`
	Allowed            bool                      `json:"allowed"`
	MissingPermissions []string                  `json:"missing_permissions,omitempty"`
	PolicyEvaluation   security.PolicyEvaluation `json:"policy_evaluation"`
}

type AuthorizationRevisionConflictError added in v0.5.0

type AuthorizationRevisionConflictError struct {
	PluginInstanceID string
	Expected         AuthorizationRevisions
	Actual           AuthorizationRevisions
}

func (*AuthorizationRevisionConflictError) Error added in v0.5.0

func (*AuthorizationRevisionConflictError) Unwrap added in v0.5.0

type AuthorizationRevisions added in v0.5.0

type AuthorizationRevisions struct {
	PolicyRevision     uint64 `json:"policy_revision"`
	ManagementRevision uint64 `json:"management_revision"`
	RevokeEpoch        uint64 `json:"revoke_epoch"`
}

func AuthorizationRevisionsFromRecord added in v0.5.0

func AuthorizationRevisionsFromRecord(record PluginRecord) AuthorizationRevisions

type AuthorizationSnapshot added in v0.5.0

type AuthorizationSnapshot struct {
	Plugin PluginRecord           `json:"plugin"`
	Grants []permissions.Record   `json:"grants"`
	Policy *security.PolicyRecord `json:"policy,omitempty"`
}

type AuthorizationState added in v0.5.0

type AuthorizationState struct {
	PluginInstanceID  string                 `json:"plugin_instance_id"`
	PluginVersion     string                 `json:"plugin_version"`
	ActiveFingerprint string                 `json:"active_fingerprint"`
	TrustState        TrustState             `json:"trust_state"`
	EnableState       EnableState            `json:"enable_state"`
	Revisions         AuthorizationRevisions `json:"revisions"`
}

type AuthorizationStore added in v0.5.0

type AuthorizationStore interface {
	GrantPermission(ctx context.Context, req permissions.GrantRequest, expected AuthorizationRevisions) (AuthorizationSnapshot, error)
	RevokePermission(ctx context.Context, req permissions.RevokeRequest, expected AuthorizationRevisions) (AuthorizationSnapshot, error)
	PutSecurityPolicy(ctx context.Context, req security.PutPolicyRequest, expected AuthorizationRevisions) (AuthorizationSnapshot, error)
	DeleteSecurityPolicy(ctx context.Context, pluginInstanceID string, now time.Time, expected AuthorizationRevisions) (AuthorizationSnapshot, error)
	GetAuthorization(ctx context.Context, pluginInstanceID string) (AuthorizationSnapshot, error)
	ListAuthorization(ctx context.Context) ([]AuthorizationSnapshot, error)
	Authorize(ctx context.Context, req AuthorizeRequest) (AuthorizationDecision, error)
}

type AuthorizeRequest added in v0.5.0

type AuthorizeRequest struct {
	PluginInstanceID string                 `json:"plugin_instance_id"`
	Method           string                 `json:"method"`
	PermissionIDs    []string               `json:"permission_ids,omitempty"`
	Expected         AuthorizationRevisions `json:"expected"`
	Now              time.Time              `json:"-"`
}

type EnableState

type EnableState string
const (
	EnableDisabled             EnableState = "disabled"
	EnableEnabled              EnableState = "enabled"
	EnableDisabledByPolicy     EnableState = "disabled_by_policy"
	EnableDisabledIncompatible EnableState = "disabled_incompatible"
)

type LocalImportProvenance

type LocalImportProvenance struct {
	ImportID       string `json:"import_id"`
	Distribution   string `json:"distribution"`
	PolicyEpoch    string `json:"policy_epoch"`
	UnsignedPolicy string `json:"unsigned_policy"`
	AssessedAt     string `json:"assessed_at"`
}

type ManagementRevisionConflictError added in v0.5.0

type ManagementRevisionConflictError struct {
	PluginInstanceID string
	Expected         uint64
	Actual           uint64
}

func (*ManagementRevisionConflictError) Error added in v0.5.0

func (*ManagementRevisionConflictError) Unwrap added in v0.5.0

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) AbortInstall added in v0.5.0

func (s *MemoryStore) AbortInstall(ctx context.Context, pluginInstanceID string) error

func (*MemoryStore) Authorize added in v0.5.0

func (*MemoryStore) BindRetained added in v0.5.0

func (s *MemoryStore) BindRetained(ctx context.Context, expected plugindata.Binding, targetPluginInstanceID string, targetExpectedManagementRevision uint64, targetShape plugindata.Shape, now time.Time) (plugindata.Binding, error)

func (*MemoryStore) CleanupExpired added in v0.5.0

func (s *MemoryStore) CleanupExpired(ctx context.Context, now time.Time, expected []plugindata.Binding) ([]plugindata.Binding, error)

func (*MemoryStore) CommitEnable added in v0.5.0

func (s *MemoryStore) CommitEnable(ctx context.Context, expectedManagementRevision uint64, expected *plugindata.Binding, next plugindata.Binding, shape plugindata.Shape, now time.Time) error

func (*MemoryStore) CommitUninstall added in v0.5.0

func (*MemoryStore) CreateObject added in v0.5.0

func (s *MemoryStore) CreateObject(ctx context.Context, scope sessionctx.ScopeKind, object plugindata.Object) error

func (*MemoryStore) DeleteObject added in v0.5.0

func (s *MemoryStore) DeleteObject(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, objectID string) error

func (*MemoryStore) DeleteRetained added in v0.5.0

func (s *MemoryStore) DeleteRetained(ctx context.Context, expected plugindata.Binding) error

func (*MemoryStore) DeleteSecurityPolicy added in v0.5.0

func (s *MemoryStore) DeleteSecurityPolicy(ctx context.Context, pluginInstanceID string, now time.Time, expected AuthorizationRevisions) (AuthorizationSnapshot, error)

func (*MemoryStore) GetAuthorization added in v0.5.0

func (s *MemoryStore) GetAuthorization(ctx context.Context, pluginInstanceID string) (AuthorizationSnapshot, error)

func (*MemoryStore) GetBinding added in v0.5.0

func (s *MemoryStore) GetBinding(ctx context.Context, pluginInstanceID string) (plugindata.Binding, bool, error)

func (*MemoryStore) GetObject added in v0.5.0

func (s *MemoryStore) GetObject(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, objectID string) (plugindata.Object, bool, error)

func (*MemoryStore) GetPlugin

func (s *MemoryStore) GetPlugin(ctx context.Context, pluginInstanceID string) (PluginRecord, error)

func (*MemoryStore) GetSourceSecurityFloor

func (s *MemoryStore) GetSourceSecurityFloor(_ context.Context, sourceID string) (SourceSecurityFloor, error)

func (*MemoryStore) GrantPermission added in v0.5.0

func (*MemoryStore) ListAllBindingsForMaintenance added in v0.5.0

func (s *MemoryStore) ListAllBindingsForMaintenance(_ context.Context, cursor string, limit int) ([]plugindata.MaintenanceBinding, string, error)

func (*MemoryStore) ListAllObjectsForMaintenance added in v0.5.0

func (s *MemoryStore) ListAllObjectsForMaintenance(_ context.Context, cursor string, limit int) ([]plugindata.MaintenanceObject, string, error)

func (*MemoryStore) ListAuthorization added in v0.5.0

func (s *MemoryStore) ListAuthorization(ctx context.Context) ([]AuthorizationSnapshot, error)

func (*MemoryStore) ListBindings added in v0.5.0

func (s *MemoryStore) ListBindings(ctx context.Context, cursor string, limit int) ([]plugindata.Binding, string, error)

func (*MemoryStore) ListObjects added in v0.5.0

func (s *MemoryStore) ListObjects(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, cursor string, limit int) ([]plugindata.Object, string, error)

func (*MemoryStore) ListPlugins

func (s *MemoryStore) ListPlugins(ctx context.Context) ([]PluginRecord, error)

func (*MemoryStore) PutPlugin

func (s *MemoryStore) PutPlugin(ctx context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)

func (*MemoryStore) PutSecurityPolicy added in v0.5.0

func (*MemoryStore) PutSourceSecurityFloor

func (s *MemoryStore) PutSourceSecurityFloor(_ context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)

func (*MemoryStore) RevokePermission added in v0.5.0

func (*MemoryStore) SetEnableState

func (s *MemoryStore) SetEnableState(ctx context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)

func (*MemoryStore) SwapImport added in v0.5.0

func (s *MemoryStore) SwapImport(ctx context.Context, expectedManagementRevision uint64, expected *plugindata.Binding, next plugindata.Binding, shape plugindata.Shape, now time.Time) error

type PluginRecord

type PluginRecord struct {
	OwnerEnvHash             string                   `json:"-"`
	PluginInstanceID         string                   `json:"plugin_instance_id"`
	PublisherID              string                   `json:"publisher_id"`
	PluginID                 string                   `json:"plugin_id"`
	Version                  string                   `json:"version"`
	ActiveFingerprint        string                   `json:"active_fingerprint"`
	PackageHash              string                   `json:"package_hash"`
	ManifestHash             string                   `json:"manifest_hash"`
	EntriesHash              string                   `json:"entries_hash"`
	TrustState               TrustState               `json:"trust_state"`
	TrustAssessment          TrustAssessment          `json:"trust_assessment"`
	SourcePolicySnapshotHash string                   `json:"source_policy_snapshot_hash,omitempty"`
	SourcePolicySnapshot     map[string]any           `json:"source_policy_snapshot,omitempty"`
	LocalImportProvenance    *LocalImportProvenance   `json:"local_import_provenance,omitempty"`
	CapabilityContracts      []capabilitycontract.Pin `json:"capability_contracts,omitempty"`
	EnableState              EnableState              `json:"enable_state"`
	DisabledReason           string                   `json:"disabled_reason,omitempty"`
	PolicyRevision           uint64                   `json:"policy_revision"`
	ManagementRevision       uint64                   `json:"management_revision"`
	RevokeEpoch              uint64                   `json:"revoke_epoch"`
	Manifest                 manifest.Manifest        `json:"manifest"`
	PackageEntries           []pluginpkg.Entry        `json:"package_entries"`
	RuntimeRequirement       *RuntimeRequirement      `json:"runtime_requirement,omitempty"`
	VersionHistory           []PluginVersion          `json:"version_history,omitempty"`
	InstalledAt              time.Time                `json:"installed_at"`
	EnabledAt                *time.Time               `json:"enabled_at,omitempty"`
	UpdatedAt                time.Time                `json:"updated_at"`
	DeletedAt                *time.Time               `json:"deleted_at,omitempty"`
	Metadata                 map[string]string        `json:"metadata,omitempty"`
}

type PluginVersion

type PluginVersion struct {
	Version                  string                   `json:"version"`
	ActiveFingerprint        string                   `json:"active_fingerprint"`
	PackageHash              string                   `json:"package_hash"`
	ManifestHash             string                   `json:"manifest_hash"`
	EntriesHash              string                   `json:"entries_hash"`
	TrustState               TrustState               `json:"trust_state"`
	TrustAssessment          TrustAssessment          `json:"trust_assessment"`
	SourcePolicySnapshotHash string                   `json:"source_policy_snapshot_hash,omitempty"`
	SourcePolicySnapshot     map[string]any           `json:"source_policy_snapshot,omitempty"`
	LocalImportProvenance    *LocalImportProvenance   `json:"local_import_provenance,omitempty"`
	CapabilityContracts      []capabilitycontract.Pin `json:"capability_contracts,omitempty"`
	Manifest                 manifest.Manifest        `json:"manifest"`
	PackageEntries           []pluginpkg.Entry        `json:"package_entries"`
	RuntimeRequirement       *RuntimeRequirement      `json:"runtime_requirement,omitempty"`
	ActivatedAt              time.Time                `json:"activated_at"`
	Metadata                 map[string]string        `json:"metadata,omitempty"`
}

type PutOptions

type PutOptions struct {
	Now time.Time `json:"-"`
}

type RuntimeRequirement added in v0.5.0

type RuntimeRequirement struct {
	MinVersion       string                 `json:"min_version"`
	SupportedTargets []runtimetarget.Target `json:"supported_targets,omitempty"`
}

RuntimeRequirement is the exact worker-runtime compatibility contract that was verified for an installed package version. UI-only packages leave it nil.

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, path string) (*SQLiteStore, error)

func (*SQLiteStore) AbortInstall added in v0.5.0

func (s *SQLiteStore) AbortInstall(ctx context.Context, pluginInstanceID string) error

func (*SQLiteStore) Authorize added in v0.5.0

func (*SQLiteStore) BindRetained added in v0.5.0

func (s *SQLiteStore) BindRetained(ctx context.Context, expected plugindata.Binding, targetPluginInstanceID string, targetExpectedManagementRevision uint64, targetShape plugindata.Shape, now time.Time) (plugindata.Binding, error)

func (*SQLiteStore) CleanupExpired added in v0.5.0

func (s *SQLiteStore) CleanupExpired(ctx context.Context, now time.Time, expected []plugindata.Binding) ([]plugindata.Binding, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) CommitEnable added in v0.5.0

func (s *SQLiteStore) CommitEnable(ctx context.Context, expectedManagementRevision uint64, expected *plugindata.Binding, next plugindata.Binding, shape plugindata.Shape, now time.Time) error

func (*SQLiteStore) CommitUninstall added in v0.5.0

func (*SQLiteStore) CreateObject added in v0.5.0

func (s *SQLiteStore) CreateObject(ctx context.Context, scope sessionctx.ScopeKind, object plugindata.Object) error

func (*SQLiteStore) DeleteObject added in v0.5.0

func (s *SQLiteStore) DeleteObject(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, objectID string) error

func (*SQLiteStore) DeleteRetained added in v0.5.0

func (s *SQLiteStore) DeleteRetained(ctx context.Context, expected plugindata.Binding) error

func (*SQLiteStore) DeleteSecurityPolicy added in v0.5.0

func (s *SQLiteStore) DeleteSecurityPolicy(ctx context.Context, pluginInstanceID string, now time.Time, expected AuthorizationRevisions) (AuthorizationSnapshot, error)

func (*SQLiteStore) GetAuthorization added in v0.5.0

func (s *SQLiteStore) GetAuthorization(ctx context.Context, pluginInstanceID string) (AuthorizationSnapshot, error)

func (*SQLiteStore) GetBinding added in v0.5.0

func (s *SQLiteStore) GetBinding(ctx context.Context, pluginInstanceID string) (plugindata.Binding, bool, error)

func (*SQLiteStore) GetObject added in v0.5.0

func (s *SQLiteStore) GetObject(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, objectID string) (plugindata.Object, bool, error)

func (*SQLiteStore) GetPlugin

func (s *SQLiteStore) GetPlugin(ctx context.Context, pluginInstanceID string) (PluginRecord, error)

func (*SQLiteStore) GetSourceSecurityFloor

func (s *SQLiteStore) GetSourceSecurityFloor(ctx context.Context, sourceID string) (SourceSecurityFloor, error)

func (*SQLiteStore) GrantPermission added in v0.5.0

func (*SQLiteStore) ListAllBindingsForMaintenance added in v0.5.0

func (s *SQLiteStore) ListAllBindingsForMaintenance(ctx context.Context, cursor string, limit int) ([]plugindata.MaintenanceBinding, string, error)

func (*SQLiteStore) ListAllObjectsForMaintenance added in v0.5.0

func (s *SQLiteStore) ListAllObjectsForMaintenance(ctx context.Context, cursor string, limit int) ([]plugindata.MaintenanceObject, string, error)

func (*SQLiteStore) ListAuthorization added in v0.5.0

func (s *SQLiteStore) ListAuthorization(ctx context.Context) ([]AuthorizationSnapshot, error)

func (*SQLiteStore) ListBindings added in v0.5.0

func (s *SQLiteStore) ListBindings(ctx context.Context, cursor string, limit int) ([]plugindata.Binding, string, error)

func (*SQLiteStore) ListObjects added in v0.5.0

func (s *SQLiteStore) ListObjects(ctx context.Context, scope sessionctx.ScopeKind, pluginInstanceID, cursor string, limit int) ([]plugindata.Object, string, error)

func (*SQLiteStore) ListPlugins

func (s *SQLiteStore) ListPlugins(ctx context.Context) ([]PluginRecord, error)

func (*SQLiteStore) PutPlugin

func (s *SQLiteStore) PutPlugin(ctx context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)

func (*SQLiteStore) PutSecurityPolicy added in v0.5.0

func (*SQLiteStore) PutSourceSecurityFloor

func (s *SQLiteStore) PutSourceSecurityFloor(ctx context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)

func (*SQLiteStore) RevokePermission added in v0.5.0

func (*SQLiteStore) SetEnableState

func (s *SQLiteStore) SetEnableState(ctx context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)

func (*SQLiteStore) SwapImport added in v0.5.0

func (s *SQLiteStore) SwapImport(ctx context.Context, expectedManagementRevision uint64, expected *plugindata.Binding, next plugindata.Binding, shape plugindata.Shape, now time.Time) error

type SourceSecurityFloor

type SourceSecurityFloor struct {
	SourceID                 string    `json:"source_id"`
	PolicyEpoch              string    `json:"policy_epoch"`
	KeyRotationEpoch         string    `json:"key_rotation_epoch"`
	RevocationEpoch          string    `json:"revocation_epoch"`
	SourcePolicySnapshotHash string    `json:"source_policy_snapshot_hash"`
	RevocationMetadataSHA256 string    `json:"revocation_metadata_sha256"`
	UpdatedAt                time.Time `json:"updated_at"`
}

type Store

type Store interface {
	AuthorizationStore
	plugindata.Catalog
	PutPlugin(ctx context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)
	GetPlugin(ctx context.Context, pluginInstanceID string) (PluginRecord, error)
	ListPlugins(ctx context.Context) ([]PluginRecord, error)
	SetEnableState(ctx context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)
	CommitUninstall(ctx context.Context, req plugindata.CommitUninstallRequest) (plugindata.CommitUninstallResult, error)
	AbortInstall(ctx context.Context, pluginInstanceID string) error
	PutSourceSecurityFloor(ctx context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)
	GetSourceSecurityFloor(ctx context.Context, sourceID string) (SourceSecurityFloor, error)
}

type TrustAssessment

type TrustAssessment struct {
	TrustState           TrustState         `json:"trust_state"`
	ReasonCodes          []string           `json:"reason_codes,omitempty"`
	VerifiedHashes       TrustHashSet       `json:"verified_hashes"`
	VerifiedSignature    *VerifiedSignature `json:"verified_signature,omitempty"`
	TrustAssessmentEpoch string             `json:"trust_assessment_epoch,omitempty"`
	PolicyEpoch          string             `json:"policy_epoch,omitempty"`
	RevocationEpoch      string             `json:"revocation_epoch,omitempty"`
	Metadata             map[string]string  `json:"metadata,omitempty"`
}

type TrustHashSet

type TrustHashSet struct {
	PackageSHA256  string `json:"package_sha256"`
	ManifestSHA256 string `json:"manifest_sha256"`
	EntriesSHA256  string `json:"entries_sha256"`
}

type TrustState

type TrustState string
const (
	TrustVerified        TrustState = "verified"
	TrustUnsignedLocal   TrustState = "unsigned_local"
	TrustUntrusted       TrustState = "untrusted"
	TrustNeedsReview     TrustState = "needs_review"
	TrustUnavailable     TrustState = "trust_unavailable"
	TrustBlockedSecurity TrustState = "blocked_security"
)

type VerifiedSignature

type VerifiedSignature struct {
	Algorithm string `json:"algorithm"`
	KeyID     string `json:"key_id"`
}

Jump to

Keyboard shortcuts

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