Closed rramge closed 2 years ago
Just saying... makring a value as sensitive is not enough, it is still saved in plain text in the state and inherited to modules. A simple "terraform state pull" shares the secrets with whoever wants them.
You need to set it as write-only. Sensitive flag is not enough.
You have a gaping security hole here. It also raises the question why you can retrieve the secret from the API in the first place (and why the API can read it in clear text from whatever data store is used in the backend).
Terraform provider version
Affected Resource(s)
Terraform Configuration Files
Config is irrelevant, but here's the statefile content instead:
Debug Output/Panic Output
Steps to Reproduce
terraform state show
Expected Behavior
The access_key should not be displayed or stored in plain text, the secret_key must not be displayed or stored in plain text. This is only acceptable during the actual creation time, but not afterwards. Usually, such fields are supposed to be write-only. Secrets like keys and passwords should not be stored in any backend in plain text anyway, so I wonder from where the provider gets this information during a refresh in the first place? I am a bit worried that this may hint at the major security issue in the backend.
Actual Behavior
Keys are displayed and saved in the statefile in plain text.
Important Factoids
When creating an empty resource, and importing an existing user with configured keys, the secret keys are not displayed or stored but treated as nonexistent. Here, the behaviour is correct. Phew.
References