summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-05-13Introduce `Psych.unsafe_load`Aaron Patterson
In future versions of Psych, the `load` method will be mostly the same as the `safe_load` method. In other words, the `load` method won't allow arbitrary object deserialization (which can be used to escalate to an RCE). People that need to load *trusted* documents can use the `unsafe_load` method. This commit introduces the `unsafe_load` method so that people can incrementally upgrade. For example, if they try to upgrade to 4.0.0 and something breaks, they can downgrade, audit callsites, change to `safe_load` or `unsafe_load` as required, and then upgrade to 4.0.0 smoothly.
2021-05-10Merge pull request #475 from whitehat101/feature/dynamic-scalar-seq-styleAaron Patterson
feat: allow scalars and sequences to be styled when dumped
2021-05-10Merge pull request #480 from Shopify/symbolize-name-non-string-keysHiroshi SHIBATA
Fix symbolize_name with non-string keys
2021-04-26Fix some typos [ci skip]Ryuta Kamizono
2021-02-25Fix symabolize_name with non-string keysJean Boussier
2021-02-24bump versionAaron Patterson
2021-02-24Merge pull request #476 from Shopify/symbolize-name-ruby-objectAaron Patterson
Fix custom marshalization with symbolize_names: true
2021-02-23Update to latest SnakeYAMLCharles Oliver Nutter
Fixes jruby/jruby#6365
2021-02-15Fix custom marshalization with symbolize_names: trueJean Boussier
2021-02-07feat: allow scalars and sequences to be styled when dumpedJeremy Ebler
2021-01-30Cache dispatch cache in an instance variableJean Boussier
2021-01-30Cache access to Psych.load_tags in Visitor::ToRubyJean Boussier
2020-12-23Bump version to 3.3.0Hiroshi SHIBATA
2020-12-23[ruby/psych] Optimize cache with `compare_by_identity`Marc-Andre Lafortune
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in https://github.com/JuanitoFatas/fast-ruby/issues/189
2020-12-23[ruby/psych] Make Ractor-ready.Marc-Andre Lafortune
Config is Ractor-local. Benchmarking reveals that using `Ractor.local_storage` for storing cache is similar to accessing a constant (~15% slower).
2020-12-23[ruby/psych] Don't use instance variables directly for configMarc-Andre Lafortune
2020-12-23[ruby/psych] Avoid methods depending on bindingsMarc-Andre Lafortune
Improves Ractor-readiness.
2020-12-23[ruby/psych] Freeze constants.Marc-Andre Lafortune
Improves Ractor-readiness.
2020-12-14Bump version to 3.2.1Hiroshi SHIBATA
2020-12-14Merge pull request #459 from tbrisker/patch-1Hiroshi SHIBATA
Remove unneeded assignment and condition
2020-11-12Add `Psych.safe_load_file`. Tweak doc to provide `safe_` examples.Marc-Andre Lafortune
2020-09-10Forward keyword arguments in load_file and load_streamJean Boussier
2020-08-01Remove unneeded assignment and conditionTomer Brisker
Since we already `return fallback` if `result` is falsy, we don't need to check again if it's truthy and reassign the `to_ruby` result.
2020-07-18Bump version to 3.2.0Hiroshi SHIBATA
2020-07-16Remove private_iv_getCharles Oliver Nutter
The only remaining use of this function was to get the internal message object from an exception's hidden `mesg` instance variable to allow it to be dumped wiithout converting to a string. As discussed in #103, this exposes internal implementation details of CRuby, and ultimately does not provide any real utility to the user since they can't directly inspect this hidden variable. The test change here is to reflect CRuby behavior that denies equality if the internal message objects do not match, as is the case after the exception has been loaded and now has a simple String value. The impact to users is that exceptions with special hidden message objects will convert those objects to String during marshaling through YAML. I believe this only affects NameError and its descendants, since users can't set this field directly on their own exception types. Fixes #103.
2020-07-16Revert psych versionSzymonKowalczyk
2020-07-16Update SNAKEYAML CVE-2017-18640SzymonKowalczyk
to version 1.26
2020-06-08Fix anchor lookup with symbolized namesJean Boussier
2020-06-03Merge pull request #438 from mthorn/masterAaron Patterson
Fix ArgumentError with leading and trailing underscores in number str…
2020-03-17Remove unnecessary version guard from versions.rbDavid Rodríguez
Removing it triggers the following warnings when running `bundle` under jruby from the root of the `psych` repo prints the following warnings: ``` /path/to/jruby-9.2.9.0/lib/ruby/gems/shared/gems/psych-3.1.0-java/lib/psych/versions.rb:7: warning: already initialized constant VERSION /path/to//jruby-9.2.9.0/lib/ruby/gems/shared/gems/psych-3.1.0-java/lib/psych/versions.rb:10: warning: already initialized constant DEFAULT_SNAKEYAML_VERSION ``` This is because bundler loads the versions file relatively from the local gemspec, and then internally loads the psych gem, causing the redefinition warnings. Instead, we modify the $LOAD_PATH so that when working locally on the `psych` repo, the local version of `psych` gets used.
2020-03-03Fix ArgumentError with leading and trailing underscores in number strings.Mark Thorn
2019-11-28Implement `freeze` option for Pysch.loadJean Boussier
2019-11-28Implement a freeze load optionJean Boussier
2019-11-28Refactor `symbolize_names`Jean Boussier
2019-10-21Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. I'm not sure if the untaint calls in deduplicate are still needed after the removal of tainting in the parser. If they are not needed, they should be removed.
2019-10-17Add a note about safe_loadAaron Patterson
2019-07-22Deduplicate hash keys if they're stringsJean Boussier
2019-07-21Drop to support fat gem support.Hiroshi SHIBATA
ref. https://github.com/ruby/bigdecimal/pull/149
2019-04-26Do not allocate a string to check if a scalar is an integerJean Boussier
2019-04-26Remove string_cache in ScalarScannerJean Boussier
2019-04-26Reduce string allocations in scalar_scannerJean Boussier
2019-01-16Dump Hash ivars before elementsAaron Patterson
When the Hash is revived, the ivars will be set before elements. This is for the case when the hash setter depends on ivars set on the hash.
2019-01-09Round trip exception backtracesAaron Patterson
This commit allows exception backtraces to round trip
2019-01-09Refactor exception dumpingAaron Patterson
2019-01-09Dumping the backtrace never worked, so remove itAaron Patterson
Dumping the backtrace for exceptions never worked, so lets remove it.
2018-12-18Bump psych 3.1.0.SHIBATA Hiroshi
2018-11-23Add uplelvel to deprecation warning of PsychKoichi ITO
This is porting ruby/ruby#1992 to upstream. This PR adds `uplelvel` to deprecation warning of Psych. The `uplevel` option was introduced from Ruby 2.5. ruby/psych needs to support Ruby 2.4 or lower. This PR has `warn_with_uplevel` method emulating `warn 'message', uplevel: 1` in Ruby 2.4 or lower. And this PR relaxes the warning. https://github.com/ruby/ruby/pull/1992#discussion_r227214370 ## Summary The deprecation warning log has been added the following commit. https://github.com/ruby/ruby/commit/1c92766bf0b7394057c00f576fce5464a3037fd9 The following is deprecation warning log change. ### Example code ```console % cat /tmp/psych_example.rb require 'psych' Psych.load("--- foo\n", nil) ``` ### Before ```console % ruby -v ruby 2.6.0dev (2018-10-21 trunk 65252) [x86_64-darwin17] % ruby /tmp/psych_example.rb warning: Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead. ``` ### After This patch helps detect argument locations that are deprecated usage. ```console % cd /path/to/ruby/repo % make install % /usr/local/bin/ruby /tmp/psych_example.rb /tmp/psych_example.rb:3: warning: Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead. ``` ## Other Information This log format refers to the deprecation warning of `ERB.new` in Ruby 2.6+. https://github.com/ruby/ruby/blob/v2_6_0_preview2/lib/erb.rb#L808
2018-11-10Use friendlier terminology in YAML.safe_loadJuanito Fatas
Replace keyword argumment whitelist_classes and whitelist_symbols. with permitted_classes and permitted_symbols.
2018-10-20bump version to 3.1.0.pre2SHIBATA Hiroshi
2018-10-13Use secure connection for pyyaml.orgEspartaco Palma