access

package
v0.0.0-...-f332f66 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package access implements read-only SSH access inventory snapshots.

Index

Constants

View Source
const (
	SeverityCritical = "critical"
	SeverityHigh     = "high"
	SeverityMedium   = "medium"
	SeverityLow      = "low"
	SeverityInfo     = "info"
)
View Source
const (
	GraphNodeIdentityHint = "identity_hint"
	GraphNodeKey          = "key"
	GraphNodeAccount      = "account"
	GraphNodeHost         = "host"

	GraphEdgeClaims     = "claims"
	GraphEdgeAuthorizes = "authorizes"
	GraphEdgeOnHost     = "on_host"
)
View Source
const (
	IdentityMapSchemaVersion = "1"
	IdentityKindHuman        = "human"
	IdentityKindService      = "service"
	IdentityStatusActive     = "active"
	IdentityStatusOffboarded = "offboarded"
	ClaimStatusClaimed       = "claimed_by_identity"
	ClaimStatusVerified      = "possession_verified"
)
View Source
const (
	CoverageFull    = "full"
	CoveragePartial = "partial"
	CoverageFailed  = "failed"
)
View Source
const (
	OffboardingReportSchemaVersion = "1"
	OffboardingReportMode          = "report_only"
)
View Source
const (
	OffboardingCheckSchemaVersion = "1"
	OffboardingOutcomeComplete    = "complete"
	OffboardingOutcomePresent     = "still_present"
	OffboardingOutcomeUnknown     = "inconclusive"
)
View Source
const (
	OwnershipUnknown = "unknown"
	OwnershipOwned   = "owned"
	OwnershipShared  = "shared"
)
View Source
const (
	AccountModeLocal    = "local"
	AccountModeNSS      = "nss"
	AccountModeExplicit = "explicit"
)
View Source
const (
	UploadPlanSchemaVersion = "1"
	UploadArtifactType      = "access_snapshot"
	UploadPrivacyStandard   = "standard"
)
View Source
const (
	WorkspaceBundleSchemaVersion = "1"
	WorkspaceBundleArtifactType  = "workspace_access_review"
	MaxWorkspaceBundleBytes      = 512 << 20
)
View Source
const (
	WorkspaceOwnershipHistorySchemaVersion = "1"

	WorkspaceOwnershipChangeAdded   = "added"
	WorkspaceOwnershipChangeRemoved = "removed"
	WorkspaceOwnershipChangeChanged = "changed"
)
View Source
const FindingRuleVersion = "1"
View Source
const GraphSchemaVersion = "1"
View Source
const OwnershipReviewSchemaVersion = "1"
View Source
const SchemaVersion = "1"
View Source
const (
	WorkspaceHistorySchemaVersion = "1"
)
View Source
const (
	WorkspaceOffboardingHistorySchemaVersion = "1"
)

Variables

This section is empty.

Functions

func ContentDigest

func ContentDigest(data []byte) string

func CountFindingsAtOrAbove

func CountFindingsAtOrAbove(findings []Finding, threshold string) (int, error)

CountFindingsAtOrAbove returns how many findings meet the selected severity threshold. For example, "high" matches high and critical findings.

func IdentityMapDigest

func IdentityMapDigest(identityMap *IdentityMap) (string, error)

func NormalizeFailOnSeverity

func NormalizeFailOnSeverity(value string) (string, error)

NormalizeFailOnSeverity validates the explicit local policy threshold used by CLI/TUI audit gates. An empty value or "none" disables the gate.

func NormalizeSystemAccountSelection

func NormalizeSystemAccountSelection(mode string, accounts []string, limit int) (string, []string, int, error)

NormalizeSystemAccountSelection validates the requested account source and resolves a bounded per-host work budget. The returned account list is deduplicated and sorted so snapshots and remote commands are deterministic.

func NormalizeSystemCollectionLimits

func NormalizeSystemCollectionLimits(maxSourceBytes, maxTotalBytes int64) (int64, int64, error)

NormalizeSystemCollectionLimits resolves the bounded, per-host read budget. Zero means the documented default; hard caps protect both the remote host and the local snapshot process from an unexpectedly huge authorized_keys source.

func ParseSystemPreflight

func ParseSystemPreflight(data []byte) (*SystemSnapshot, []AccountSnapshot, error)

ParseSystemPreflight parses the bounded line protocol produced by the fixed preflight script. Unknown records/keys are ignored for forward compatibility.

func RenderAccessCSV

func RenderAccessCSV(snapshot *Snapshot) ([]byte, error)

RenderAccessCSV exports one row per observed authorized_keys entry. It is deterministic regardless of snapshot slice order and includes malformed entries so the CSV cannot silently make source problems disappear.

func RenderAccessGraphJSON

func RenderAccessGraphJSON(graph *AccessGraph) ([]byte, error)

func RenderAccessGraphText

func RenderAccessGraphText(graph *AccessGraph) string

func RenderDiffText

func RenderDiffText(diff Diff) string

func RenderFingerprintText

func RenderFingerprintText(snapshot *Snapshot, fingerprint string) string

func RenderHTML

func RenderHTML(snapshot *Snapshot) ([]byte, error)

func RenderHostAccessText

func RenderHostAccessText(snapshot *Snapshot, alias string) (string, bool)

RenderHostAccessText lists the observed account/key edges for one host.

func RenderOffboardingCheckCSV

func RenderOffboardingCheckCSV(check *OffboardingCheck) ([]byte, error)

func RenderOffboardingCheckHTML

func RenderOffboardingCheckHTML(check *OffboardingCheck) ([]byte, error)

func RenderOffboardingCheckJSON

func RenderOffboardingCheckJSON(check *OffboardingCheck) ([]byte, error)

func RenderOffboardingCheckText

func RenderOffboardingCheckText(check *OffboardingCheck) string

func RenderOffboardingReportCSV

func RenderOffboardingReportCSV(report *OffboardingReport) ([]byte, error)

func RenderOffboardingReportHTML

func RenderOffboardingReportHTML(report *OffboardingReport) ([]byte, error)

func RenderOffboardingReportJSON

func RenderOffboardingReportJSON(report *OffboardingReport) ([]byte, error)

func RenderOffboardingReportText

func RenderOffboardingReportText(report *OffboardingReport) string

func RenderOwnershipReviewCSV

func RenderOwnershipReviewCSV(review *OwnershipReview) ([]byte, error)

func RenderOwnershipReviewHTML

func RenderOwnershipReviewHTML(review *OwnershipReview) ([]byte, error)

func RenderOwnershipReviewJSON

func RenderOwnershipReviewJSON(review *OwnershipReview) ([]byte, error)

func RenderOwnershipReviewText

func RenderOwnershipReviewText(review *OwnershipReview) string

func RenderText

func RenderText(snapshot *Snapshot) string

func RenderUploadPlanJSON

func RenderUploadPlanJSON(plan *UploadPlan) ([]byte, error)

func RenderUploadPlanText

func RenderUploadPlanText(plan *UploadPlan) string

func RenderWorkspaceBundleJSON

func RenderWorkspaceBundleJSON(bundle *WorkspaceBundle) ([]byte, error)

func RenderWorkspaceBundleText

func RenderWorkspaceBundleText(bundle *WorkspaceBundle) string

func RenderWorkspaceDashboardCSVWithAuditEvidence

func RenderWorkspaceDashboardCSVWithAuditEvidence(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory) ([]byte, error)

func RenderWorkspaceDashboardExportTextWithAuditEvidence

func RenderWorkspaceDashboardExportTextWithAuditEvidence(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory, htmlPath, csvPath string) string

func RenderWorkspaceDashboardGateFailure

func RenderWorkspaceDashboardGateFailure(result WorkspaceDashboardGateResult) string

func RenderWorkspaceDashboardHTML

func RenderWorkspaceDashboardHTML(history *WorkspaceHistory) ([]byte, error)

