model

package
v0.1.0-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MaximumEventWireBytes = 1024 * 1024
	MaximumPayloadBytes   = 256 * 1024
)

Variables

This section is empty.

Functions

func EventToProto

func EventToProto(event EventEnvelope) (*antiflockv1.EventEnvelope, error)

EventToProto is the single mapping between the Core model and the locked antiflock.v1 wire contract. Signing and durable storage both use this path.

func RejectUnknownFields

func RejectUnknownFields(message proto.Message) error

func ValidateEvidenceAt

func ValidateEvidenceAt(event EventEnvelope, now time.Time) error

Types

type AuditEntry

type AuditEntry struct {
	Sequence     uint64          `json:"sequence"`
	ID           string          `json:"id"`
	KeyID        string          `json:"keyId"`
	OccurredAt   time.Time       `json:"occurredAt"`
	ActorType    string          `json:"actorType"`
	ActorID      string          `json:"actorId"`
	Action       string          `json:"action"`
	ResourceType string          `json:"resourceType"`
	ResourceID   string          `json:"resourceId"`
	Outcome      string          `json:"outcome"`
	Details      json.RawMessage `json:"details"`
	PreviousHash string          `json:"previousHash"`
	EntryHash    string          `json:"entryHash"`
	Signature    string          `json:"signature"`
}

type Check

type Check struct {
	Kind     string          `json:"kind" yaml:"kind"`
	Expected json.RawMessage `json:"expected" yaml:"expected"`
}

type DecisionType

type DecisionType string
const (
	DecisionAllow          DecisionType = "ALLOW"
	DecisionHold           DecisionType = "HOLD"
	DecisionBlock          DecisionType = "BLOCK"
	DecisionRequireConsent DecisionType = "REQUIRE_CONSENT"
	DecisionAllowOnce      DecisionType = "ALLOW_ONCE"
)

type Entity

type Entity struct {
	ID          string          `json:"id"`
	Type        string          `json:"type"`
	DisplayName string          `json:"displayName"`
	Attributes  json.RawMessage `json:"attributes"`
	CreatedAt   time.Time       `json:"createdAt"`
	UpdatedAt   time.Time       `json:"updatedAt"`
}

type EventEnvelope

type EventEnvelope struct {
	ID              string              `json:"id"`
	SchemaVersion   string              `json:"schemaVersion"`
	DeploymentID    string              `json:"deploymentId"`
	NodeID          string              `json:"nodeId"`
	Kind            string              `json:"kind"`
	ObservedAt      time.Time           `json:"observedAt"`
	ReceivedAt      time.Time           `json:"receivedAt"`
	Sequence        uint64              `json:"sequence"`
	BootID          string              `json:"bootId"`
	Classification  EvidenceClass       `json:"classification"`
	Confidence      float32             `json:"confidence"`
	Sensitivity     Sensitivity         `json:"sensitivity"`
	PayloadTypeURL  string              `json:"payloadTypeUrl"`
	Payload         []byte              `json:"payload"`
	Evidence        []EvidenceReference `json:"evidence,omitempty"`
	CorrelationID   string              `json:"correlationId,omitempty"`
	CausationID     string              `json:"causationId,omitempty"`
	PayloadDigest   IntegrityDigest     `json:"payloadDigest"`
	SourceSignature Signature           `json:"sourceSignature"`
	IngestOrdinal   uint64              `json:"ingestOrdinal,omitempty"`
}

func EventFromProto

func EventFromProto(event *antiflockv1.EventEnvelope) (EventEnvelope, error)

func (EventEnvelope) Validate

func (event EventEnvelope) Validate() error

func (EventEnvelope) ValidateSourceContent

func (event EventEnvelope) ValidateSourceContent() error

type EvidenceClass

type EvidenceClass string
const (
	EvidenceDetected  EvidenceClass = "DETECTED"
	EvidenceVerified  EvidenceClass = "VERIFIED"
	EvidenceReported  EvidenceClass = "REPORTED"
	EvidenceInferred  EvidenceClass = "INFERRED"
	EvidenceSuspected EvidenceClass = "SUSPECTED"
	EvidenceUnknown   EvidenceClass = "UNKNOWN"
)

