Repository navigation
Fix panic when decrypting INI files with empty comment lines - #2354
Open
eliasehmann wants to merge 1 commit into
Open
eliasehmann wants to merge 1 commit into
eliasehmann wants to merge 1 commit into
Conversation
A comment block that starts with a line of only comment characters, like ';;;;;', ends up with an empty first line after stripCommentChar(). The INI library looks at the first character of every comment line when writing and panics on an empty line, so such files could be encrypted, but not decrypted again. Empty comment lines are now written as ';'. This also makes files that were already encrypted with such a comment decryptable. Fixes getsops#766. Signed-off-by: Elias Ehmann <41519164+eliasehmann@users.noreply.github.com>
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.
Fixes #766
An INI comment that starts with a line like
;;;;;can be encrypted, but decrypting the file panics. After the comment characters are stripped that line is empty, and the INI library cannot write an empty comment line.Empty comment lines are now written as
;. This also makes files decryptable that were already encrypted with such a comment.Note: an empty
#line at the start of a comment comes back as;.Includes a test with the example from the issue.