RenderWorkspaceDashboardHTML creates a self-contained read-only projection of a validated workspace history. The latest snapshot drives current state; older plans are used only for the validated timeline.

func RenderWorkspaceDashboardHTMLWithAuditEvidence

func RenderWorkspaceDashboardHTMLWithAuditEvidence(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory) ([]byte, error)

RenderWorkspaceDashboardHTMLWithAuditEvidence joins optional current ownership, ownership history, and offboarding history artifacts. Every companion is reconciled before any untrusted value reaches the template.

func RenderWorkspaceDashboardHTMLWithEvidence

func RenderWorkspaceDashboardHTMLWithEvidence(history *WorkspaceHistory, ownership *OwnershipReview, offboardingHistory *WorkspaceOffboardingHistory) ([]byte, error)

RenderWorkspaceDashboardHTMLWithEvidence optionally joins the latest ownership review and a workspace-bound offboarding outcome history.

func RenderWorkspaceDashboardHTMLWithOwnership

func RenderWorkspaceDashboardHTMLWithOwnership(history *WorkspaceHistory, ownership *OwnershipReview) ([]byte, error)

RenderWorkspaceDashboardHTMLWithOwnership optionally joins an ownership review that strictly reconciles with the latest history snapshot.

func RenderWorkspaceDashboardText

func RenderWorkspaceDashboardText(history *WorkspaceHistory, outputPath string) string

func RenderWorkspaceDashboardTextWithAuditEvidence

func RenderWorkspaceDashboardTextWithAuditEvidence(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory, outputPath string) string

func RenderWorkspaceDashboardTextWithEvidence

func RenderWorkspaceDashboardTextWithEvidence(history *WorkspaceHistory, ownership *OwnershipReview, offboardingHistory *WorkspaceOffboardingHistory, outputPath string) string

func RenderWorkspaceDashboardTextWithOwnership

func RenderWorkspaceDashboardTextWithOwnership(history *WorkspaceHistory, ownership *OwnershipReview, outputPath string) string

func RenderWorkspaceHistoryJSON

func RenderWorkspaceHistoryJSON(history *WorkspaceHistory) ([]byte, error)

func RenderWorkspaceHistoryText

func RenderWorkspaceHistoryText(history *WorkspaceHistory) string

func RenderWorkspaceOffboardingHistoryJSON

func RenderWorkspaceOffboardingHistoryJSON(history *WorkspaceOffboardingHistory) ([]byte, error)

func RenderWorkspaceOffboardingHistoryText

func RenderWorkspaceOffboardingHistoryText(history *WorkspaceOffboardingHistory) string

func RenderWorkspaceOwnershipHistoryJSON

func RenderWorkspaceOwnershipHistoryJSON(history *WorkspaceOwnershipHistory) ([]byte, error)

func RenderWorkspaceOwnershipHistoryText

func RenderWorkspaceOwnershipHistoryText(history *WorkspaceOwnershipHistory) string

func ValidateAccessGraph

func ValidateAccessGraph(graph *AccessGraph) error

ValidateAccessGraph enforces the normalized graph v1 endpoint types, deterministic node identities, referential integrity, and summary counts.

func ValidateIdentityMap

func ValidateIdentityMap(identityMap *IdentityMap) error

func ValidateOffboardingCheck

func ValidateOffboardingCheck(check *OffboardingCheck) error

func ValidateOffboardingCheckAgainstInputs

func ValidateOffboardingCheckAgainstInputs(check *OffboardingCheck, baseline *OffboardingReport, beforeSnapshot *Snapshot, beforeReview *OwnershipReview, afterSnapshot *Snapshot, afterReview *OwnershipReview) error

func ValidateOffboardingReport

func ValidateOffboardingReport(report *OffboardingReport) error

func ValidateOffboardingReportAgainstInputs

func ValidateOffboardingReportAgainstInputs(report *OffboardingReport, snapshot *Snapshot, review *OwnershipReview) error

func ValidateOwnershipReview

func ValidateOwnershipReview(review *OwnershipReview) error

func ValidateOwnershipReviewAgainstSnapshot

func ValidateOwnershipReviewAgainstSnapshot(review *OwnershipReview, snapshot *Snapshot) error

ValidateOwnershipReviewAgainstSnapshot verifies that a standalone review is not merely internally consistent, but was derived from the selected snapshot and its embedded identity map. authorized_keys comments are deliberately excluded from this join: an upload plan may redact those unverified hints without changing ownership claims or observed access.

func ValidateSnapshot

func ValidateSnapshot(snapshot *Snapshot) error

ValidateSnapshot enforces the stable semantic invariants of snapshot schema v1. Readers remain forward-compatible with unknown JSON fields, but an artifact that claims v1 must reconcile its normalized observations and summary counters before reports or a future cloud client may consume it.

func ValidateUploadPlan

func ValidateUploadPlan(plan *UploadPlan) error

func ValidateWorkspaceBundle

func ValidateWorkspaceBundle(bundle *WorkspaceBundle) error

func ValidateWorkspaceHistory

func ValidateWorkspaceHistory(history *WorkspaceHistory) error

func ValidateWorkspaceOffboardingHistory

func ValidateWorkspaceOffboardingHistory(history *WorkspaceOffboardingHistory) error

func ValidateWorkspaceOffboardingHistoryAgainstWorkspace

func ValidateWorkspaceOffboardingHistoryAgainstWorkspace(offboarding *WorkspaceOffboardingHistory, history *WorkspaceHistory) error

func ValidateWorkspaceOwnershipHistory

func ValidateWorkspaceOwnershipHistory(history *WorkspaceOwnershipHistory) error

func ValidateWorkspaceOwnershipHistoryAgainstWorkspace

func ValidateWorkspaceOwnershipHistoryAgainstWorkspace(ownership *WorkspaceOwnershipHistory, history *WorkspaceHistory) error

func WriteAccessCSV

func WriteAccessCSV(path string, snapshot *Snapshot) error

func WriteAccessGraphJSON

func WriteAccessGraphJSON(path string, graph *AccessGraph) error

func WriteHTMLReport

func WriteHTMLReport(path string, snapshot *Snapshot) error

func WriteIdentityMap

func WriteIdentityMap(path string, identityMap *IdentityMap) error

func WriteOffboardingCheckCSV

func WriteOffboardingCheckCSV(path string, check *OffboardingCheck) error

func WriteOffboardingCheckHTML

func WriteOffboardingCheckHTML(path string, check *OffboardingCheck) error

func WriteOffboardingCheckJSON

func WriteOffboardingCheckJSON(path string, check *OffboardingCheck) error

func WriteOffboardingReportCSV

func WriteOffboardingReportCSV(path string, report *OffboardingReport) error

func WriteOffboardingReportHTML

func WriteOffboardingReportHTML(path string, report *OffboardingReport) error

func WriteOffboardingReportJSON

func WriteOffboardingReportJSON(path string, report *OffboardingReport) error

func WriteOwnershipReviewCSV

func WriteOwnershipReviewCSV(path string, review *OwnershipReview) error

func WriteOwnershipReviewHTML

func WriteOwnershipReviewHTML(path string, review *OwnershipReview) error

func WriteOwnershipReviewJSON

func WriteOwnershipReviewJSON(path string, review *OwnershipReview) error

func WriteSnapshot

func WriteSnapshot(path string, snapshot *Snapshot) error

func WriteUploadPlan

func WriteUploadPlan(path string, plan *UploadPlan) error

func WriteWorkspaceBundle

func WriteWorkspaceBundle(path string, bundle *WorkspaceBundle) error

func WriteWorkspaceDashboardCSVWithAuditEvidence

func WriteWorkspaceDashboardCSVWithAuditEvidence(path string, history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory) error

func WriteWorkspaceDashboardHTML

func WriteWorkspaceDashboardHTML(path string, history *WorkspaceHistory) error

