opentofu/internal/configs
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
..
configload build: Use Go 1.19 2022-08-22 10:59:12 -07:00
configschema Fix accidental mutation of shared cty.Paths in ValueMarks funcs 2023-01-19 12:39:19 -08:00
hcl2shim Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
testdata Do not apply type defaults to null values 2022-09-15 15:32:36 -04:00
backend.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
checks.go configs: Fix check block configuration diagnostics 2022-06-21 12:13:45 -04:00
cloud.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
compat_shim.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
config_build_test.go configs: Refined error messages for mismatched provider passing 2022-03-10 10:05:56 -08:00
config_build.go configs: Refined error messages for mismatched provider passing 2022-03-10 10:05:56 -08:00
config_test.go check for duplicate defaults from resource names 2022-06-15 13:32:30 -04:00
config.go backend/local: Check dependency lock consistency before any operations 2021-10-01 14:43:58 -07:00
depends_on.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
doc.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
escaping_blocks_test.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
experiments_test.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
experiments.go configs: Show tailored message for optional attrs experiment 2022-07-01 09:08:12 -07:00
module_call_test.go Use hashicorp/terraform-registry-address as a decoupled library (#28338) 2022-07-08 14:46:29 +01:00
module_call.go addrs: Expose the registry address parser's error messages 2021-11-30 15:46:16 -08:00
module_merge_body.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
module_merge_test.go add failing test for IgnoreAllChanges override 2021-11-01 19:00:54 +00:00
module_merge.go IgnoreAllChanges should override during merge 2021-11-01 19:08:30 +00:00
module_test.go build: Use Go 1.19 2022-08-22 10:59:12 -07:00
module.go Allow cloud block overrides 2021-10-28 19:29:09 -05:00
moved_test.go normalise test names 2021-11-14 21:51:53 +00:00
moved.go configs: For Moved blocks, use addrs.MoveEndpoint instead of addrs.Target 2021-07-01 08:28:02 -07:00
named_values.go Do not apply type defaults to null values 2022-09-15 15:32:36 -04:00
parser_config_dir_test.go configs: valid-modules test ignores experimental features warning 2021-07-01 08:28:02 -07:00
parser_config_dir.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
parser_config_test.go configs: Decode preconditions and postconditions 2022-01-28 11:00:29 -05:00
parser_config.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
parser_test.go Refactoring of module source addresses and module installation 2021-06-03 08:50:34 -07:00
parser_values_test.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
parser_values.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
parser.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
provider_meta.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
provider_requirements_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
provider_requirements.go de-linting 2021-09-01 11:36:21 -04:00
provider_test.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
provider_validation.go fix: validate implied provider names in submodules (#31573) 2022-08-05 20:44:52 +01:00
provider.go build: Use Go 1.19 2022-08-22 10:59:12 -07:00
provisioner.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
provisioneronfailure_string.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
provisionerwhen_string.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
resource.go core: Defer on transitive dependencies for data resources with conditions 2022-05-11 11:01:38 -07:00
synth_body_test.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
synth_body.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
util.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
variable_type_hint.go build: Use Go 1.19 2022-08-22 10:59:12 -07:00
variabletypehint_string.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
version_constraint.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00