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.