func WriteWorkspaceDashboardHTMLWithAuditEvidence

func WriteWorkspaceDashboardHTMLWithAuditEvidence(path string, history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory) error

func WriteWorkspaceDashboardHTMLWithEvidence

func WriteWorkspaceDashboardHTMLWithEvidence(path string, history *WorkspaceHistory, ownership *OwnershipReview, offboardingHistory *WorkspaceOffboardingHistory) error

func WriteWorkspaceDashboardHTMLWithOwnership

func WriteWorkspaceDashboardHTMLWithOwnership(path string, history *WorkspaceHistory, ownership *OwnershipReview) error

func WriteWorkspaceHistory

func WriteWorkspaceHistory(path string, history *WorkspaceHistory) error

func WriteWorkspaceOffboardingHistory

func WriteWorkspaceOffboardingHistory(path string, history *WorkspaceOffboardingHistory) error

func WriteWorkspaceOwnershipHistory

func WriteWorkspaceOwnershipHistory(path string, history *WorkspaceOwnershipHistory) error

Types

type AccessEdge

type AccessEdge struct {
	Host        string `json:"host"`
	Account     string `json:"account"`
	Fingerprint string `json:"fingerprint"`
	Algorithm   string `json:"algorithm,omitempty"`
	Bits        int    `json:"bits,omitempty"`
}

AccessEdge is the semantic grant identity used for snapshot diffs. Line order and comments are deliberately excluded, so metadata-only edits do not appear as newly granted access.

type AccessGraph

type AccessGraph struct {
	SchemaVersion string            `json:"schema_version"`
	ScanID        string            `json:"scan_id"`
	Summary       AccessGraphStats  `json:"summary"`
	Nodes         []AccessGraphNode `json:"nodes"`
	Edges         []AccessGraphEdge `json:"edges"`
}

func BuildAccessGraph

func BuildAccessGraph(snapshot *Snapshot) (*AccessGraph, error)

BuildAccessGraph creates the observed graph without promoting comments to identities. A comment becomes an explicitly unverified identity_hint node; only future claim/verification workflows may upgrade that state.

func ReadAccessGraph

func ReadAccessGraph(path string) (*AccessGraph, error)

ReadAccessGraph reads and validates a normalized graph v1 artifact while tolerating additive unknown JSON fields for forward compatibility.

type AccessGraphEdge

type AccessGraphEdge struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Kind   string `json:"kind"`
	Source string `json:"source,omitempty"`
	Line   int    `json:"line,omitempty"`
}

type AccessGraphNode

type AccessGraphNode struct {
	ID           string `json:"id"`
	Kind         string `json:"kind"`
	Label        string `json:"label"`
	Host         string `json:"host,omitempty"`
	Account      string `json:"account,omitempty"`
	Fingerprint  string `json:"fingerprint,omitempty"`
	Algorithm    string `json:"algorithm,omitempty"`
	Bits         int    `json:"bits,omitempty"`
	Coverage     string `json:"coverage,omitempty"`
	Verification string `json:"verification,omitempty"`
}

type AccessGraphStats

type AccessGraphStats struct {
	Hosts         int `json:"hosts"`
	HostsFull     int `json:"hosts_full"`
	HostsPartial  int `json:"hosts_partial"`
	HostsFailed   int `json:"hosts_failed"`
	Accounts      int `json:"accounts"`
	Keys          int `json:"keys"`
	IdentityHints int `json:"identity_hints"`
	AccessEdges   int `json:"access_edges"`
	ClaimEdges    int `json:"claim_edges"`
}

type AccountAuthSnapshot

type AccountAuthSnapshot struct {
	EffectiveConfig             bool     `json:"effective_config"`
	PubkeyAuthentication        string   `json:"pubkey_authentication,omitempty"`
	StrictModes                 string   `json:"strict_modes,omitempty"`
	AuthorizedKeysFiles         []string `json:"authorized_keys_files,omitempty"`
	AuthorizedKeysCommand       string   `json:"authorized_keys_command,omitempty"`
	AuthorizedKeysCommandUser   string   `json:"authorized_keys_command_user,omitempty"`
	TrustedUserCAKeys           string   `json:"trusted_user_ca_keys,omitempty"`
	AuthorizedPrincipalsFile    string   `json:"authorized_principals_file,omitempty"`
	AuthorizedPrincipalsCommand string   `json:"authorized_principals_command,omitempty"`
}

AccountAuthSnapshot records the effective sshd authentication configuration for one OS account. Paths are configured templates; AccountSnapshot.Sources contains their safely expanded absolute forms.

type AccountSnapshot

type AccountSnapshot struct {
	Username    string               `json:"username"`
	UID         *uint64              `json:"uid,omitempty"`
	GID         *uint64              `json:"gid,omitempty"`
	Home        string               `json:"home,omitempty"`
	Shell       string               `json:"shell,omitempty"`
	Auth        *AccountAuthSnapshot `json:"auth,omitempty"`
	Limitations []string             `json:"limitations,omitempty"`
	Sources     []KeySource          `json:"sources,omitempty"`
}

type CoverageChange

type CoverageChange struct {
	Host   string `json:"host"`
	Before string `json:"before"`
	After  string `json:"after"`
}

type Diff

type Diff struct {
	BeforeScanID    string           `json:"before_scan_id"`
	AfterScanID     string           `json:"after_scan_id"`
	Added           []AccessEdge     `json:"added"`
	Removed         []AccessEdge     `json:"removed"`
	CoverageChanges []CoverageChange `json:"coverage_changes,omitempty"`
}

func SemanticDiff

func SemanticDiff(before, after *Snapshot) Diff

type Finding

type Finding struct {
	RuleID            string   `json:"rule_id"`
	RuleVersion       string   `json:"rule_version"`
	Severity          string   `json:"severity"`
	Title             string   `json:"title"`
	Host              string   `json:"host,omitempty"`
	Account           string   `json:"account,omitempty"`
	Fingerprint       string   `json:"fingerprint,omitempty"`
	Occurrences       int      `json:"occurrences,omitempty"`
	Hosts             []string `json:"hosts,omitempty"`
	Evidence          []string `json:"evidence,omitempty"`
	CoverageCaveat    string   `json:"coverage_caveat,omitempty"`
	RecommendedAction string   `json:"recommended_action,omitempty"`
}

Finding is a versioned conclusion derived locally from normalized scan evidence. It never upgrades comments into verified identity ownership.

func Analyze

func Analyze(snapshot *Snapshot) []Finding

Analyze applies the v1 local rule set. Unknown/shared ownership rules are intentionally deferred until an explicit identity map exists.

type HostSnapshot

type HostSnapshot struct {
	Alias       string            `json:"alias"`
	Groups      []string          `json:"groups,omitempty"`
	Tags        []string          `json:"tags,omitempty"`
	Coverage    string            `json:"coverage"`
	Limitations []string          `json:"limitations,omitempty"`
	System      *SystemSnapshot   `json:"system,omitempty"`
	Accounts    []AccountSnapshot `json:"accounts,omitempty"`
	Errors      []ScanError       `json:"errors,omitempty"`
	DurationMS  int64             `json:"duration_ms"`
}

type Identity

type Identity struct {
	ID          string `yaml:"id" json:"id"`
	DisplayName string `yaml:"display_name,omitempty" json:"display_name,omitempty"`
	Kind        string `yaml:"kind" json:"kind"`
	Status      string `yaml:"status" json:"status"`
}

type IdentityKeyOwnership

type IdentityKeyOwnership struct {
	Fingerprint string           `yaml:"fingerprint" json:"fingerprint"`
	Claims      []OwnershipClaim `yaml:"claims" json:"claims"`
}

type IdentityMap

type IdentityMap struct {
	SchemaVersion string                 `yaml:"schema_version" json:"schema_version"`
	Identities    []Identity             `yaml:"identities" json:"identities"`
	Keys          []IdentityKeyOwnership `yaml:"keys" json:"keys"`
}

