attempt to fix once and for all the issue with json validation introduced with version 4.0.13#384
Open
jkimalane wants to merge 1 commit into
Open
attempt to fix once and for all the issue with json validation introduced with version 4.0.13#384jkimalane wants to merge 1 commit into
jkimalane wants to merge 1 commit into
Conversation
…uced with version 4.0.13
|
Who is reviewing pull requests in this project? We are affected by the same problem. @nikhil2611 |
|
@jkimalane Any chance you can also remove the value from the warning message? Vault is supposed to protect secrets, so they shouldn't be printed to the output. |
|
@jkimalane Also, this PR needs a developer certificate of origin. |
decoyjoe
reviewed
Jun 20, 2023
| # this returns false for whitespace escape sequences as well, e.g. \n\t | ||
| def printable?(string) | ||
| /[^[:print:]]|[[:space:]]/.match(string) | ||
| /[[:print:]]|[\n\r]/.match?(string) |
Contributor
There was a problem hiding this comment.
This isn't right either, it only ensures there's at least one printable character.
I think the regex just needs to check for any non-printable characters like this:
not /[^[:print:]]/.match?(string)
11 tasks
Contributor
|
New attempt at fixing this in #416. |
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.
Attempt to fix once and for all the issue with json validation introduced with version 4.0.13
Change introduced with version 4.0.13 breaks loading of perfectly valid json data into the Chef vault.
Description
Amended methods
printable?(string)andvalidate_json(json)so that json string which contains whitespaces or\nor\rescape sequences are marked as valid.Perfectly valid json object (read from a file) now validates without triggering an exception or displaying a warning message.
{ "dummy": "aaaa\naaaa\n" }Related Issue
#379
Types of changes
Checklist: