evidence

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SignatureStatusSigned   = "signed"
	SignatureStatusUnsigned = "unsigned"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentSignerContext added in v0.15.0

type AgentSignerContext struct {
	Claims *authn.AgentClaims
	Agent  *relational.Agent
	Key    *relational.AgentServiceAccountKey
}

type ComponentDefinitionResolver

type ComponentDefinitionResolver interface {
	ResolveOrUpsertComponentDefinition(input templates.ResolveOrUpsertComponentDefinitionInput) (*templates.ResolveOrUpsertComponentDefinitionResult, error)
	FindSystemComponentsByDefinedComponentIDs(definedComponentIDs []uuid.UUID) ([]relational.SystemComponent, error)
}

ComponentDefinitionResolver resolves or creates ComponentDefinition + DefinedComponent records from evidence labels and returns the SystemComponents linked to those DefinedComponents.

type CreateEvidenceParams

type CreateEvidenceParams struct {
	Evidence       relational.Evidence
	Components     []relational.SystemComponent
	InventoryItems []relational.InventoryItem
	Activities     []relational.Activity
	Subjects       []relational.AssessmentSubject
	Labels         []relational.Labels
	Signer         *SignerContext
}

type EvidenceService

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

func NewEvidenceService

func NewEvidenceService(db *gorm.DB, logger *zap.SugaredLogger, cfg *config.Config, riskEnqueuer RiskJobEnqueuer, opts ...EvidenceServiceOption) *EvidenceService

func (*EvidenceService) Create

func (*EvidenceService) GetByID

func (s *EvidenceService) GetByID(id uuid.UUID) (*relational.Evidence, error)

func (*EvidenceService) GetControlByID

func (s *EvidenceService) GetControlByID(id string) (*relational.Control, error)

func (*EvidenceService) GetFilterByID

func (s *EvidenceService) GetFilterByID(id uuid.UUID) (*relational.Filter, error)

func (*EvidenceService) GetHistory

func (s *EvidenceService) GetHistory(streamUUID uuid.UUID) ([]relational.Evidence, error)

func (*EvidenceService) GetHistoryPaginated added in v0.15.0

func (s *EvidenceService) GetHistoryPaginated(streamUUID uuid.UUID, limit, offset int) ([]relational.Evidence, int64, error)

func (*EvidenceService) GetLatestByUUID

func (s *EvidenceService) GetLatestByUUID(streamUUID uuid.UUID) (*relational.Evidence, error)

func (*EvidenceService) GetLatestForFilters

func (s *EvidenceService) GetLatestForFilters(filters ...labelfilter.Filter) ([]relational.Evidence, error)

func (*EvidenceService) GetSignatureByID added in v0.15.0

func (s *EvidenceService) GetSignatureByID(id uuid.UUID) (*SignatureDetail, error)

func (*EvidenceService) GetStatusCountsAtPoint

func (s *EvidenceService) GetStatusCountsAtPoint(filter labelfilter.Filter, endBefore *time.Time) ([]StatusCount, error)

func (*EvidenceService) GetStatusCountsByFilters

func (s *EvidenceService) GetStatusCountsByFilters(filters ...labelfilter.Filter) ([]StatusCount, error)

func (*EvidenceService) GetStatusCountsByUUIDAtPoint

func (s *EvidenceService) GetStatusCountsByUUIDAtPoint(streamUUID uuid.UUID, endBefore *time.Time) ([]StatusCount, error)

func (*EvidenceService) Search

func (s *EvidenceService) Search(filter labelfilter.Filter) ([]relational.Evidence, error)

func (*EvidenceService) SearchPaginated added in v0.15.0

func (s *EvidenceService) SearchPaginated(filter labelfilter.Filter, opts SearchOptions) ([]relational.Evidence, int64, error)

func (*EvidenceService) VerifyByID added in v0.15.0

func (s *EvidenceService) VerifyByID(id uuid.UUID) (*VerificationResult, error)

type EvidenceServiceOption

type EvidenceServiceOption func(*EvidenceService)

func WithComponentDefinitionResolver

func WithComponentDefinitionResolver(resolver ComponentDefinitionResolver) EvidenceServiceOption

type RiskJobEnqueuer

type RiskJobEnqueuer interface {
	EnqueueRiskProcessEvidence(ctx context.Context, evidenceID uuid.UUID, evidenceEnd, status string) error
}

RiskJobEnqueuer interface to avoid circular imports

type SearchOptions added in v0.15.0

type SearchOptions struct {
	Limit         int
	Offset        int
	Name          string
	SortBy        SearchSortBy
	SortDirection SearchSortDirection
}

type SearchSortBy added in v0.15.0

type SearchSortBy string
const (
	SearchSortByLastSeenAt SearchSortBy = "lastSeenAt"
	SearchSortByName       SearchSortBy = "name"
	SearchSortByStatus     SearchSortBy = "status"
)

type SearchSortDirection added in v0.15.0

type SearchSortDirection string
const (
	SearchSortDirectionAsc  SearchSortDirection = "asc"
	SearchSortDirectionDesc SearchSortDirection = "desc"
)

type SignatureDetail added in v0.15.0

type SignatureDetail struct {
	Status    string                        `json:"status"`
	Signature *relational.EvidenceSignature `json:"signature,omitempty"`
}

type SignerContext added in v0.15.0

type SignerContext struct {
	User  *UserSignerContext
	Agent *AgentSignerContext
}

func NewAgentSignerContext added in v0.15.0

func NewAgentSignerContext(claims *authn.AgentClaims, agent *relational.Agent, key *relational.AgentServiceAccountKey) *SignerContext

func NewUserSignerContextFromClaims added in v0.15.0

func NewUserSignerContextFromClaims(claims *authn.UserClaims) *SignerContext

func (*SignerContext) IsEmpty added in v0.15.0

func (s *SignerContext) IsEmpty() bool

func (*SignerContext) SubmittedByValue added in v0.15.0

func (s *SignerContext) SubmittedByValue() string

type SigningService added in v0.15.0

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

func NewSigningService added in v0.15.0

func NewSigningService(privateKey *rsa.PrivateKey) *SigningService

func (*SigningService) SignEvidence added in v0.15.0

type StatusCount

type StatusCount struct {
	Count  int64  `json:"count"`
	Status string `json:"status"`
}

type UserSignerContext added in v0.15.0

type UserSignerContext struct {
	Claims *authn.UserClaims
}

type VerificationChecks added in v0.15.0

type VerificationChecks struct {
	HashMatch            bool `json:"hash_match"`
	SignatureValid       bool `json:"signature_valid"`
	TemporalValid        bool `json:"temporal_valid"`
	SignedContentMatches bool `json:"signed_content_matches"`
}

type VerificationResult added in v0.15.0

type VerificationResult struct {
	Status      string                              `json:"status"`
	Signature   *relational.EvidenceSignature       `json:"signature,omitempty"`
	IsValid     bool                                `json:"is_valid"`
	Checks      VerificationChecks                  `json:"checks"`
	Errors      []string                            `json:"errors,omitempty"`
	ContentHash *relational.Hash                    `json:"content_hash,omitempty"`
	Signer      *relational.EvidenceSignatureSigner `json:"signer,omitempty"`
	Claims      *relational.EvidenceSignatureClaims `json:"claims,omitempty"`
	SignedAt    *time.Time                          `json:"signed_at,omitempty"`
}

Jump to

Keyboard shortcuts

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