proofevidence

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package proofevidence defines the fail-closed authorization boundary for live and bounded Braidplane Proof observations.

Index

Constants

View Source
const Capability = "proof_evidence_runner"

Variables

View Source
var ErrAuthorizationDenied = xerror.New(
	xerror.KindForbidden,
	"PROOF_EVIDENCE_AUTHORIZATION_DENIED",
	"Proof evidence authorization denied",
)

Functions

func NoWriteGuaranteeStrings

func NoWriteGuaranteeStrings() []string

NoWriteGuaranteeStrings returns a slice of all String values of the enum

func OutcomeStrings

func OutcomeStrings() []string

OutcomeStrings returns a slice of all String values of the enum

func RunnerTrustStrings

func RunnerTrustStrings() []string

RunnerTrustStrings returns a slice of all String values of the enum

Types

type ActivitySnapshot

type ActivitySnapshot struct {
	Starts  int64
	Results map[Outcome]int64
}

ActivitySnapshot contains deployment-wide counts over the last ten minutes. Starts describe execution admission, not proof that a provider request was sent.

type Authorization

type Authorization struct {
	ID            slug.Slug `json:"id"`
	UserSlug      slug.Slug `json:"user_slug,omitempty"`
	Capability    string    `json:"capability"`
	RequestDigest string    `json:"request_digest"`
	PolicyVersion string    `json:"policy_version"`
	AuthorizedAt  time.Time `json:"authorized_at"`
	ExpiresAt     time.Time `json:"expires_at"`
}

Authorization is an external policy decision bound to the canonical request digest. The service issuing it remains responsible for user and tenant checks.

type Endpoint

type Endpoint struct {
	Scheme string `json:"scheme"`
	Host   string `json:"host"`
	Port   uint16 `json:"port"`
}

type Grant

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

Grant is created only after the request, policy, and external authorization decision match. Executors receive the grant, never a bare request.

func (Grant) Accept

func (g Grant) Accept(result Result) error

Accept rejects every incomplete, failed, stale, mismatched, or over-budget observation before it can support a passed or failed Proof claim.

func (Grant) Check

func (g Grant) Check() error

Check verifies that an admitted grant is still usable. Current policy and distributed dispatch admission must also be checked by the runner.

func (Grant) Deadline

func (g Grant) Deadline() time.Time

Deadline includes time spent waiting for credentials or network access.

func (Grant) Remaining

func (g Grant) Remaining() time.Duration

Remaining uses local monotonic elapsed time against the authority's clock sample. Only authenticated delivery may supply a reference from another machine.

func (Grant) Request

func (g Grant) Request() Request

type Limits

type Limits struct {
	Timeout        time.Duration `json:"timeout"`
	MaxRows        int64         `json:"max_rows"`
	MaxBytes       int64         `json:"max_bytes"`
	MaxRequests    int64         `json:"max_requests"`
	MaxConcurrency int64         `json:"max_concurrency"`
	MaxRetries     int64         `json:"max_retries"`
	RateWindow     time.Duration `json:"rate_window"`
	MaxCostUnits   int64         `json:"max_cost_units"`
}

type MetadataIO

type MetadataIO interface {
	HTTPClient() *http.Client
	BeginNative(MetadataRoute) error
	DialContext(context.Context, string, string) (net.Conn, error)
}

MetadataIO confines each protocol to admitted I/O. Native observers charge their fixed metadata operation before dialing; socket bytes include authentication.

type MetadataObserver

type MetadataObserver interface {
	Plan() (MetadataPlan, error)
	ReadMetadata(context.Context, MetadataIO, []byte, Limits) (json.RawMessage, int64, Outcome)
}

MetadataObserver is trusted connector code constructed from protected resource configuration. Implementations must use only the supplied transport for I/O and return sanitized metadata, counting every field against the row limit. It is not an extension point for job-supplied code or request plans.

type MetadataPlan

type MetadataPlan struct {
	MaxConnections int                  `json:"max_connections"`
	ConnectorType  model.DataSourceType `json:"connector_type"`
	Operation      string               `json:"operation"`
	Resource       json.RawMessage      `json:"resource"`
	Target         Endpoint             `json:"target"`
	Egress         []Endpoint           `json:"egress"`
	Routes         []MetadataRoute      `json:"routes"`
}