func (EvidenceClass) Valid

func (c EvidenceClass) Valid() bool

type EvidenceReference

type EvidenceReference struct {
	ID                string            `json:"id"`
	Role              string            `json:"role,omitempty"`
	Classification    EvidenceClass     `json:"classification"`
	SourceType        string            `json:"sourceType,omitempty"`
	Source            string            `json:"source"`
	SourceURI         string            `json:"sourceUri,omitempty"`
	ObservedAt        time.Time         `json:"observedAt"`
	ReceivedAt        *time.Time        `json:"receivedAt,omitempty"`
	LastVerifiedAt    *time.Time        `json:"lastVerifiedAt,omitempty"`
	ExpiresAt         *time.Time        `json:"expiresAt,omitempty"`
	Confidence        float32           `json:"confidence"`
	Sensitivity       Sensitivity       `json:"sensitivity,omitempty"`
	LocationPrecision string            `json:"locationPrecision,omitempty"`
	Explanation       string            `json:"explanation"`
	Integrity         IntegrityDigest   `json:"integrity,omitempty"`
	SourceLicense     string            `json:"sourceLicense,omitempty"`
	Attributes        map[string]string `json:"attributes,omitempty"`
}

type Finding

type Finding struct {
	ID                string              `json:"id"`
	RuleID            string              `json:"ruleId"`
	NodeID            string              `json:"nodeId"`
	Status            string              `json:"status"`
	Severity          FindingSeverity     `json:"severity"`
	Classification    EvidenceClass       `json:"classification"`
	Confidence        float32             `json:"confidence"`
	Title             string              `json:"title"`
	Condition         string              `json:"condition"`
	Consequence       string              `json:"consequence"`
	CurrentFact       string              `json:"currentFact"`
	ExpectedFact      string              `json:"expectedFact"`
	Explanation       string              `json:"explanation"`
	RecommendedAction string              `json:"recommendedAction"`
	FalsePositiveNote string              `json:"falsePositiveNote"`
	Evidence          []EvidenceReference `json:"evidence"`
	OpenedAt          time.Time           `json:"openedAt"`
	UpdatedAt         time.Time           `json:"updatedAt"`
	ResolvedAt        *time.Time          `json:"resolvedAt,omitempty"`
}

type FindingSeverity

type FindingSeverity string
const (
	SeverityInfo     FindingSeverity = "INFO"
	SeverityLow      FindingSeverity = "LOW"
	SeverityMedium   FindingSeverity = "MEDIUM"
	SeverityHigh     FindingSeverity = "HIGH"
	SeverityCritical FindingSeverity = "CRITICAL"
)

type IntegrityDigest

type IntegrityDigest struct {
	Algorithm string `json:"algorithm"`
	Digest    []byte `json:"digest"`
}

type Node

type Node struct {
	ID                       string          `json:"id"`
	Name                     string          `json:"name"`
	Type                     string          `json:"type"`
	Platform                 string          `json:"platform"`
	PlatformVersion          string          `json:"platformVersion"`
	Status                   NodeStatus      `json:"status"`
	Tags                     []string        `json:"tags"`
	Capabilities             json.RawMessage `json:"capabilities"`
	CapabilitiesVerification string          `json:"capabilitiesVerification"`
	PublicKey                []byte          `json:"-"`
	CertificatePEM           string          `json:"certificatePem,omitempty"`
	EnrolledAt               time.Time       `json:"enrolledAt"`
	LastSeenAt               *time.Time      `json:"lastSeenAt,omitempty"`
	RevokedAt                *time.Time      `json:"revokedAt,omitempty"`
	LastPolicyRevision       uint64          `json:"lastPolicyRevision"`
}

type NodeStatus

type NodeStatus string
const (
	NodeActive    NodeStatus = "ACTIVE"
	NodeSuspended NodeStatus = "SUSPENDED"
	NodeRevoked   NodeStatus = "REVOKED"
)

type Plan

