use yaml.safe_load instead of yaml.load#5159
Closed
ashwini-orchestral wants to merge 4 commits intoStackStorm:masterfrom
Closed
use yaml.safe_load instead of yaml.load#5159ashwini-orchestral wants to merge 4 commits intoStackStorm:masterfrom
ashwini-orchestral wants to merge 4 commits intoStackStorm:masterfrom
Conversation
m4dcoder
requested changes
Feb 19, 2021
Contributor
m4dcoder
left a comment
There was a problem hiding this comment.
@ashwini-orchestral Looks like you included changes from another PR/commit into this PR. It is hard to tell what changes relate to this PR. Can you clean this up? You should branch from master and then apply the changes.
1 task
Kami
reviewed
Feb 22, 2021
|
|
||
| # 1. Check for duplicate keys | ||
| if not allow_duplicate_keys: | ||
| yaml.load(spec_string, UniqueKeyLoader) |
Member
There was a problem hiding this comment.
This function is only used to load openapi.yaml.j2 file which is controlled by us (developers), which means there should be no chance for "yaml type injection", but I do agree and still think it's better and safer to use yaml.safe_load.
Member
|
@ashwini-orchestral As @m4dcoder said, please remove unrelated changes so we can review |
Member
|
Superseded by #5162. |
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.
It is not safe to call yaml.load with any data received from an untrusted source. It allows instantiation of arbitrary objects. The function yaml.safe_load limits this ability to simple Python objects like integers or lists. For security reasons, yaml.safe_load is used.