MetadataPlan binds an exact resource and ordered request sequence to admission. Resource contains connector-owned identity JSON and must never enter logs.

func (MetadataPlan) Fingerprint

func (p MetadataPlan) Fingerprint() (string, error)

type MetadataRoute

type MetadataRoute struct{ Method, URL string }

type NoWriteGuarantee

type NoWriteGuarantee int
const (
	NoWriteUnknown          NoWriteGuarantee = iota // unknown
	NoWriteReadOnlyAPI                              // provider_read_only_api
	NoWriteNativeValidation                         // native_validation
	NoWriteIsolatedTarget                           // isolated_disposable_target
)

func NoWriteGuaranteeString

func NoWriteGuaranteeString(s string) (NoWriteGuarantee, error)

NoWriteGuaranteeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func NoWriteGuaranteeValues

func NoWriteGuaranteeValues() []NoWriteGuarantee

NoWriteGuaranteeValues returns all values of the enum

func (NoWriteGuarantee) IsANoWriteGuarantee

func (i NoWriteGuarantee) IsANoWriteGuarantee() bool

IsANoWriteGuarantee returns "true" if the value is listed in the enum definition. "false" otherwise

func (NoWriteGuarantee) MarshalJSON

func (i NoWriteGuarantee) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for NoWriteGuarantee

func (NoWriteGuarantee) MarshalText

func (i NoWriteGuarantee) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for NoWriteGuarantee

func (NoWriteGuarantee) String

func (i NoWriteGuarantee) String() string

func (*NoWriteGuarantee) UnmarshalJSON