type Plan struct {
	ID            string       `json:"id"`
	Revision      uint64       `json:"revision"`
	NodeID        string       `json:"nodeId"`
	CreatedAt     time.Time    `json:"createdAt"`
	ExpiresAt     time.Time    `json:"expiresAt"`
	Preconditions []Check      `json:"preconditions"`
	Actions       []PlanAction `json:"actions"`
	Verifications []Check      `json:"verifications"`
	Rollback      []PlanAction `json:"rollback"`
	Signature     string       `json:"signature"`
}

type PlanAction

type PlanAction struct {
	Kind       string          `json:"kind" yaml:"kind"`
	Parameters json.RawMessage `json:"parameters" yaml:"parameters"`
	Risk       string          `json:"risk" yaml:"risk"`
}

type ProtectionSnapshot

type ProtectionSnapshot struct {
	NodeID             string           `json:"nodeId"`
	Status             ProtectionStatus `json:"status"`
	EvaluatedAt        time.Time        `json:"evaluatedAt"`
	NetworkTrust       string           `json:"networkTrust"`
	MeshConnected      *bool            `json:"meshConnected"`
	ApprovedExitActive *bool            `json:"approvedExitActive"`
	DNSProtected       *bool            `json:"dnsProtected"`
	RouteProtected     *bool            `json:"routeProtected"`
	TelemetryFresh     bool             `json:"telemetryFresh"`
	ReasonCodes        []string         `json:"reasonCodes"`
	FindingIDs         []string         `json:"findingIds"`
	PolicyRevision     uint64           `json:"policyRevision"`
}

type ProtectionStatus

type ProtectionStatus string
const (
	ProtectionProtected   ProtectionStatus = "PROTECTED"
	ProtectionDegraded    ProtectionStatus = "DEGRADED"
	ProtectionSuspicious  ProtectionStatus = "SUSPICIOUS"
	ProtectionExposed     ProtectionStatus = "EXPOSED"
	ProtectionUnknown     ProtectionStatus = "UNKNOWN"
	ProtectionUnavailable ProtectionStatus = "UNAVAILABLE"
)

type Relationship

type Relationship struct {
	ID             string              `json:"id"`
	SourceEntityID string              `json:"sourceEntityId"`
	TargetEntityID string              `json:"targetEntityId"`
	Type           string              `json:"type"`
	Classification EvidenceClass       `json:"classification"`
	Confidence     float32             `json:"confidence"`
	FirstSeen      time.Time           `json:"firstSeen"`
	LastSeen       time.Time           `json:"lastSeen"`
	Evidence       []EvidenceReference `json:"evidence"`
}

type SecureActionDecision

type SecureActionDecision struct {
	ActionID      string             `json:"actionId"`
	Decision      DecisionType       `json:"decision"`
	Protection    ProtectionSnapshot `json:"protection"`
	ReasonCodes   []string           `json:"reasonCodes"`
	Authorization string             `json:"authorization,omitempty"`
	ExpiresAt     *time.Time         `json:"expiresAt,omitempty"`
}

type SecureActionRequest

type SecureActionRequest struct {
	RequestID     string    `json:"requestId"`
	ApplicationID string    `json:"applicationId"`
	ActionType    string    `json:"actionType"`
	Destinations  []string  `json:"destinations"`
	DataClass     string    `json:"dataClass"`
	Sensitivity   string    `json:"sensitivity"`
	Deadline      time.Time `json:"deadline"`
}

type Sensitivity

type Sensitivity string
const (
	SensitivityPublic          Sensitivity = "PUBLIC"
	SensitivityInternal        Sensitivity = "INTERNAL"
	SensitivityOperatorPrivate Sensitivity = "OPERATOR_PRIVATE"
	SensitivityRestricted      Sensitivity = "RESTRICTED"
	SensitivitySecret          Sensitivity = "SECRET"
)

func (Sensitivity) Valid

func (s Sensitivity) Valid() bool

type Signature

type Signature struct {
	KeyID               string          `json:"keyId"`
	Algorithm           string          `json:"algorithm"`
	Value               []byte          `json:"value"`
	SignedAt            time.Time       `json:"signedAt"`
	Encoding            string          `json:"encoding"`
	SignedContentDigest IntegrityDigest `json:"signedContentDigest"`
	Domain              string          `json:"domain"`
}

func (Signature) Validate

func (signature Signature) Validate() error

Jump to

Keyboard shortcuts

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