mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-26 16:36:26 -06:00
83428c91f1
Go's `append()` reserves the right to mutate its primary argument in-place, and
expects the caller to assign its return value to the same variable that was
passed as the primary argument. Due to what was almost definitely a typo
(followed by copy-paste mishap), the configschema `Block.ValueMarks` and
`Object.ValueMarks` functions were treating it like an immutable function that
returns a new slice.
In rare and hard-to-reproduce cases, this was causing bizarre malfunctions when
marking sensitive schema attributes in deeply-nested block structures --
omitting the marks for some sensitive values (🚨), and marking other entire
blocks as sensitive (which is supposed to be impossible). The chaotic and
unreliable nature of the bugs is likely related to `append()`'s automatic slice
reallocation behavior (if the append operation overflows the original array
allocation, the resulting behavior can _look_ immutable), but there might be
other contributing factors too.
This commit fixes existing instances of the problem, and wraps the desired
copy-and-append behavior in a helper function to simplify handling shared parent
paths in an immutable way.
|
||
---|---|---|
.. | ||
coerce_value_test.go | ||
coerce_value.go | ||
decoder_spec_test.go | ||
decoder_spec.go | ||
doc.go | ||
empty_value_test.go | ||
empty_value.go | ||
implied_type_test.go | ||
implied_type.go | ||
internal_validate_test.go | ||
internal_validate.go | ||
marks_test.go | ||
marks.go | ||
nestingmode_string.go | ||
none_required.go | ||
path_test.go | ||
path.go | ||
schema.go | ||
validate_traversal_test.go | ||
validate_traversal.go |