Repository navigation
Conversation
readSecrets and readSealedSecrets skipped any document that decoded to an empty object, including documents that failed to parse. With a multi-document input where one document has a YAML syntax error, kubeseal sealed the valid ones, dropped the broken one and exited 0. Return the decode error for empty documents too. Empty documents (e.g. a stray "---") still decode without error and are skipped. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
This branch has not been deployed
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.
Description of the change
readSecretsandreadSealedSecretsskip every document that decodes to an empty object, and that includes documents that failed to parse. So with a multi-document input where one document is broken, kubeseal seals the others, silently drops the broken one and exits 0:Only
s1comes out and nothing is reported fors2. The same happens for--validateand--re-encrypt, which go throughreadSealedSecrets.The change returns the decode error when the document is empty and the error is not
io.EOF. Empty documents (a stray---, comment-only documents) still decode without an error and are skipped as before.Benefits
A typo in one document of a multi-document file is reported instead of producing a SealedSecret file that is missing a secret.
Possible drawbacks
Inputs that only worked because the broken part was ignored now fail. When the first document is malformed, the error is now the parse error instead of "no secrets found".
Applicable issues
None found.
Additional information
Added
TestSealWithMalformedDocumentandTestReadSealedSecretsWithMalformedDocument; both fail onmainand pass with the change.go test ./pkg/kubeseal/ ./cmd/kubeseal/passes.