Skip to content
New issue

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

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

Already on GitHub? # to your account

Check syntax with unsafe_load / load #44

Merged
merged 3 commits into from
May 5, 2022

Conversation

jamiemccarthy
Copy link
Contributor

As we discussed in #43, this changes check_syntax_valid? to attempt to process YAML data with unsafe_load if it is available, or load otherwise.

Unlike safe_load, these methods permit processing of valid YAML data that can be problematic if controlled by an adversary. But I argue that yamllint, designed to check files on disk, is processing a type of source code already anyway, so there is already an assumption that no adversary is writing to those files.

The technique of using unsafe_load and falling back to load is compatible across Ruby's behavior change in version 3.1, and is borrowed from Rails' approach to this same issue.

@shortdudey123
Copy link
Owner

Can you add a line to the change log file? then this should be good to merge.

@jamiemccarthy
Copy link
Contributor Author

Sure thing!

@shortdudey123 shortdudey123 merged commit 5cd0d51 into shortdudey123:master May 5, 2022
@jamiemccarthy jamiemccarthy deleted the jm-unsafe-load branch May 7, 2022 02:45
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants