pulumi/pkg/resource/stack
Fraser Waters 4c1471ec06
Don't encrypt secrets to get ciphertext that isn't actually used (#15306)
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

While investigating into https://github.com/pulumi/pulumi/issues/15293 I
noticed that `SerializePropertyValue` was always calling into
`Encrypter.EncryptValue` (or `cachingCrypter.encryptSecret`) even when
`showSecrets` was true and the cipher text wasn't being returned.

This is a simple move of that logic into the `!showSecrets` branch so it
gets skipped entirely when the cipher text isn't needed.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-01-30 09:51:51 +00:00
..
testdata [secrets] Fix + refactor bulk decryption. (#9039) 2022-02-25 08:51:52 -08:00
checkpoint.go Check qualified type for root stackness (#14714) 2023-12-04 10:36:51 +00:00
checkpoint_test.go all: Drop ioutil 2023-01-06 16:35:14 -08:00
deployment.go Don't encrypt secrets to get ciphertext that isn't actually used (#15306) 2024-01-30 09:51:51 +00:00
deployment_test.go Don't encrypt secrets to get ciphertext that isn't actually used (#15306) 2024-01-30 09:51:51 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
plan.go Move sdk/go/common/display to /pkg/display (#13954) 2023-09-18 11:01:28 +00:00
secrets.go Remove b64 from the default secrets provider (#15163) 2024-01-17 13:29:51 +00:00
secrets_test.go Remove b64 from the default secrets provider (#15163) 2024-01-17 13:29:51 +00:00