estate

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package estate is the platform-neutral model of a whole cryptographic estate: the things found (certificates, algorithms, software, protocol configuration) and the observations that say who saw them, how, and how strongly.

It is a projection. The documents the product stores (TLS scan reports, host CBOMs, imported CBOMs) remain the source of truth and are never rewritten; everything here can be dropped and rebuilt from them (PRD-003 REQ-MOD-1, ENG-HANDOFF-002 D1). The package does no I/O and imports no store, operating system or network package, so a projection is a pure function that golden tests can pin.

Host and network evidence stay separate (ADR-0006): every observation carries the stream it came from, and a join between streams is a labelled link, never a rewritten claim. Strength reuses the evidence package's classes, so no observation here claims more than the rung it rests on.

Index

Constants

View Source
const (
	RuleCertificate = "J1-certificate-fingerprint" // the endpoint's leaf certificate is held on a host
	RuleName        = "J2-endpoint-name"           // the endpoint's host name is the machine's name
	RuleSAN         = "J3-san-covers-name"         // the leaf certificate names the machine
	RuleManual      = "manual"                     // a person said so
)

Rule IDs, exactly the rules of RESEARCH-003 section 4.2. There is no fuzzy or similarity rule.

View Source
const (
	KindCertificate = "certificate" // key: SHA-256 fingerprint
	KindAlgorithm   = "algorithm"   // key: evidence.AlgorithmKey
	KindSoftware    = "software"    // key: package URL, else name@version
	KindProvider    = "provider"    // key: evidence.ProviderKey
	KindProtocol    = "protocol"    // a protocol version: SSLv3, TLSv1.2 ...
	KindSuite       = "suite"       // a TLS cipher suite, by IANA code point
	KindGroup       = "group"       // a TLS key-exchange group, by IANA code point
)

Entity kinds. An entity is a thing with a stable identity that several observations, from several sources, can be about.

View Source
const (
	RelPresents   = "presents"   // a service showed this in a handshake (certificate)
	RelOffers     = "offers"     // a service accepts this (protocol, suite, group)
	RelNegotiates = "negotiates" // what a current client actually gets
	RelContains   = "contains"   // a host holds this (software, certificate, provider)
	RelCapable    = "capable"    // something present can perform this algorithm
)

Relations say how a system, through a source, stands to an entity.

View Source
const (
	MethodTLSServerHello = "tls.server-hello@1"
	MethodTLSCertificate = "tls.certificate@1"
	MethodTLSRetry       = "tls.hello-retry@1"
	MethodCBOMImport     = "cbom.document@1"
)

Method names for observations that are not made by a host sensor. Host sensors keep the method IDs declared in the evidence package.

View Source
const (
	QualityAuthoritative = string(evidence.QualityAuthoritative)
	QualityParsed        = string(evidence.QualityParsed)
	QualityHeuristic     = string(evidence.QualityHeuristic)
	QualitySampled       = string(evidence.QualitySampled)
)

Method qualities, reused from the evidence package.

View Source
const (
	MaxKeyLen  = 2048
	MaxNameLen = 512
	MaxAttrLen = 1024
)

Limits on strings that came from a certificate, a document or a host. They are attacker-controlled and are carried as data, never interpreted.

View Source
const (
	MethodImportSource = "cbom.import.source@1"
	MethodImportHost   = "cbom.import.host@1"
)

Methods for observations made from an imported document.

View Source
const (
	MethodSSHKexInit  = "ssh.kexinit@1"   // the server's own algorithm lists
	MethodSSHKexReply = "ssh.kex-reply@1" // a key exchange carried out to the server's reply
)

Method names for SSH observations (PRD-008 REQ-SHO-5).

View Source
const WidelySharedCap = 25

WidelySharedCap is how many systems may hold one certificate before it is treated as shared infrastructure (a wildcard, a load-balanced certificate) and joins nothing (SR-15).

Variables

This section is empty.

Functions

func CertificateKey

func CertificateKey(sha256hex string) string

CertificateKey is the canonical key of a certificate: its SHA-256 fingerprint over the DER encoding, lower-case hex.

func GroupKey

func GroupKey(id uint16) string

GroupKey is the key of a TLS group by IANA code point.

func ProtocolKey

func ProtocolKey(version string) string

ProtocolKey is the key of a protocol version.

