1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/psych] Add a note about safe_load

https://github.com/ruby/psych/commit/0910ae5575
This commit is contained in:
Aaron Patterson 2019-10-17 13:48:24 -07:00 committed by Hiroshi SHIBATA
parent 30fdee65d9
commit db33ab470c
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -264,6 +264,10 @@ module Psych
#
# Raises a TypeError when `yaml` parameter is NilClass
#
# NOTE: This method *should not* be used to parse untrusted documents, such as
# YAML documents that are supplied via user input. Instead, please use the
# safe_load method.
#
def self.load yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: false, symbolize_names: false
if legacy_filename != NOT_GIVEN
warn_with_uplevel 'Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE