@@ -411,6 +411,10 @@ class << self
411
411
#
412
412
# Returns the Ruby objects created by parsing the given +source+.
413
413
#
414
+ # BEWARE: This method is meant to serialise data from trusted user input,
415
+ # like from your own database server or clients under your control, it could
416
+ # be dangerous to allow untrusted users to pass JSON sources into it.
417
+ #
414
418
# - Argument +source+ must be, or be convertible to, a \String:
415
419
# - If +source+ responds to instance method +to_str+,
416
420
# <tt>source.to_str</tt> becomes the source.
@@ -425,9 +429,6 @@ class << self
425
429
# - Argument +proc+, if given, must be a \Proc that accepts one argument.
426
430
# It will be called recursively with each result (depth-first order).
427
431
# See details below.
428
- # BEWARE: This method is meant to serialise data from trusted user input,
429
- # like from your own database server or clients under your control, it could
430
- # be dangerous to allow untrusted users to pass JSON sources into it.
431
432
# - Argument +opts+, if given, contains a \Hash of options for the parsing.
432
433
# See {Parsing Options}[#module-JSON-label-Parsing+Options].
433
434
# The default options can be changed via method JSON.unsafe_load_default_options=.
@@ -564,6 +565,16 @@ def unsafe_load(source, proc = nil, options = nil)
564
565
#
565
566
# Returns the Ruby objects created by parsing the given +source+.
566
567
#
568
+ # BEWARE: This method is meant to serialise data from trusted user input,
569
+ # like from your own database server or clients under your control, it could
570
+ # be dangerous to allow untrusted users to pass JSON sources into it.
571
+ # If you must use it, use JSON.unsafe_load instead to make it clear.
572
+ #
573
+ # Since JSON version 2.8.0, `load` emits a deprecation warning when a
574
+ # non native type is deserialized, without `create_additions` being explicitly
575
+ # enabled, and in JSON version 3.0, `load` will have `create_additions` disabled
576
+ # by default.
577
+ #
567
578
# - Argument +source+ must be, or be convertible to, a \String:
568
579
# - If +source+ responds to instance method +to_str+,
569
580
# <tt>source.to_str</tt> becomes the source.
@@ -578,10 +589,6 @@ def unsafe_load(source, proc = nil, options = nil)
578
589
# - Argument +proc+, if given, must be a \Proc that accepts one argument.
579
590
# It will be called recursively with each result (depth-first order).
580
591
# See details below.
581
- # BEWARE: This method is meant to serialise data from trusted user input,
582
- # like from your own database server or clients under your control, it could
583
- # be dangerous to allow untrusted users to pass JSON sources into it.
584
- # If you must use it, use JSON.unsafe_load instead to make it clear.
585
592
# - Argument +opts+, if given, contains a \Hash of options for the parsing.
586
593
# See {Parsing Options}[#module-JSON-label-Parsing+Options].
587
594
# The default options can be changed via method JSON.load_default_options=.
0 commit comments