uptane

package
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 25 Imported by: 1 module, 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 uptane contains the logic needed to perform the Uptane verification checks against stored TUF metadata and the associated config files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMetadata added in v0.73.0

type AgentMetadata struct {
	Version      string    `json:"version"`
	APIKeyHash   string    `json:"api-key-hash"`
	CreationTime time.Time `json:"creation-time"`
	URL          string    `json:"url"`
}

AgentMetadata is data stored in bolt DB to determine whether or not the agent has changed and the RC cache should be cleared

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Client is an uptane client

func (*Client) Close added in v0.73.0

func (c *Client) Close() error

Close will close the underlying boltDB

func (*Client) DirectorRoot

func (c *Client) DirectorRoot(version uint64) ([]byte, error)

DirectorRoot returns a director root

func (*Client) GetTransactionalStoreMetadata added in v0.73.0

func (c *Client) GetTransactionalStoreMetadata() (*Metadata, error)

GetTransactionalStoreMetadata returns metadata that creates the underlying boltDB instance

func (*Client) State

func (c *Client) State() (State, error)

State returns the state of the uptane client

func (*Client) StoredOrgUUID

func (c *Client) StoredOrgUUID() (string, error)

StoredOrgUUID returns the org UUID given by the backend

func (*Client) TUFVersionState

func (c *Client) TUFVersionState() (TUFVersions, error)

TUFVersionState TODO <remote-config>

func (*Client) TargetFile

func (c *Client) TargetFile(path string) ([]byte, error)

TargetFile returns the content of a target if the repository is in a verified state

func (*Client) TargetFiles added in v0.62.0

func (c *Client) TargetFiles(targetFiles []string) (map[string][]byte, error)

TargetFiles returns the content of various multiple target files if the repository is in a verified state.

func (*Client) Targets

func (c *Client) Targets() (data.TargetFiles, error)

Targets returns the current targets of this uptane client

func (*Client) TargetsCustom

func (c *Client) TargetsCustom() ([]byte, error)

TargetsCustom returns the current targets custom of this uptane client

func (*Client) TargetsMeta

func (c *Client) TargetsMeta() ([]byte, error)

TargetsMeta verifies and returns the current raw targets.json meta of this uptane client

func (*Client) TimestampExpires added in v0.65.0

func (c *Client) TimestampExpires() (time.Time, error)

TimestampExpires returns the expiry time of the current up-to-date timestamp.json

func (*Client) UnsafeTargetsMeta added in v0.65.0

func (c *Client) UnsafeTargetsMeta() ([]byte, error)

UnsafeTargetsMeta returns the current raw targets.json meta of this uptane client without verifying

type ClientOption

type ClientOption func(c *Client)

ClientOption describes a function in charge of changing the uptane client

func WithConfigRootOverride

func WithConfigRootOverride(site string, configRootOverride string) ClientOption

WithConfigRootOverride overrides config root

func WithDirectorRootOverride

func WithDirectorRootOverride(site string, directorRootOverride string) ClientOption

WithDirectorRootOverride overrides director root

func WithOrgIDCheck

func WithOrgIDCheck(orgID int64) ClientOption

WithOrgIDCheck sets the org ID

type CoreAgentClient added in v0.59.0

type CoreAgentClient struct {
	*Client
	// contains filtered or unexported fields
}

CoreAgentClient is an uptane client that fetches the latest configs from the Core Agent

func NewCoreAgentClientWithNewTransactionalStore added in v0.73.0

func NewCoreAgentClientWithNewTransactionalStore(dbMetadata *Metadata, orgUUIDProvider OrgUUIDProvider, options ...ClientOption) (c *CoreAgentClient, err error)

NewCoreAgentClientWithNewTransactionalStore creates a new uptane client with a new transactional store

func NewCoreAgentClientWithRecreatedTransactionalStore added in v0.73.0