IdentityMap is an explicit local ownership input. authorized_keys comments never populate Claims: they remain unverified hints in the scan evidence.

func BuildIdentityMapTemplate

func BuildIdentityMapTemplate(snapshot *Snapshot) (*IdentityMap, error)

BuildIdentityMapTemplate creates a safe, explicitly unassigned template for every key observed in a validated snapshot. Empty claims remain unknown.

func ReadIdentityMap

func ReadIdentityMap(path string) (*IdentityMap, error)

type KeyLocation

type KeyLocation struct {
	Alias     string
	Account   string
	Source    string
	Line      int
	Comment   string
	Algorithm string
	Bits      int
}

func LocationsForFingerprint

func LocationsForFingerprint(snapshot *Snapshot, fingerprint string) []KeyLocation

LocationsForFingerprint returns every observed access edge for fingerprint.

type KeyObservation

type KeyObservation struct {
	Line        int      `json:"line"`
	Fingerprint string   `json:"fingerprint,omitempty"`
	Algorithm   string   `json:"algorithm,omitempty"`
	Bits        int      `json:"bits,omitempty"`
	Options     []string `json:"options,omitempty"`
	Comment     string   `json:"comment,omitempty"`
	PublicKey   string   `json:"public_key,omitempty"`
	ParseError  string   `json:"parse_error,omitempty"`
}

func ParseAuthorizedKeys

func ParseAuthorizedKeys(data []byte, includePublicKeys bool) ([]KeyObservation, error)

ParseAuthorizedKeys normalizes every non-comment entry. Malformed entries remain represented by their line number and parse error so a scan cannot silently turn an unreadable access rule into a clean result.

type KeySource

type KeySource struct {
	Type             string `json:"type"`
	Path             string `json:"path"`
	ConfiguredPath   string `json:"configured_path,omitempty"`
	Exists           bool   `json:"exists"`
	Symlink          bool   `json:"symlink,omitempty"`
	ContentInspected bool   `json:"content_inspected"`
	// ContentSHA256 binds deployment plans to the exact bytes observed by the
	// read-only scan. Raw key contents remain omitted unless explicitly asked.
	ContentSHA256   string           `json:"content_sha256,omitempty"`
	Mode            string           `json:"mode,omitempty"`
	Size            int64            `json:"size,omitempty"`
	OwnerUID        *uint64          `json:"owner_uid,omitempty"`
	OwnerGID        *uint64          `json:"owner_gid,omitempty"`
	ParentPath      string           `json:"parent_path,omitempty"`
	ParentMode      string           `json:"parent_mode,omitempty"`
	ParentOwnerUID  *uint64          `json:"parent_owner_uid,omitempty"`
	ParentOwnerGID  *uint64          `json:"parent_owner_gid,omitempty"`
	AncestorSymlink bool             `json:"ancestor_symlink,omitempty"`
	Entries         []KeyObservation `json:"entries,omitempty"`
	Error           string           `json:"error,omitempty"`
}

type OffboardingAccess

type OffboardingAccess struct {
	Host     string   `json:"host"`
	Account  string   `json:"account"`
	Source   string   `json:"source"`
	Line     int      `json:"line"`
	Coverage string   `json:"coverage"`
	Options  []string `json:"authorized_key_options,omitempty"`
}

type OffboardingCheck

type OffboardingCheck struct {
	SchemaVersion        string                     `json:"schema_version"`
	CheckID              string                     `json:"check_id"`
	BaselineReportID     string                     `json:"baseline_report_id"`
	BaselineReportSHA256 string                     `json:"baseline_report_sha256"`
	BeforeScanID         string                     `json:"before_scan_id"`
	BeforeReviewID       string                     `json:"before_review_id"`
	AfterScanID          string                     `json:"after_scan_id"`
	AfterReviewID        string                     `json:"after_review_id"`
	BeforeSnapshotSHA256 string                     `json:"before_snapshot_sha256"`
	BeforeReviewSHA256   string                     `json:"before_review_sha256"`
	AfterSnapshotSHA256  string                     `json:"after_snapshot_sha256"`
	AfterReviewSHA256    string                     `json:"after_review_sha256"`
	Identity             Identity                   `json:"identity"`
	Safety               OffboardingSafety          `json:"safety"`
	Outcome              string                     `json:"outcome"`
	Comparison           OffboardingCheckComparison `json:"comparison"`
	BeforeCoverage       OffboardingCoverage        `json:"before_coverage"`
	AfterCoverage        OffboardingCoverage        `json:"after_coverage"`
	Summary              OffboardingCheckSummary    `json:"summary"`
	BaselineKeys         []string                   `json:"baseline_keys"`
	CurrentKeys          []string                   `json:"current_keys"`
	BaselineAccess       []OffboardingCheckEdge     `json:"baseline_access"`
	StillObserved        []OffboardingCheckEdge     `json:"still_observed,omitempty"`
	NotObserved          []OffboardingCheckEdge     `json:"not_observed,omitempty"`
	NewlyObserved        []OffboardingCheckEdge     `json:"newly_observed,omitempty"`
	Reasons              []OffboardingCheckReason   `json:"reasons"`
}

func BuildOffboardingCheck

func BuildOffboardingCheck(baseline *OffboardingReport, beforeSnapshot *Snapshot, beforeReview *OwnershipReview, afterSnapshot *Snapshot, afterReview *OwnershipReview) (*OffboardingCheck, error)

func ReadOffboardingCheck

func ReadOffboardingCheck(path string) (*OffboardingCheck, error)

type OffboardingCheckComparison

type OffboardingCheckComparison struct {
	Comparable         bool     `json:"comparable"`
	IncomparableReason string   `json:"incomparable_reason,omitempty"`
	UnsafeHosts        []string `json:"unsafe_hosts,omitempty"`
	DynamicSourceHosts []string `json:"dynamic_source_hosts,omitempty"`
	IdentityPresent    bool     `json:"identity_present_after"`
	IdentityOffboarded bool     `json:"identity_offboarded_after"`
	ClaimsUnchanged    bool     `json:"claims_unchanged"`
	FreshAfterSnapshot bool     `json:"fresh_after_snapshot"`
}

type OffboardingCheckEdge

type OffboardingCheckEdge struct {
	Fingerprint string              `json:"fingerprint"`
	Host        string              `json:"host"`
	Account     string              `json:"account"`
	Evidence    []OffboardingAccess `json:"evidence"`
}

type OffboardingCheckReason

type OffboardingCheckReason struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type OffboardingCheckSummary

type OffboardingCheckSummary struct {
	BaselineKeys    int `json:"baseline_keys"`
	CurrentKeys     int `json:"current_keys"`
	BaselineAccess  int `json:"baseline_access_edges"`
	StillObserved   int `json:"still_observed_edges"`
	NotObserved     int `json:"not_observed_edges"`
	NewlyObserved   int `json:"newly_observed_edges"`
	BlockingReasons int `json:"blocking_reasons"`
}

type OffboardingCoverage

type OffboardingCoverage struct {
	HostsRequested     int      `json:"hosts_requested"`
	HostsFull          int      `json:"hosts_full"`
	HostsPartial       int      `json:"hosts_partial"`
	HostsFailed        int      `json:"hosts_failed"`
	IncompleteHosts    []string `json:"incomplete_hosts,omitempty"`
	DynamicSourceHosts []string `json:"dynamic_source_hosts,omitempty"`
	Caveat             string   `json:"caveat,omitempty"`
}

type OffboardingKey

type OffboardingKey struct {
	Fingerprint   string                   `json:"fingerprint"`
	Observed      bool                     `json:"observed"`
	Algorithm     string                   `json:"algorithm,omitempty"`
	Bits          int                      `json:"bits,omitempty"`
	SelectedClaim ResolvedOwnershipClaim   `json:"selected_claim"`
	OtherClaims   []ResolvedOwnershipClaim `json:"other_claims,omitempty"`
	Shared        bool                     `json:"shared"`
	Access        []OffboardingAccess      `json:"access,omitempty"`
}

