Repository navigation
Conversation
Log only the operation and gRPC status code on encryption and decryption failures. Add regression coverage for request payloads and secret-bearing backend errors. ai-assisted=yes TNZGOV-447
dlinsley
reviewed
Oct 22, 2026
| LOGGER.error("Error for request: " + request.getPlain(), e); | ||
| // KMS error descriptions and causes can also contain credential data. | ||
| LOGGER.error("KMS encryption failed with status {}", e.getStatus().getCode()); | ||
| throw e; |
Contributor
There was a problem hiding this comment.
The credential data is most likely still in this exception that is getting thrown back to callers. Can you confirm how the callers handle / log these exceptions?
Contributor
Author
There was a problem hiding this comment.
Thanks for pointing that out.
Analyzed the call stacks with Codex. The exception ends up in DefaultExceptionHandler (components/errors/src/main/kotlin/org/cloudfoundry/credhub/generate/DefaultExceptionHandler.kt:18), which logs the complete exception, including causes. If the KMS includes a secret in its error description, that secret can reach application logs.
Made new commit to address that.
dlinsley
reviewed
Oct 22, 2026
| } | ||
| LOGGER.error("Error for request: " + request.getCipher(), e); | ||
| LOGGER.error("KMS decryption failed with status {}", e.getStatus().getCode()); | ||
| throw e; |
Contributor
Author
There was a problem hiding this comment.
Addressed in the new commit.
Preserve gRPC status codes while removing backend descriptions, causes, and trailers. Use a fixed invalid-ciphertext message and verify that wrapped exceptions cannot expose backend secrets. ai-assisted=yes TNZGOV-447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log only the operation and gRPC status code on encryption and decryption failures. Add regression coverage for request payloads and secret-bearing backend errors.
ai-assisted=yes
TNZGOV-447