secrets

package module
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: 0 Imported by: 11 modules, 9 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 secrets decodes secret values by invoking the configured executable command

Index

Constants

View Source
const PayloadVersion = "1.1"

PayloadVersion defines the current payload version sent to a secret backend

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	// Configure the executable command that is used for decoding secrets
	Configure(config ConfigParams)
	// Resolve resolves the secrets in the given yaml data by replacing secrets handles by their corresponding secret value.
	//
	// Setting 'notify' to true will send notifications for any resolve secrets. This is meant for callers that when
	// to replace handle themselves in memory. only the configuration requires this at the moment.
	Resolve(data []byte, origin string, imageName string, kubeNamespace string, notify bool) ([]byte, error)
	// SubscribeToChanges registers a callback to be invoked whenever secrets are resolved or refreshed
	SubscribeToChanges(callback SecretChangeCallback)
	// Refresh schedules a throttled asynchronous secret refresh. Returns true if the
	// secret refresh mechanism is enabled (backend configured and refresh interval set).
	Refresh() bool
	// RefreshNow performs an immediate blocking secret refresh, returning an informative message suitable for user display.
	RefreshNow() (string, error)
	// IsValueFromSecret returns true if the given value was ever resolved from a secret handle.
	IsValueFromSecret(value string) bool
	// RemoveOrigin removes a origin from the internal cache of the secret component. This does not remove secrets
	// from the cache but the reference where those secrets are used.
	RemoveOrigin(origin string)
	// SetOriginName associates an origin, as given to Resolve, with a readable name for it (ex: the integration name).
	SetOriginName(origin string, name string)
	// GetPathsAndHandles returns, for each place a secret appears in the configuration, the setting's origin + path
	// where it appears and the corresponding handle. The elements in each slice correlate to each other. Origin
	// is omitted for `datadog.yaml`, otherwise its name (see SetOriginName) is prepended with a ':'.
	GetPathsAndHandles() ([]string, []string)
	// GetHashValues returns, for each given handle with a resolved value, the hex encoded SHA-256 hash of that
	// value. Handles that have not been resolved are omitted from the result.
	GetHashValues(handles []string) map[string]string
}

Component is the component type.

type ConfigParams

type ConfigParams struct {
	Type                         string
	Config                       map[string]interface{}
	MultiBackends                map[string]SecretBackendConfig
	Command                      string
	Arguments                    []string
	Timeout                      int
	MaxSize                      int
	RefreshInterval              int
	RefreshIntervalScatter       bool
	GroupExecPerm                bool
	RemoveLinebreak              bool
	RunPath                      string
	AuditFileMaxSize             int
	ScopeIntegrationToNamespace  bool
	AllowedNamespace             []string
	ImageToHandle                map[string][]string
	APIKeyFailureRefreshInterval int
}

ConfigParams holds parameters for configuration

type SecretBackendConfig added in v0.80.0

type SecretBackendConfig struct {
	Type   string                 `mapstructure:"type"`
	Config map[string]interface{} `mapstructure:"config"`
}

SecretBackendConfig holds the configuration for a single named backend in multi_secret_backends.

type SecretChangeCallback

type SecretChangeCallback func(handle, origin string, path []string, oldValue, newValue any)

SecretChangeCallback is the callback type used by SubscribeToChanges to send notifications This callback will be called once for each time a handle at a particular path is resolved or refreshed `handle`: the handle of the secret (example: `ENC[api_key]` the handle is `api_key`) `origin`: origin file of the configuration `path`: a path into the config file where the secret appears, each part is a level of nesting, arrays will use stringified indexes `oldValue`: the value that the secret used to have, the empty string "" is it hasn't been resolved before `newValue`: the new value that the secret has resolved to

type SecretVal

type SecretVal struct {
	Value    string `json:"value,omitempty"`
	ErrorMsg string `json:"error,omitempty"`
}

SecretVal defines the structure for secrets in JSON output

Jump to

Keyboard shortcuts

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