type OffboardingReport

type OffboardingReport struct {
	SchemaVersion  string               `json:"schema_version"`
	ReportID       string               `json:"report_id"`
	ScanID         string               `json:"scan_id"`
	ReviewID       string               `json:"review_id"`
	SnapshotSHA256 string               `json:"snapshot_sha256"`
	ReviewSHA256   string               `json:"review_sha256"`
	Identity       Identity             `json:"identity"`
	Safety         OffboardingSafety    `json:"safety"`
	Coverage       OffboardingCoverage  `json:"coverage"`
	Summary        OffboardingSummary   `json:"summary"`
	Keys           []OffboardingKey     `json:"keys"`
	Warnings       []OffboardingWarning `json:"warnings,omitempty"`
}

func BuildOffboardingReport

func BuildOffboardingReport(snapshot *Snapshot, review *OwnershipReview, identityID string) (*OffboardingReport, error)

func ReadOffboardingReport

func ReadOffboardingReport(path string) (*OffboardingReport, error)

type OffboardingSafety

type OffboardingSafety struct {
	Mode                  string `json:"mode"`
	RemoteChanges         bool   `json:"remote_changes"`
	Executable            bool   `json:"executable"`
	SourceDigestsIncluded bool   `json:"source_digests_included"`
	RequiresFreshScan     bool   `json:"requires_fresh_scan_before_remediation"`
}

type OffboardingSummary

type OffboardingSummary struct {
	ClaimedKeys            int `json:"claimed_keys"`
	ObservedKeys           int `json:"observed_keys"`
	MappedKeysNotObserved  int `json:"mapped_keys_not_observed"`
	AccessEdges            int `json:"access_edges"`
	Hosts                  int `json:"hosts"`
	Accounts               int `json:"accounts"`
	SharedKeys             int `json:"shared_keys"`
	PossessionVerifiedKeys int `json:"possession_verified_keys"`
	UnverifiedClaimKeys    int `json:"unverified_claim_keys"`
	WarningsTotal          int `json:"warnings_total"`
	WarningsHigh           int `json:"warnings_high"`
	WarningsMedium         int `json:"warnings_medium"`
	WarningsInfo           int `json:"warnings_info"`
}

type OffboardingWarning

type OffboardingWarning struct {
	Code        string   `json:"code"`
	Severity    string   `json:"severity"`
	Fingerprint string   `json:"fingerprint,omitempty"`
	Hosts       []string `json:"hosts,omitempty"`
	Message     string   `json:"message"`
	Action      string   `json:"action"`
}

type OwnershipClaim

type OwnershipClaim struct {
	IdentityID string `yaml:"identity" json:"identity"`
	Status     string `yaml:"status" json:"status"`
	Source     string `yaml:"source" json:"source"`
	RecordedAt string `yaml:"recorded_at,omitempty" json:"recorded_at,omitempty"`
	VerifiedAt string `yaml:"verified_at,omitempty" json:"verified_at,omitempty"`
}

type OwnershipReview

type OwnershipReview struct {
	SchemaVersion     string           `json:"schema_version"`
	ReviewID          string           `json:"review_id"`
	ScanID            string           `json:"scan_id"`
	IdentityMapDigest string           `json:"identity_map_digest"`
	Summary           OwnershipSummary `json:"summary"`
	Identities        []Identity       `json:"identities"`
	Keys              []ReviewedKey    `json:"keys"`
	Findings          []Finding        `json:"findings,omitempty"`
}

func BuildOwnershipReview

func BuildOwnershipReview(snapshot *Snapshot, identityMap *IdentityMap) (*OwnershipReview, error)

func ReadOwnershipReview

func ReadOwnershipReview(path string) (*OwnershipReview, error)

type OwnershipSummary

type OwnershipSummary struct {
	ObservedKeys           int `json:"observed_keys"`
	OwnedKeys              int `json:"owned_keys"`
	UnknownKeys            int `json:"unknown_keys"`
	SharedKeys             int `json:"shared_keys"`
	OffboardedAccessKeys   int `json:"offboarded_access_keys"`
	PossessionVerifiedKeys int `json:"possession_verified_keys"`
	MappedKeysNotObserved  int `json:"mapped_keys_not_observed"`
	ActiveIdentities       int `json:"active_identities"`
	OffboardedIdentities   int `json:"offboarded_identities"`
	FindingsTotal          int `json:"findings_total"`
	FindingsCritical       int `json:"findings_critical"`
	FindingsHigh           int `json:"findings_high"`
	FindingsMedium         int `json:"findings_medium"`
	FindingsLow            int `json:"findings_low"`
	FindingsInfo           int `json:"findings_info"`
}

type ResolvedOwnershipClaim

type ResolvedOwnershipClaim struct {
	IdentityID     string `json:"identity"`
	DisplayName    string `json:"display_name,omitempty"`
	Kind           string `json:"kind"`
	IdentityStatus string `json:"identity_status"`
	Verification   string `json:"verification"`
	Source         string `json:"source"`
	RecordedAt     string `json:"recorded_at,omitempty"`
	VerifiedAt     string `json:"verified_at,omitempty"`
}

type ReviewedKey

type ReviewedKey struct {
	Fingerprint        string                   `json:"fingerprint"`
	Observed           bool                     `json:"observed"`
	IdentityMapEntry   bool                     `json:"identity_map_entry"`
	OwnershipStatus    string                   `json:"ownership_status"`
	OffboardedAccess   bool                     `json:"offboarded_access"`
	PossessionVerified bool                     `json:"possession_verified"`
	Algorithm          string                   `json:"algorithm,omitempty"`
	Bits               int                      `json:"bits,omitempty"`
	Occurrences        int                      `json:"occurrences"`
	Hosts              []string                 `json:"hosts,omitempty"`
	Accounts           []string                 `json:"accounts,omitempty"`
	IdentityHints      []string                 `json:"identity_hints,omitempty"`
	Claims             []ResolvedOwnershipClaim `json:"claims"`
}

type SSHDConfigSnapshot

type SSHDConfigSnapshot struct {
	Present                     bool     `json:"present"`
	Path                        string   `json:"path,omitempty"`
	ConfigValid                 bool     `json:"config_valid"`
	EffectiveConfig             bool     `json:"effective_config"`
	EffectiveUser               string   `json:"effective_user,omitempty"`
	MatchHost                   string   `json:"match_host,omitempty"`
	MatchAddress                string   `json:"match_address,omitempty"`
	PubkeyAuthentication        string   `json:"pubkey_authentication,omitempty"`
	StrictModes                 string   `json:"strict_modes,omitempty"`
	AuthorizedKeysFiles         []string `json:"authorized_keys_files,omitempty"`
	AuthorizedKeysCommand       string   `json:"authorized_keys_command,omitempty"`
	AuthorizedKeysCommandUser   string   `json:"authorized_keys_command_user,omitempty"`
	TrustedUserCAKeys           string   `json:"trusted_user_ca_keys,omitempty"`
	AuthorizedPrincipalsFile    string   `json:"authorized_principals_file,omitempty"`
	AuthorizedPrincipalsCommand string   `json:"authorized_principals_command,omitempty"`
}

type ScanError

type ScanError struct {
	Stage   string `json:"stage"`
	Message string `json:"message"`
}

type ScanOptions

type ScanOptions struct {
	Parallel          int
	Timeout           time.Duration
	IncludePublicKeys bool
	Preflight         bool
	ScannerVersion    string
	Selector          string
	HostExclusions    []string
	TagExclusions     []string
	ExcludedMatched   []string
	UseSudo           bool
	AccountMode       string
	Accounts          []string
	MaxAccounts       int
	MaxSourceBytes    int64
	MaxTotalBytes     int64
}

