sensitivity

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 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 sensitivity answers whether a field of a resource or data source holds a value its plugin declared sensitive.

Sensitivity is declared on the field a plugin author thinks of as secret, which for a map or object of secrets is the container rather than each of its entries, so answering the question means walking a schema and inheriting what the ancestors declared. The engine is the only component holding both the provider registries and the field paths that appear in state, changesets and drift records, which is why this lives here.

Nothing here redacts. It marks, and leaves what to do about it to the caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index reports which fields of a type hold sensitive values, from the spec schemas the provider registries expose.

Schemas are fetched once per type and kept: a plugin's schema is fixed for as long as the plugin is running, and the registry call may cross a process boundary.

func NewIndex

func NewIndex(
	resources resourcehelpers.Registry,
	dataSources provider.DataSourceRegistry,
) *Index

NewIndex returns an index over the given registries.

func (*Index) DataSourceField

func (i *Index) DataSourceField(
	ctx context.Context,
	dataSourceType string,
	fieldName string,
) (bool, error)

DataSourceField reports whether an exported field of a data source holds a sensitive value.

Data source specs hold a flat set of fields of primitives or arrays of primitives, so there is no nesting to inherit through.

func (*Index) ResourceField

func (i *Index) ResourceField(
	ctx context.Context,
	resourceType string,
	fieldPath string,
) (bool, error)

ResourceField reports whether a field of a resource's spec holds a sensitive value.

The path is the form that appears in field changes and resource state mappings, with the "spec" prefix optional: "spec.secureValues.dbPassword" and "secureValues.dbPassword" address the same field. A path addressing anything other than the spec, such as a metadata field change, is not sensitive as far as this index is concerned; see the note on the walk below.

A field is sensitive when it or any of its ancestors is declared sensitive, so marking a map of secrets marks everything in it. Computed fields are deliberately not exempt as a value a provider computed from a secret is still a secret.

Jump to

Keyboard shortcuts

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