func (i *NoWriteGuarantee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for NoWriteGuarantee

func (*NoWriteGuarantee) UnmarshalText

func (i *NoWriteGuarantee) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for NoWriteGuarantee

type OperationPolicy

type OperationPolicy struct {
	ConnectorType       model.DataSourceType
	Operation           string
	EvidenceLevel       model.ProofEvidenceLevel
	NoWriteGuarantee    NoWriteGuarantee
	ProviderEndpoints   []Endpoint
	Limits              Limits
	RunnerTrust         RunnerTrust
	AllowPrivateNetwork bool
}

type Outcome

type Outcome int
const (
	OutcomeUnknown           Outcome = iota // unknown
	OutcomeComplete                         // complete
	OutcomeUnsupported                      // unsupported
	OutcomeDenied                           // denied
	OutcomeUnreachable                      // unreachable
	OutcomeRateLimited                      // rate_limited
	OutcomeTimedOut                         // timed_out
	OutcomeOverBudget                       // over_budget
	OutcomeCanceled                         // canceled
	OutcomeWorkerLost                       // worker_lost
	OutcomePartial                          // partial
	OutcomeProviderError                    // provider_error
	OutcomeAttestationFailed                // attestation_failed
	OutcomeCleanupUncertain                 // cleanup_uncertain
)

func OutcomeString

func OutcomeString(s string) (Outcome, error)

OutcomeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func OutcomeValues

func OutcomeValues() []Outcome

OutcomeValues returns all values of the enum

func (Outcome) IsAOutcome

func (i Outcome) IsAOutcome() bool

IsAOutcome returns "true" if the value is listed in the enum definition. "false" otherwise

func (Outcome) MarshalJSON

func (i Outcome) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Outcome

func (Outcome) MarshalText

func (i Outcome) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Outcome

func (Outcome) String

func (i Outcome) String() string

func (*Outcome) UnmarshalJSON

func (i *Outcome) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Outcome

func (*Outcome) UnmarshalText

func (i *Outcome) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Outcome

type Policy

type Policy struct {
	Enabled              bool
	Version              string
	MaxAuthorizationTTL  time.Duration
	MaxEvidenceRetention time.Duration
	MaxMetadataRetention time.Duration
	Operations           []OperationPolicy
}

func (Policy) Authorize

func (p Policy) Authorize(request Request, authorization Authorization) (Grant, error)

Authorize is the only constructor for an executable Proof evidence grant.

func (Policy) Resume

func (p Policy) Resume(request Request, authorization Authorization, deadline time.Time) (Grant, error)

Resume revalidates an encrypted delivery without renewing its durable budget. The caller authenticates delivery and supplies the original ledger deadline.

func (Policy) ResumeAt

func (p Policy) ResumeAt(request Request, authorization Authorization, deadline, now time.Time) (Grant, error)

ResumeAt uses the authenticated coordinator clock sample, never executor wall time.

type Request

type Request struct {
	JobID                    slug.Slug                    `json:"job_id"`
	OrganizationSlug         slug.Slug                    `json:"organization_slug"`
	ProjectSlug              slug.Slug                    `json:"project_slug"`
	EnvironmentSlug          slug.Slug                    `json:"environment_slug"`
	CandidateSlug            slug.Slug                    `json:"candidate_slug"`
	Candidate                model.ProofCandidateIdentity `json:"candidate"`
	Claim                    model.ProofClaimIdentity     `json:"claim"`
	DataSourceSlug           slug.Slug                    `json:"data_source_slug"`
	CredentialDataSourceSlug slug.Slug                    `json:"credential_data_source_slug"`
	CredentialVersion        string                       `json:"credential_version"`
	TargetFingerprint        string                       `json:"target_fingerprint"`
	ConnectorType            model.DataSourceType         `json:"connector_type"`
	Operation                string                       `json:"operation"`
	EvidenceLevel            model.ProofEvidenceLevel     `json:"evidence_level"`
	Target                   Endpoint                     `json:"target"`
	Egress                   []Endpoint                   `json:"egress"`
	Limits                   Limits                       `json:"limits"`
	Worker                   Worker                       `json:"worker"`
	PolicyVersion            string                       `json:"policy_version"`
	EvidenceRetainUntil      time.Time                    `json:"evidence_retain_until"`
	MetadataRetainUntil      time.Time                    `json:"metadata_retain_until"`
}

Request contains identities and bounds only. It cannot carry credentials, provider payloads, query parameters, or receipt access authority.

func (Request) Digest

func (r Request) Digest() (string, error)

type Result

type Result struct {
	RequestDigest  string                   `json:"request_digest"`
	Outcome        Outcome                  `json:"outcome"`
	EvidenceLevel  model.ProofEvidenceLevel `json:"evidence_level"`
	EvidenceDigest string                   `json:"evidence_digest"`
	ObservedAt     time.Time                `json:"observed_at"`
	ExpiresAt      time.Time                `json:"expires_at"`
	Usage          Usage                    `json:"usage"`
}

Result intentionally has no provider-controlled text or raw payload field.

type RunnerTrust

type RunnerTrust int
const (
	RunnerTrustUnknown  RunnerTrust = iota // unknown
	RunnerTrustManaged                     // managed_worker
	RunnerTrustCustomer                    // customer_runner
)

func RunnerTrustString

func RunnerTrustString(s string) (RunnerTrust, error)

RunnerTrustString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func RunnerTrustValues

func RunnerTrustValues() []RunnerTrust

RunnerTrustValues returns all values of the enum

func (RunnerTrust) IsARunnerTrust

func (i RunnerTrust) IsARunnerTrust() bool

IsARunnerTrust returns "true" if the value is listed in the enum definition. "false" otherwise

func (RunnerTrust) MarshalJSON

func (i RunnerTrust) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for RunnerTrust

func (RunnerTrust) MarshalText

func (i RunnerTrust) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for RunnerTrust

func (RunnerTrust) String

func (i RunnerTrust) String() string

func (*RunnerTrust) UnmarshalJSON

func (i *RunnerTrust) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for RunnerTrust

func (*RunnerTrust) UnmarshalText

func (i *RunnerTrust) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for RunnerTrust

type Usage

type Usage struct {
	Duration       time.Duration `json:"duration"`
	Rows           int64         `json:"rows"`
	Bytes          int64         `json:"bytes"`
	Requests       int64         `json:"requests"`
	MaxConcurrency int64         `json:"max_concurrency"`
	Retries        int64         `json:"retries"`
	CostUnits      int64         `json:"cost_units"`
}

type Worker

type Worker struct {
	Identity          string      `json:"identity"`
	Trust             RunnerTrust `json:"trust"`
	AttestationDigest string      `json:"attestation_digest,omitempty"`
	PrivateNetwork    bool        `json:"private_network"`
}

Worker identifies the admitted executor assignment, independently of its delivery transport or database login. Runtime composition authenticates it.

Jump to

Keyboard shortcuts

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