type Scope

type Scope struct {
	Mode                 string   `json:"mode"`
	Selector             string   `json:"selector"`
	RequestedHosts       int      `json:"requested_hosts"`
	AccountMode          string   `json:"account_mode,omitempty"`
	RequestedAccounts    []string `json:"requested_accounts,omitempty"`
	MaxAccounts          int      `json:"max_accounts,omitempty"`
	MaxSourceBytes       int64    `json:"max_source_bytes,omitempty"`
	MaxTotalSourceBytes  int64    `json:"max_total_source_bytes,omitempty"`
	HostExclusions       []string `json:"host_exclusions,omitempty"`
	TagExclusions        []string `json:"tag_exclusions,omitempty"`
	ExcludedMatchedHosts []string `json:"excluded_matched_hosts,omitempty"`
	Preflight            bool     `json:"preflight,omitempty"`
	IncludePublicKeys    bool     `json:"include_public_keys"`
}

type Snapshot

type Snapshot struct {
	SchemaVersion  string         `json:"schema_version"`
	ScanID         string         `json:"scan_id"`
	SourceScanIDs  []string       `json:"source_scan_ids,omitempty"`
	ScannerVersion string         `json:"scanner_version,omitempty"`
	StartedAt      string         `json:"started_at"`
	CompletedAt    string         `json:"completed_at"`
	Scope          Scope          `json:"scope"`
	Summary        Summary        `json:"summary"`
	Findings       []Finding      `json:"findings,omitempty"`
	Hosts          []HostSnapshot `json:"hosts"`
}

Snapshot is the versioned, local audit artifact produced by access scan. It intentionally contains no SSH credentials or private-key material.

func MergeSnapshots

func MergeSnapshots(scannerVersion string, snapshots ...*Snapshot) (*Snapshot, error)

MergeSnapshots combines disjoint validated snapshots into one deterministic fleet artifact. It never guesses how to reconcile two observations of the same host; callers must use diff for repeated scans instead.

func NewSnapshot

func NewSnapshot(scannerVersion string, scope Scope, started time.Time) *Snapshot

NewSnapshot creates a scan envelope. Call Finalize after all host results have been populated.

func ReadSnapshot

func ReadSnapshot(path string) (*Snapshot, error)

func ScanCurrent

func ScanCurrent(ctx context.Context, cfg *config.Config, aliases []string, options ScanOptions) *Snapshot

ScanCurrent performs an agentless, read-only inspection of the SSH account already used by each sshmgr host profile. This first scanner deliberately checks only the default per-user OpenSSH paths and therefore reports partial coverage until effective sshd configuration discovery is implemented.

func ScanSystem

func ScanSystem(ctx context.Context, cfg *config.Config, aliases []string, options ScanOptions) *Snapshot

ScanSystem discovers effective static AuthorizedKeysFile sources and then inspects them through the already-established root/sudo-n channel. It never invokes AuthorizedKeysCommand, follows symlinked key sources, or changes a remote file.

func ScanSystemPreflight

func ScanSystemPreflight(ctx context.Context, cfg *config.Config, aliases []string, options ScanOptions) *Snapshot

ScanSystemPreflight performs capability/source discovery only. System-wide account and key-content collection is a later, separately gated operation.

func (*Snapshot) Finalize

func (s *Snapshot) Finalize(completed time.Time)

Finalize sorts the normalized snapshot and derives all summary counters.

type Summary

type Summary struct {
	HostsRequested       int   `json:"hosts_requested"`
	HostsFull            int   `json:"hosts_full"`
	HostsPartial         int   `json:"hosts_partial"`
	HostsFailed          int   `json:"hosts_failed"`
	AccountsObserved     int   `json:"accounts_observed"`
	KeySourcesFound      int   `json:"key_sources_found"`
	AuthorizedKeyEntries int   `json:"authorized_key_entries"`
	MalformedEntries     int   `json:"malformed_entries"`
	KeyBytesInspected    int64 `json:"key_bytes_inspected"`
	UniqueFingerprints   int   `json:"unique_fingerprints"`
	FindingsTotal        int   `json:"findings_total"`
	FindingsCritical     int   `json:"findings_critical"`
	FindingsHigh         int   `json:"findings_high"`
	FindingsMedium       int   `json:"findings_medium"`
	FindingsLow          int   `json:"findings_low"`
	FindingsInfo         int   `json:"findings_info"`
}

type SystemSnapshot

type SystemSnapshot struct {
	PrivilegeMode      string             `json:"privilege_mode"`
	Root               bool               `json:"root"`
	SudoNonInteractive bool               `json:"sudo_non_interactive,omitempty"`
	OS                 string             `json:"os,omitempty"`
	AccountDatabase    string             `json:"account_database,omitempty"`
	AccountMode        string             `json:"account_mode,omitempty"`
	AccountsEnumerated bool               `json:"accounts_enumerated"`
	AccountsTruncated  bool               `json:"accounts_truncated"`
	AccountLimit       int                `json:"account_limit,omitempty"`
	MissingAccounts    []string           `json:"missing_accounts,omitempty"`
	SourcesRequested   int                `json:"sources_requested,omitempty"`
	SourcesInspected   int                `json:"sources_inspected,omitempty"`
	SourceBytesRead    int64              `json:"source_bytes_read,omitempty"`
	SourcesTruncated   bool               `json:"sources_truncated,omitempty"`
	ContentBudgetHit   bool               `json:"content_budget_hit,omitempty"`
	SSHD               SSHDConfigSnapshot `json:"sshd"`
}

SystemSnapshot records non-secret host capabilities and effective OpenSSH authentication sources discovered during a privileged system preflight. It contains no key contents, credentials, or executed script text.

type UploadFieldPreview

type UploadFieldPreview struct {
	Hosts              int `json:"hosts"`
	Accounts           int `json:"accounts"`
	AccessEntries      int `json:"access_entries"`
	UniqueFingerprints int `json:"unique_fingerprints"`
	Findings           int `json:"findings"`
	SelectorValues     int `json:"selector_values"`
	HostAliasRefs      int `json:"host_alias_references"`
	GroupNameRefs      int `json:"group_name_references"`
	TagNameRefs        int `json:"tag_name_references"`
	AccountNameRefs    int `json:"account_name_references"`
	FingerprintRefs    int `json:"fingerprint_references"`
	FilesystemPaths    int `json:"filesystem_paths"`
	ConfiguredCommands int `json:"configured_commands"`
	NetworkMatchValues int `json:"network_match_values"`
	AuthorizedKeyOpts  int `json:"authorized_key_options"`
	IdentityHints      int `json:"identity_hints"`
	DiagnosticTexts    int `json:"diagnostic_texts"`
	RawPublicKeys      int `json:"raw_public_keys"`
}

UploadFieldPreview is a count of potentially sensitive field values that are actually present in the embedded payload. It lets a human review the transport surface without inspecting raw public keys or credentials.

type UploadPlan

type UploadPlan struct {
	SchemaVersion  string             `json:"schema_version"`
	PlanID         string             `json:"plan_id"`
	Workspace      string             `json:"workspace"`
	ArtifactType   string             `json:"artifact_type"`
	ArtifactID     string             `json:"artifact_id"`
	IdempotencyKey string             `json:"idempotency_key"`
	PayloadSHA256  string             `json:"payload_sha256"`
	PayloadBytes   int                `json:"payload_bytes"`
	Privacy        UploadPrivacy      `json:"privacy"`
	Preview        UploadFieldPreview `json:"preview"`
	Snapshot       Snapshot           `json:"snapshot"`
}

UploadPlan is a deterministic, offline transport candidate. Creating or reading one performs no network operation. A later Cloud client may upload only an artifact that passes this validator.

func BuildUploadPlan

func BuildUploadPlan(snapshot *Snapshot, workspace string, includeIdentityHints bool) (*UploadPlan, error)