func NewCoreAgentClientWithRecreatedTransactionalStore(dbMetadata *Metadata, orgUUIDProvider OrgUUIDProvider, options ...ClientOption) (c *CoreAgentClient, err error)

NewCoreAgentClientWithRecreatedTransactionalStore creates a new uptane client with a recreated transactional store

func (*CoreAgentClient) EmbeddedRootVersions added in v0.86.0

func (c *CoreAgentClient) EmbeddedRootVersions() (TUFVersions, error)

EmbeddedRootVersions returns the versions of the roots embedded in the agent binary (the open-source roots shared by every DC). Those are the root versions a brand new agent reports on its first request, and the anchor the DC switch recovery verifies from.

func (*CoreAgentClient) TryRecoverFromEmbeddedRoot added in v0.86.0

func (c *CoreAgentClient) TryRecoverFromEmbeddedRoot(response *pbgo.LatestConfigsResponse) error

TryRecoverFromEmbeddedRoot implements the DC switch recovery. When an org moves to another DC behind the same URL, the normal TUF update fails permanently: the latched state belongs to the old DC and cannot verify the new DC's metadata, and since both DCs share the embedded root version no root files are sent to repair the chain.

This method verifies a fresh-join payload (what a brand new agent receives: the full root chain from the embedded root, a complete set of metadata) entirely in memory, starting from the embedded root. The embedded root is the only key material shared across DCs, so it is the only sound anchor to decide the new DC's chain is trustworthy; verifying from it introduces no new trust compared to a fresh agent.

On success, and only if the payload belongs to the same org (the org UUID signed in the new DC's snapshot must match both the org UUID of the API key and the previously stored one), the RC DB is wiped and the client rebuilt on the new DC's state.

The wipe is further gated on an actual chain change: the verified payload must be signed by different root keys than the latched state (each DC signs with its own keys). A payload signed by the same keys is a replay of the current chain, for example a rollback attempt that the version checks of the normal update path already rejected. The DB wipe resets the version counters, so accepting such a payload would disable TUF rollback protection; it is rejected without touching the state.

A failure before or during the wipe leaves the current state untouched (the wipe itself is a single rolled-back bolt transaction). A failure after the wipe (the update replay or the commit) leaves the client on the emptied DB, latched at the embedded root like a brand new agent: the old DC's state is gone, and the next successful update rebuilds the state from scratch.

func (*CoreAgentClient) Update added in v0.59.0

func (c *CoreAgentClient) Update(response *pbgo.LatestConfigsResponse) error

Update updates the uptane client and rollbacks in case of error

type MetaState

type MetaState struct {
	Version uint64
	Hash    string
}

MetaState represents the state of a tuf file

type Metadata added in v0.73.0

type Metadata struct {
	Path         string
	AgentVersion string
	APIKey       string
	URL          string
}

Metadata needed in order to recreate boltDB

type OrgUUIDProvider

type OrgUUIDProvider func() (string, error)

OrgUUIDProvider is a provider of the agent org UUID

type State

type State struct {
	ConfigState     map[string]MetaState
	DirectorState   map[string]MetaState
	TargetFilenames map[string]string
}

State represents the state of an uptane client

func (*State) ConfigRootVersion

func (s *State) ConfigRootVersion() uint64

ConfigRootVersion returns the version of the config root.json file

func (*State) ConfigSnapshotVersion

func (s *State) ConfigSnapshotVersion() uint64

ConfigSnapshotVersion returns the version of the config snapshot.json file

func (*State) DirectorRootVersion

func (s *State) DirectorRootVersion() uint64

DirectorRootVersion returns the version of the director root.json file

func (*State) DirectorTargetsVersion

func (s *State) DirectorTargetsVersion() uint64

DirectorTargetsVersion returns the version of the director targets.json file

type TUFVersions

type TUFVersions struct {
	DirectorRoot    uint64
	DirectorTargets uint64
	ConfigRoot      uint64
	ConfigSnapshot  uint64
}

TUFVersions TODO <remote-config>

Jump to

Keyboard shortcuts

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