opentofu/internal/configs/configschema
Nick Fagerlund 83428c91f1 Fix accidental mutation of shared cty.Paths in ValueMarks funcs
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.
2023-01-19 12:39:19 -08:00
..
coerce_value_test.go handle NestedTypes in Block.CoerceValue 2021-09-14 16:02:50 -04:00
coerce_value.go handle NestedTypes in Block.CoerceValue 2021-09-14 16:02:50 -04:00
decoder_spec_test.go configs/configschema: fix missing "computed" attributes from NestedObject's ImpliedType (#29172) 2021-07-15 13:00:07 -04:00
decoder_spec.go remove usage of MinItems/MaxItems 2021-09-24 12:26:00 -04:00
doc.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
empty_value_test.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
empty_value.go handle nested types in StaticValidateTraversal 2022-08-04 17:17:00 -04:00
implied_type_test.go configs: Add sensitive marks for nested attributes 2021-11-25 11:55:17 -05:00
implied_type.go handle nested types in StaticValidateTraversal 2022-08-04 17:17:00 -04:00
internal_validate_test.go remove usage of MinItems/MaxItems 2021-09-24 12:26:00 -04:00
internal_validate.go handle nested types in StaticValidateTraversal 2022-08-04 17:17:00 -04:00
marks_test.go configs: Add sensitive marks for nested attributes 2021-11-25 11:55:17 -05:00
marks.go Fix accidental mutation of shared cty.Paths in ValueMarks funcs 2023-01-19 12:39:19 -08:00
nestingmode_string.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
none_required.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
path_test.go configs/configschema: extend block.AttributeByPath to descend into Objects (#29222) 2021-07-22 09:45:33 -04:00
path.go configs/configschema: extend block.AttributeByPath to descend into Objects (#29222) 2021-07-22 09:45:33 -04:00
schema.go remove usage of MinItems/MaxItems 2021-09-24 12:26:00 -04:00
validate_traversal_test.go validate deprecated attrs from static traversals 2022-08-08 09:58:11 -04:00
validate_traversal.go validate deprecated attrs from static traversals 2022-08-08 09:58:11 -04:00