BuildUploadPlan validates and clones a local snapshot, strips raw public-key material unconditionally, and strips unverified comments unless the caller explicitly opts in. It never mutates the input snapshot and never connects to a host or network service.

func ReadUploadPlan

func ReadUploadPlan(path string) (*UploadPlan, error)

type UploadPrivacy

type UploadPrivacy struct {
	Profile               string `json:"profile"`
	HostAliasesIncluded   bool   `json:"host_aliases_included"`
	AccountNamesIncluded  bool   `json:"account_names_included"`
	SourcePathsIncluded   bool   `json:"source_paths_included"`
	IdentityHintsIncluded bool   `json:"identity_hints_included"`
	PublicKeysIncluded    bool   `json:"public_keys_included"`
	CredentialsIncluded   bool   `json:"credentials_included"`
}

type WorkspaceArtifact

type WorkspaceArtifact struct {
	ScanID          string             `json:"scan_id"`
	PlanID          string             `json:"plan_id"`
	CompletedAt     string             `json:"completed_at"`
	PayloadSHA256   string             `json:"payload_sha256"`
	PayloadBytes    int                `json:"payload_bytes"`
	Privacy         UploadPrivacy      `json:"privacy"`
	Preview         UploadFieldPreview `json:"preview"`
	SnapshotSummary Summary            `json:"snapshot_summary"`
}

type WorkspaceBundle

type WorkspaceBundle struct {
	SchemaVersion  string                 `json:"schema_version"`
	BundleID       string                 `json:"bundle_id"`
	Workspace      string                 `json:"workspace"`
	ArtifactType   string                 `json:"artifact_type"`
	IdempotencyKey string                 `json:"idempotency_key"`
	PayloadSHA256  string                 `json:"payload_sha256"`
	PayloadBytes   int                    `json:"payload_bytes"`
	Digests        WorkspaceBundleDigests `json:"digests"`
	Privacy        UploadPrivacy          `json:"privacy"`
	Preview        WorkspaceBundlePreview `json:"preview"`
	Payload        WorkspaceBundlePayload `json:"payload"`
}

WorkspaceBundle is the single deterministic ingestion candidate for the Cloud API. It contains only artifacts that already passed the local privacy boundary and strict workspace evidence joins. Building, reading, or inspecting it performs no network operation.

func BuildWorkspaceBundle

func BuildWorkspaceBundle(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory) (*WorkspaceBundle, error)

BuildWorkspaceBundle validates the exact evidence set used by the local dashboard, privacy-normalizes the standalone ownership review, and freezes everything into one content-addressed transport envelope.

func ParseWorkspaceBundleJSON

func ParseWorkspaceBundleJSON(data []byte) (*WorkspaceBundle, error)

ParseWorkspaceBundleJSON strictly decodes one bounded JSON bundle. It is shared by the local reader and the HTTPS ingestion boundary.

func ReadWorkspaceBundle

func ReadWorkspaceBundle(path string) (*WorkspaceBundle, error)

type WorkspaceBundleDigests

type WorkspaceBundleDigests struct {
	WorkspaceHistory      string `json:"workspace_history_sha256"`
	OwnershipReview       string `json:"ownership_review_sha256,omitempty"`
	OwnershipReviewSource string `json:"ownership_review_source_sha256,omitempty"`
	OwnershipHistory      string `json:"ownership_history_sha256,omitempty"`
	OffboardingHistory    string `json:"offboarding_history_sha256,omitempty"`
}

type WorkspaceBundlePayload

type WorkspaceBundlePayload struct {
	WorkspaceHistory   WorkspaceHistory             `json:"workspace_history"`
	OwnershipReview    *OwnershipReview             `json:"ownership_review,omitempty"`
	OwnershipHistory   *WorkspaceOwnershipHistory   `json:"ownership_history,omitempty"`
	OffboardingHistory *WorkspaceOffboardingHistory `json:"offboarding_history,omitempty"`
}

type WorkspaceBundlePreview

type WorkspaceBundlePreview struct {
	Snapshots                    int  `json:"snapshots"`
	LatestHosts                  int  `json:"latest_hosts"`
	LatestAccounts               int  `json:"latest_accounts"`
	LatestAccessEntries          int  `json:"latest_access_entries"`
	LatestUniqueFingerprints     int  `json:"latest_unique_fingerprints"`
	LatestFindings               int  `json:"latest_findings"`
	TimelineHostObservations     int  `json:"timeline_host_observations"`
	TimelineAccessEntries        int  `json:"timeline_access_entries"`
	OwnershipReviewAttached      bool `json:"ownership_review_attached"`
	OwnershipReviews             int  `json:"ownership_reviews"`
	OwnershipFindings            int  `json:"ownership_findings"`
	OffboardingChecks            int  `json:"offboarding_checks"`
	TrackedOffboardingIdentities int  `json:"tracked_offboarding_identities"`
	IdentityHints                int  `json:"identity_hints"`
	RawPublicKeys                int  `json:"raw_public_keys"`
}

WorkspaceBundlePreview summarizes both the latest review surface and the amount of timeline evidence carried by the payload.

type WorkspaceDashboardGatePolicy

type WorkspaceDashboardGatePolicy struct {
	FailOnSeverity             string
	RequireFullCoverage        bool
	RequireCurrentOwnership    bool
	RequireCompleteOffboarding bool
}

WorkspaceDashboardGatePolicy is an opt-in local policy over the same strict evidence joins used by workspace dashboard HTML and CSV exports.

type WorkspaceDashboardGateResult

type WorkspaceDashboardGateResult struct {
	FailOnSeverity             string
	SnapshotFindingsMatched    int
	OwnershipFindingsMatched   int
	IncompleteHosts            int
	CurrentOwnershipReview     bool
	OffboardingHistoryAttached bool
	IncompleteOffboarding      int
	Violations                 []string
}

func EvaluateWorkspaceDashboardGate

func EvaluateWorkspaceDashboardGate(history *WorkspaceHistory, ownership *OwnershipReview, ownershipHistory *WorkspaceOwnershipHistory, offboardingHistory *WorkspaceOffboardingHistory, policy WorkspaceDashboardGatePolicy) (WorkspaceDashboardGateResult, error)

EvaluateWorkspaceDashboardGate reuses the dashboard projection validator so policy decisions can never be made over evidence that HTML/CSV would reject.

func (WorkspaceDashboardGateResult) Failed

func (result WorkspaceDashboardGateResult) Failed() bool

type WorkspaceHistory

type WorkspaceHistory struct {
	SchemaVersion string                `json:"schema_version"`
	HistoryID     string                `json:"history_id"`
	Workspace     string                `json:"workspace"`
	LatestScanID  string                `json:"latest_scan_id"`
	Artifacts     []WorkspaceArtifact   `json:"artifacts"`
	Transitions   []WorkspaceTransition `json:"transitions,omitempty"`
	Plans         []UploadPlan          `json:"plans"`
}

WorkspaceHistory is an offline model of the immutable snapshot history a future WebPanel would ingest. It embeds only already validated upload plans; building and reading it performs no network operation.

func BuildWorkspaceHistory

func BuildWorkspaceHistory(plans ...*UploadPlan) (*WorkspaceHistory, error)

BuildWorkspaceHistory validates upload plans, binds them to one workspace, and creates a deterministic chronological history. Exact retries are idempotently deduplicated. Reusing a scan_id for another payload is rejected.

func ReadWorkspaceHistory

func ReadWorkspaceHistory(path string) (*WorkspaceHistory, error)

type WorkspaceIdentityChange

type WorkspaceIdentityChange struct {
	Action     string    `json:"action"`
	IdentityID string    `json:"identity_id"`
	Before     *Identity `json:"before,omitempty"`
	After      *Identity `json:"after,omitempty"`
}

type WorkspaceOffboardingHistory

