Prevent render failure from leaking secrets #983
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.
What are you trying to accomplish with this PR?
When a
krane rendertask fails it can potentially leak base64 encoded secrets in the clear.How is this accomplished?
This was discovered when a developer used Ruby's
Base64.encode64method to produce a secret value. The value was long enough to produced an encoded string longer than 60 characters.This caused krane to dump the base64 encoded secrets to the deployment logs.
Deployment tasks take action to prevent secrets leaking in this way, and we can reuse that logic for rendering failures.
🎩
Example before:
Example After:
What could go wrong?
From the outside, this doesn't seem to open krane up to any additional runtime risk.
Footnotes
https://github.com/Shopify/krane/blob/72ee07a311442751535b87a23ea843b71190e618/CONTRIBUTING.md?plain=1#L44 ↩
https://ruby-doc.org/3.4.1/gems/base64/Base64.html#method-i-encode64 ↩
https://ruby-doc.org/3.4.1/gems/base64/Base64.html#module-Base64-label-Newlines ↩