func SHA256Hex

func SHA256Hex(b []byte) string

SHA256Hex is the hex SHA-256 of b, exported for callers that record document identity.

func SoftwareKey

func SoftwareKey(purl, name, version string) string

SoftwareKey is the canonical key of a piece of software: its package URL when it has one, otherwise its name and version.

func SuiteKey

func SuiteKey(id uint16) string

SuiteKey and GroupKey key TLS registry entries by IANA code point.

func Validate

func Validate(stream Stream, o Observation) error

Validate rejects an observation that could carry something it should not. It is the second line of defence after the projections' own cleaning: a hostile string that got through would be refused here rather than stored.

Types

type AssetInfo

type AssetInfo struct {
	ID       int64
	SystemID int64
	Kind     string // "tls-endpoint" or "host"
	Name     string
	Host     string // the address host of an endpoint, or the machine name of a host
	// FirstParty is true when this product's own scanner (for an endpoint) or collector (for a
	// host) is a current source of the asset, so its name is not just an uploaded label.
	FirstParty bool
}

AssetInfo is what correlation needs to know about an asset.

type Candidate

type Candidate struct {
	AssetID  int64
	SystemID int64 // the system that would receive the asset
	Strength Strength
	Rules    []RuleHit
	// AutoConfirm is true only for a strong, unambiguous candidate every datum of which came from
	// this product's own scanner and collector (REQ-COR-4).
	AutoConfirm bool
	// Ambiguous is true when the same evidence points at several systems: nothing is joined
	// automatically and each candidate says how many others it competes with.
	Ambiguous bool
	Note      string
	// contains filtered or unexported fields
}

Candidate proposes that an endpoint asset belongs to a system.

func Correlate

func Correlate(sn Snapshot) []Candidate

Correlate proposes joins between endpoints and systems.

type CertSighting

type CertSighting struct {
	Fingerprint string
	SystemID    int64
	AssetID     int64 // 0 for an import, which belongs to a system directly
	Stream      Stream
	Class       SourceClass
	Leaf        bool     // a presented certificate in leaf position
	DNSNames    []string // the certificate's names, lower-case
	Where       string   // a short, bounded description for the explanation
}

CertSighting is one current sighting of an end-entity certificate.

type Entity

type Entity struct {
	Kind  string
	Key   string
	Name  string
	Attrs map[string]string
}

Entity is a thing found. Key is canonical: the same thing seen by two methods, in two documents, has the same Key, which is what lets the graph say "this certificate was seen at this endpoint and in that store".

func CertificateEntity

func CertificateEntity(c tlsprobe.CertInfo) Entity

CertificateEntity builds the certificate entity for a parsed certificate. Subject, issuer and names are display strings from the certificate and are attacker controlled: they are cleaned and length-capped here and escaped again on render.

type ImportKind

type ImportKind string

ImportKind says what kind of evidence a third-party document is, which decides the strongest thing its content may be read as (ENG-HANDOFF-002 DN-3, PRD-003 REQ-ING-5).

const (
	// ImportSource: made by reading source code or a repository (CBOMkit's scanners, cdxgen). It
	// says what code REFERENCES, not what is deployed: read as "capable, from source", never as present.
	ImportSource ImportKind = "static-source"
	// ImportHost: made by looking at a machine's files or network ports (CBOM-Lens, Theia,
	// this product's own collector). Read as "present"; a certificate as held.
	ImportHost ImportKind = "host"
	// ImportGeneric: a producer we do not recognise. Read at the weakest honest level.
	ImportGeneric ImportKind = "generic"
)

The import kinds.

type Observation

type Observation struct {
	Entity   Entity
	Relation string
	// Via is the key of a related entity that explains the observation: for an
	// algorithm "capable" of, the software that provides it.
	Via     string
	Rung    evidence.Rung
	Class   evidence.Class
	Method  string
	Quality string
	// Attrs are attributes of the observation itself, not of the entity.
	Attrs map[string]string
}

Observation is one statement about an entity, made through a source.

func FromSSHReport

func FromSSHReport(rep *sshprobe.Report) []Observation

FromSSHReport projects one SSH scan report into observations: the protocol, every advertised algorithm the catalogue knows as offered, the negotiated choices as negotiated, and the host key algorithms the server presented. Like a TLS report, every fact was read from the server's own reply (E3), and anything not read produces nothing.