type WorkspaceOffboardingHistory struct {
	SchemaVersion        string                             `json:"schema_version"`
	OffboardingHistoryID string                             `json:"offboarding_history_id"`
	Workspace            string                             `json:"workspace"`
	WorkspaceHistoryID   string                             `json:"workspace_history_id"`
	LatestScanID         string                             `json:"latest_scan_id"`
	Scans                []WorkspaceOffboardingScan         `json:"scans"`
	Summary              WorkspaceOffboardingHistorySummary `json:"summary"`
	Latest               []WorkspaceOffboardingLatest       `json:"latest"`
	Checks               []OffboardingCheck                 `json:"checks"`
}

WorkspaceOffboardingHistory is a strict companion to the frozen WorkspaceHistory v1 contract. It projects validated offboarding checks onto one immutable workspace timeline without changing that timeline's schema.

func BuildWorkspaceOffboardingHistory

func BuildWorkspaceOffboardingHistory(history *WorkspaceHistory, checks ...*OffboardingCheck) (*WorkspaceOffboardingHistory, error)

func ReadWorkspaceOffboardingHistory

func ReadWorkspaceOffboardingHistory(path string) (*WorkspaceOffboardingHistory, error)

type WorkspaceOffboardingHistorySummary

type WorkspaceOffboardingHistorySummary struct {
	Identities          int `json:"identities"`
	Checks              int `json:"checks"`
	CurrentComplete     int `json:"current_complete"`
	CurrentStillPresent int `json:"current_still_present"`
	CurrentInconclusive int `json:"current_inconclusive"`
	Stale               int `json:"stale"`
}

type WorkspaceOffboardingLatest

type WorkspaceOffboardingLatest struct {
	Identity         Identity `json:"identity"`
	CheckID          string   `json:"check_id"`
	AfterScanID      string   `json:"after_scan_id"`
	AfterCompletedAt string   `json:"after_completed_at"`
	Outcome          string   `json:"outcome"`
	Current          bool     `json:"current"`
	BaselineAccess   int      `json:"baseline_access_edges"`
	StillObserved    int      `json:"still_observed_edges"`
	NotObserved      int      `json:"not_observed_edges"`
	NewlyObserved    int      `json:"newly_observed_edges"`
	BlockingReasons  int      `json:"blocking_reasons"`
	ReasonCodes      []string `json:"reason_codes"`
}

type WorkspaceOffboardingScan

type WorkspaceOffboardingScan struct {
	ScanID      string `json:"scan_id"`
	CompletedAt string `json:"completed_at"`
}

type WorkspaceOwnershipClaimChange

type WorkspaceOwnershipClaimChange struct {
	Action      string                        `json:"action"`
	Fingerprint string                        `json:"fingerprint"`
	IdentityID  string                        `json:"identity_id"`
	Before      *WorkspaceOwnershipClaimState `json:"before,omitempty"`
	After       *WorkspaceOwnershipClaimState `json:"after,omitempty"`
}

type WorkspaceOwnershipClaimState

type WorkspaceOwnershipClaimState struct {
	Fingerprint string                 `json:"fingerprint"`
	Claim       ResolvedOwnershipClaim `json:"claim"`
}

type WorkspaceOwnershipHistory

type WorkspaceOwnershipHistory struct {
	SchemaVersion      string                           `json:"schema_version"`
	OwnershipHistoryID string                           `json:"ownership_history_id"`
	Workspace          string                           `json:"workspace"`
	WorkspaceHistoryID string                           `json:"workspace_history_id"`
	LatestScanID       string                           `json:"latest_scan_id"`
	Scans              []WorkspaceOwnershipScan         `json:"scans"`
	Summary            WorkspaceOwnershipHistorySummary `json:"summary"`
	Latest             WorkspaceOwnershipLatest         `json:"latest"`
	Reviews            []OwnershipReview                `json:"reviews"`
	Transitions        []WorkspaceOwnershipTransition   `json:"transitions,omitempty"`
}

WorkspaceOwnershipHistory is a strict, privacy-normalized companion to one frozen WorkspaceHistory v1 timeline. It never contains raw public keys or unverified authorized_keys comments.

func BuildWorkspaceOwnershipHistory

func BuildWorkspaceOwnershipHistory(history *WorkspaceHistory, reviews ...*OwnershipReview) (*WorkspaceOwnershipHistory, error)

func ReadWorkspaceOwnershipHistory

func ReadWorkspaceOwnershipHistory(path string) (*WorkspaceOwnershipHistory, error)

type WorkspaceOwnershipHistorySummary

type WorkspaceOwnershipHistorySummary struct {
	Scans         int  `json:"scans"`
	ReviewedScans int  `json:"reviewed_scans"`
	MissingScans  int  `json:"missing_scans"`
	CurrentReview bool `json:"current_review"`
}

type WorkspaceOwnershipLatest

type WorkspaceOwnershipLatest struct {
	ReviewID          string           `json:"review_id"`
	ReviewSHA256      string           `json:"review_sha256"`
	ScanID            string           `json:"scan_id"`
	CompletedAt       string           `json:"completed_at"`
	Current           bool             `json:"current"`
	IdentityMapDigest string           `json:"identity_map_digest"`
	Summary           OwnershipSummary `json:"summary"`
}

type WorkspaceOwnershipScan

type WorkspaceOwnershipScan struct {
	ScanID       string `json:"scan_id"`
	CompletedAt  string `json:"completed_at"`
	Reviewed     bool   `json:"reviewed"`
	ReviewID     string `json:"review_id,omitempty"`
	ReviewSHA256 string `json:"review_sha256,omitempty"`
}

type WorkspaceOwnershipTransition

type WorkspaceOwnershipTransition struct {
	BeforeReviewID  string                          `json:"before_review_id"`
	AfterReviewID   string                          `json:"after_review_id"`
	BeforeScanID    string                          `json:"before_scan_id"`
	AfterScanID     string                          `json:"after_scan_id"`
	IdentityChanges []WorkspaceIdentityChange       `json:"identity_changes,omitempty"`
	ClaimChanges    []WorkspaceOwnershipClaimChange `json:"claim_changes,omitempty"`
	KeyChanges      []WorkspaceReviewedKeyChange    `json:"key_changes,omitempty"`
}

type WorkspaceReviewedKeyChange

type WorkspaceReviewedKeyChange struct {
	Action      string                     `json:"action"`
	Fingerprint string                     `json:"fingerprint"`
	Before      *WorkspaceReviewedKeyState `json:"before,omitempty"`
	After       *WorkspaceReviewedKeyState `json:"after,omitempty"`
}

type WorkspaceReviewedKeyState

type WorkspaceReviewedKeyState struct {
	Fingerprint        string   `json:"fingerprint"`
	Observed           bool     `json:"observed"`
	IdentityMapEntry   bool     `json:"identity_map_entry"`
	OwnershipStatus    string   `json:"ownership_status"`
	OffboardedAccess   bool     `json:"offboarded_access"`
	PossessionVerified bool     `json:"possession_verified"`
	Algorithm          string   `json:"algorithm,omitempty"`
	Bits               int      `json:"bits,omitempty"`
	Occurrences        int      `json:"occurrences"`
	Hosts              []string `json:"hosts,omitempty"`
	Accounts           []string `json:"accounts,omitempty"`
}

type WorkspaceTransition

type WorkspaceTransition struct {
	BeforeScanID    string           `json:"before_scan_id"`
	AfterScanID     string           `json:"after_scan_id"`
	Comparable      bool             `json:"comparable"`
	Reason          string           `json:"reason,omitempty"`
	CoverageCaveat  string           `json:"coverage_caveat,omitempty"`
	ExcludedHosts   []string         `json:"diff_excluded_hosts,omitempty"`
	Added           []AccessEdge     `json:"added,omitempty"`
	Removed         []AccessEdge     `json:"removed,omitempty"`
	CoverageChanges []CoverageChange `json:"coverage_changes,omitempty"`
}

Jump to

Keyboard shortcuts

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