Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: Fix an error when evaluating sensitive values #1501

Merged
merged 1 commit into from Sep 4, 2022

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Sep 4, 2022

Fixes #1457
See also terraform-linters/tflint-plugin-sdk#174

When evaluating a variable with sensitive = true, TFLint fails with the following error:

Failed to check ruleset; Failed to check `aws_instance_previous_type` rule: value has marks, so it cannot be serialized

This happens because sensitive values are implemented as cty marked values. Marked values will cause an error when encoded in the message pack format to respond to plugins.

https://github.com/terraform-linters/tflint-plugin-sdk/blob/v0.11.0/plugin/plugin2host/server.go#L132
https://github.com/zclconf/go-cty/blob/v1.11.0/cty/msgpack/marshal.go#L45-L47

This behavior works very well with sensitive values and avoids unintentional disclosure unless explicitly unmarked.

In this PR, to prevent unintentional disclosure of sensitive values, return an error and stop evaluation instead of unmarking sensitive values.

@wata727 wata727 merged commit c01d5eb into master Sep 4, 2022
@wata727 wata727 deleted the plugin_sensitive_error branch September 4, 2022 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Failed to eval a variable marked as sensitive
1 participant