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

command/jsonplan: Fix sensitive/unknown crash #28253

Merged
merged 1 commit into from Mar 31, 2021

Conversation

alisdair
Copy link
Member

When rendering the JSON plan sensitivity output, if the plan contained unknown collection or structural types, Terraform would crash. We need to detect unknown values before attempting to iterate them.

Unknown collection or structural values cannot have sensitive contents accidentally displayed, as those values are not known until after apply. As a result we return an empty value of the appropriate type for the sensitivity mapping.

This doesn't change the JSON output itself, just resolves a crash.

When rendering the JSON plan sensitivity output, if the plan contained
unknown collection or structural types, Terraform would crash. We need
to detect unknown values before attempting to iterate them.

Unknown collection or structural values cannot have sensitive contents
accidentally displayed, as those values are not known until after apply.
As a result we return an empty value of the appropriate type for the
sensitivity mapping.
@alisdair alisdair added cli json-output 0.15-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Mar 31, 2021
@alisdair alisdair requested a review from a team March 31, 2021 18:35
@alisdair alisdair self-assigned this Mar 31, 2021
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #28253 (ff32fab) into main (788c57a) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
command/jsonplan/plan.go 34.05% <100.00%> (+0.95%) ⬆️
terraform/node_resource_plan.go 96.11% <0.00%> (-1.95%) ⬇️

@ghost
Copy link

ghost commented May 1, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.15-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged cli json-output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants