Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump SnakeYAML and Expose Parse Options #13

Merged
merged 4 commits into from
Aug 31, 2020

Conversation

erichaberkorn
Copy link
Contributor

@erichaberkorn erichaberkorn commented Aug 31, 2020

I made this change in three commits because it demonstrates that this is a breaking change. All the tests pass on d590965 and bumping to SnakeYAML 1.26 on f385f74 (even though it is a minor version bump) causes the test to fail.

SnakeYAML 1.26 patches CVE-2017-18640, which resulted in LoaderOptions adding setMaxAliasesForCollections and setAllowRecursiveKeys to control the amount of aliases SnakeYAML will attempt to parse and whether it allows recursive keys. This PR exposes those options to parse-string via :max-aliases-for-collections and :allow-recursive-keys.

This ends up breaking the new `too-many-aliases-works` test
@borkdude
Copy link
Collaborator

@slipset I guess it would be useful to set up CircleCI and Github in such a way that it's easy to verify if a PR breaks tests.

@slipset
Copy link
Member

slipset commented Aug 31, 2020

@borkdude Looking through all the options, it seems like it should build PR's, but I can see that it doesn't.

`max-aliases` exposes `setMaxAliasesForCollections`
`allow-recursive` exposes `setAllowRecursiveKeys`
@borkdude
Copy link
Collaborator

@slipset It seems the last build on master didn't do anything:

Screenshot 2020-08-31 at 16 42 29

@erichaberkorn
Copy link
Contributor Author

This is very strange. I have CircleCI setup on my fork and the checks are showing up properly there https://github.com/erichaberkorn/clj-yaml/commits/bump-snakeyaml

@borkdude
Copy link
Collaborator

@erichaberkorn Ah, that may be the issue. If you have your own CircleCI setup, then it won't run as a PR build probably.

Copy link
Collaborator

@marcomorain marcomorain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

")

(deftest allow-recursive-works
(is (thrown? YAMLException (parse-string recursive-yaml)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this assertion to thrown-with-msg? and check that the exception has the word Recursive in the message.

https://bitbucket.org/asomov/snakeyaml/src/1922347d615264c50041223ec2bd689906cbcb26/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java?at=master#lines-484

(string/join "\n")))

(deftest max-aliases-for-collections-works
(is (thrown? YAMLException (parse-string too-many-aliases)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this assertion to thrown-with-msg? and check that the exception has the string "Number of aliases" in the message.

https://bitbucket.org/asomov/snakeyaml/src/1922347d615264c50041223ec2bd689906cbcb26/src/main/java/org/yaml/snakeyaml/composer/Composer.java?at=master#Composer.java-147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants