Documentation
¶
Overview ¶
Package proofevidence defines the fail-closed authorization boundary for live and bounded Braidplane Proof observations.
Index ¶
- Constants
- Variables
- func NoWriteGuaranteeStrings() []string
- func OutcomeStrings() []string
- func RunnerTrustStrings() []string
- type ActivitySnapshot
- type Authorization
- type Endpoint
- type Grant
- type Limits
- type MetadataIO
- type MetadataObserver
- type MetadataPlan
- type MetadataRoute
- type NoWriteGuarantee
- func (i NoWriteGuarantee) IsANoWriteGuarantee() bool
- func (i NoWriteGuarantee) MarshalJSON() ([]byte, error)
- func (i NoWriteGuarantee) MarshalText() ([]byte, error)
- func (i NoWriteGuarantee) String() string
- func (i *NoWriteGuarantee) UnmarshalJSON(data []byte) error
- func (i *NoWriteGuarantee) UnmarshalText(text []byte) error
- type OperationPolicy
- type Outcome
- type Policy
- func (p Policy) Authorize(request Request, authorization Authorization) (Grant, error)
- func (p Policy) Resume(request Request, authorization Authorization, deadline time.Time) (Grant, error)
- func (p Policy) ResumeAt(request Request, authorization Authorization, deadline, now time.Time) (Grant, error)
- type Request
- type Result
- type RunnerTrust
- type Usage
- type Worker
Constants ¶
const Capability = "proof_evidence_runner"
Variables ¶
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 ¶
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 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 ¶
Accept rejects every incomplete, failed, stale, mismatched, or over-budget observation before it can support a passed or failed Proof claim.
func (Grant) Check ¶
Check verifies that an admitted grant is still usable. Current policy and distributed dispatch admission must also be checked by the runner.
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 ¶
OutcomeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Outcome) IsAOutcome ¶
IsAOutcome returns "true" if the value is listed in the enum definition. "false" otherwise
func (Outcome) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Outcome
func (Outcome) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for Outcome
func (*Outcome) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Outcome
func (*Outcome) UnmarshalText ¶
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.
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.
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 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.