-
Notifications
You must be signed in to change notification settings - Fork 234
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
safely deserialize k8 yaml #4071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are no other usages of this method ?
@@ -6,7 +6,14 @@ def self.parse_file(contents, filepath) | |||
|
|||
if filename.ends_with?('.yml', '.yaml') | |||
# NOTE: this will always return an array of entries | |||
YAML.load_stream(contents, filepath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapping this into a yaml_safe_load_stream
method would be nice + a test that makes sure it actually does not load unsafe
I couldn't find any other usages where the stream content can come from an untrusted source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test case 🎉
don't worry about bundle_audit that can be another PR |
Co-authored-by: Michael Grosser <michael@grosser.it>
Note: Samson is a public repo, do not include Zendesk-internal information, urls, etc.
Using YAML.load_stream is unsafe and allows instantiating arbitrary classes which may lead to remote code execution (RCE)
I had to use multiple streams because Samson needs to support multiple documents in a single yaml file
References
Risks