bundle

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 20 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 bundle builds, signs and stores policy bundles (0004 §4.6). The bundle Secret is both what the distribution server sends and the engines' cold-start source, and it carries the version sequence, so a new leader continues it.

Index

Constants

View Source
const (
	BundleSecret     = "inkwall-bundle"
	SigningKeySecret = "inkwall-bundle-signing-key" // #nosec G101 -- the Secret's name, not a credential
)

Names of the Secrets in the operator's namespace.

View Source
const (
	// BundleKey holds the gzip-compressed, serialized SignedBundle.
	BundleKey = "bundle.pb.gz"
	// PublicKeyKey holds the ed25519 public key the bundle is signed with,
	// so an engine reading the Secret can check which key it needs.
	PublicKeyKey = "ed25519.pub"
)

Keys of the bundle Secret.

View Source
const (
	VersionAnnotation = "waf.inkwall.dev/bundle-version"
	HashAnnotation    = "waf.inkwall.dev/content-hash"
)

Annotations on the bundle Secret, for people and tools.

View Source
const MaxCompressedBytes = 900 << 10

MaxCompressedBytes is the largest bundle stored: Secrets are limited to 1 MiB. Bundles reference the Core Rule Set by name, so this takes many thousands of policies.

Variables

View Source
var ErrTooLarge = errors.New("bundle too large for a Secret")

ErrTooLarge is returned for a bundle over MaxCompressedBytes.

Functions

func ContentHash

func ContentHash(b *bundlev1.Bundle) ([]byte, error)

ContentHash hashes what a bundle enforces: everything but its version, creation time and the hash itself. Encoding is deterministic, so equal content gives an equal hash within one operator version.

func Decode

func Decode(data []byte) (*bundlev1.SignedBundle, error)

Decode reads the content of the bundle Secret's BundleKey.

func Load

func Load(ctx context.Context, c client.Reader, namespace string) (*bundlev1.Bundle, error)

Load reads the current bundle from its Secret; nil if there is none.

func Next

func Next(current, content *bundlev1.Bundle, lastVersion uint64, now time.Time) (*bundlev1.Bundle, bool, error)

Next returns the bundle to publish for content, given the current one (nil if none), and whether it differs: unchanged content keeps the current version. lastVersion is the highest version this process published, so a deleted Secret doesn't restart the sequence while the leader runs.

func Store

func Store(ctx context.Context, c client.Client, namespace string, b *bundlev1.Bundle, signed *bundlev1.SignedBundle, pub ed25519.PublicKey) error

Store writes a signed bundle to the bundle Secret.

Types

type Signer

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

Signer signs bundles.

func LoadOrCreateSigner

func LoadOrCreateSigner(ctx context.Context, c client.Client, namespace string) (*Signer, error)

LoadOrCreateSigner reads the cluster's signing key from its Secret, and generates it on first use.

func NewSigner

func NewSigner(key ed25519.PrivateKey) *Signer

NewSigner returns a Signer for key, with a key ID derived from its public key.

func (*Signer) KeyID

func (s *Signer) KeyID() string

KeyID identifies the key.

func (*Signer) Public

func (s *Signer) Public() ed25519.PublicKey

Public returns the public key.

func (*Signer) Sign

func (s *Signer) Sign(b *bundlev1.Bundle) (*bundlev1.SignedBundle, error)

Sign serializes and signs b.

Jump to

Keyboard shortcuts

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