func FromScanReport

func FromScanReport(rep *tlsprobe.Report) []Observation

FromScanReport projects one TLS scan report into observations. Every fact in a report was read from a server's own reply, so each is network-stream evidence at the "exercised" rung (E3): the server did this in front of us. Anything the report marks unsupported, refused or inconclusive produces no observation, and an incomplete report says so through its source, not by inventing absences.

Nothing is dropped that the report carries: protocols, suites, groups, and every presented certificate are all here, so the graph can answer what the report could (REQ-MOD-3).

type Result

type Result struct {
	Observations  []Observation
	Uninterpreted Uninterpreted
	// Accounting for imports: every component of the document is either interpreted (it produced
	// observations or contributed to one, like a public key giving a certificate its size) or
	// counted as not interpreted, so Components == Interpreted + NotInterpreted always holds and
	// nothing is dropped unaccounted (PRD-003 REQ-ING-7, AC-ING-1).
	Components     int
	Interpreted    int
	NotInterpreted int
}

Result is a projection of a CBOM: what was understood and what was not.

func FromHostCBOM

func FromHostCBOM(bom *cdx.BOM) Result

FromHostCBOM projects a host inventory CBOM into observations on the host stream. A CBOM this product made carries the evidence rung, method and method quality of every component in `cipherhorizon:*` properties, and those are read back exactly. A component without them (an older or third-party document) is projected at the weakest honest reading: present, method quality "sampled".

Nothing here can establish more than the document says: a rung the host stream may not hold ("exercised") is refused by Validate, and the document's own claims about trust play no part.

func FromImportedCBOM

func FromImportedCBOM(bom *cdx.BOM, kind ImportKind) Result

FromImportedCBOM projects a third-party CBOM into observations on the imported stream. It can only ever say things an import may say: nothing it produces is bound, loaded or exercised (Validate refuses those for the imported stream), and what the document claims about its own subject, producer or trust plays no part. Whatever it cannot model is counted in Uninterpreted, never dropped silently.

type RuleHit

type RuleHit struct {
	ID     string `json:"id"`
	Detail string `json:"detail"`
}

RuleHit is one rule that fired and the values that made it fire.

type Snapshot

type Snapshot struct {
	Assets    []AssetInfo
	Sightings []CertSighting
	// KeepSameSystem includes pairs whose asset already belongs to the candidate system. The store
	// sets it to learn whether a confirmed link is still supported after the join itself made the
	// two share a system; it never proposes such a pair as a new link.
	KeepSameSystem bool
}

Snapshot is everything Correlate reads.

type SourceClass

type SourceClass string

SourceClass says who produced a document and therefore how far it is trusted (SECARCH-001 section 2). Trust attaches to the channel, never to what a document says about itself.

const (
	ClassScanner   SourceClass = "scanner"   // this server's own TLS prober
	ClassCollector SourceClass = "collector" // this product's collector, over an authenticated channel
	ClassImported  SourceClass = "imported"  // any other document: untrusted, provenance recorded
	ClassOperator  SourceClass = "operator"  // a person, audited
)

The source classes.

func (SourceClass) FirstParty

func (c SourceClass) FirstParty() bool

FirstParty reports whether the class is produced by this product's own authenticated components. Only first-party data may auto-confirm a link.

func (SourceClass) Valid

func (c SourceClass) Valid() bool

Valid reports whether c is a known class.

type Stream

type Stream string

Stream says what kind of observation a record is. host and network are the two streams of ADR-0006; imported is the third, for third-party documents.

const (
	StreamHost     Stream = "host"
	StreamNetwork  Stream = "network"
	StreamImported Stream = "imported"
)

The streams.

func (Stream) Valid

func (s Stream) Valid() bool

Valid reports whether s is a known stream.

type Strength

type Strength string

Strength is a fixed label from a fixed table, never a computed score.

const (
	StrengthStrong Strength = "strong"
	StrengthMedium Strength = "medium"
	StrengthWeak   Strength = "weak"
)

The strengths.

type Uninterpreted

type Uninterpreted map[string]int

Uninterpreted counts what a document held that the projection could not turn into an observation, by reason. It is what lets a report say "we did not understand N components" instead of silently dropping them (REQ-ING-7).

Jump to

Keyboard shortcuts

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