aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2021-09-23The yaml.load{,_all} functions require Loader= nowIngy döt Net
2021-09-23Add a basic test file for yaml.load and yaml.dumpIngy döt Net
2021-09-23Fix float resolver for '.' and '._'Tina Müller
A single dot matches the official YAML 1.1 int regex. This was probably unintended. The regex now requires at least a digit before or after the dot.
2021-09-23Use with statements to eliminate ResourceWarningsThom Smith
2021-09-23Add a test for the YAML 1.1 typesTina Müller
2021-09-23Fix issue with representing Enum typesThom Smith
2021-09-22Move code from lib3 to libThom Smith
2021-09-22Remove 2.7 supportThom Smith
2021-01-13constructor.timezone: __copy_ & __deepcopy__Ovv
close #387
2021-01-13Fix for CVE-2020-14343Ingy döt Net
Per suggestion https://github.com/yaml/pyyaml/issues/420#issuecomment-663888344 move a few constructors from full_load to unsafe_load.
2021-01-13Build modernization (GHA, wheels, setuptools) (#407)Brad Solomon
* Move most CI to GitHub Actions * Build sdist * Build manylinux1 wheels with libyaml ext (also tested with 2010 and 2014) * Build MacOS x86_64 wheels with libyaml ext * Windows wheel builds remain on AppVeyor until we drop 2.7 support in 6.0 * Smoke tests of all post-build artifacts * Add PEP517/518 build declaration (pyproject.toml with setuptools backend) * Fully move build to setuptools * Drop Python 3.5 support * Declare Python 3.9 support * Update PyPI metadata now that setuptools lets it flow through Co-authored-by: Matt Davis <mrd@redhat.com>
2020-03-18Move test files back into tests/data/Ingy döt Net
2020-03-17Prevents arbitrary code execution during python/object/new constructor (#386)Riccardo Schirone
* Prevents arbitrary code execution during python/object/new constructor In FullLoader python/object/new constructor, implemented by construct_python_object_apply, has support for setting the state of a deserialized instance through the set_python_instance_state method. After setting the state, some operations are performed on the instance to complete its initialization, however it is possible for an attacker to set the instance' state in such a way that arbitrary code is executed by the FullLoader. This patch tries to block such attacks in FullLoader by preventing set_python_instance_state from setting arbitrary properties. It implements a blacklist that includes `extend` method (called by construct_python_object_apply) and all special methods (e.g. __set__, __setitem__, etc.). Users who need special attributes being set in the state of a deserialized object can still do it through the UnsafeLoader, which however should not be used on untrusted input. Additionally, they can subclass FullLoader and redefine `get_state_keys_blacklist()` to extend/replace the list of blacklisted keys, passing the subclassed loader to yaml.load. * Make sure python/object/new constructor does not set some properties * Add test to show how to subclass FullLoader with new blacklist
2019-12-20Add tests for timezone (#363)Tina Müller (tinita)
After #163, this adds some test data to check if the datetime objects return the correct timezone
2019-12-20increase size of index, line, and column fields (#310)Dwight Guth
* increase size of index, line, and column fields * use size_t instead of unsigned long long * better test infrastructure for test for large file * only run large file test when env var is set * fix review comments regarding env vars * fix missing import on python 3 * force all tests in CI
2019-12-20Fix for Python 3.10 (#329)Hugo van Kemenade
2019-12-20Enable certain unicode tests when maxunicode not > 0xffffTina Müller
They were disabled in d6cbff662084dd94bde5421ece495482d1b14454 After #351 the tests are working again
2019-12-07Allow add_multi_constructor with None (#358)Tina Müller (tinita)
Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
2019-12-07Fix handling of __slots__ (#161)Filip Salomonsson
2019-03-12Skip certain unicode tests when maxunicode not > 0xffffTina Müller
2019-03-08Allow to turn off sorting keys in DumperTina Müller
2019-03-08Apply FullLoader/UnsafeLoader changes to lib3Tina Müller
2019-03-08Deprecate/warn usage of yaml.load(input)Ingy döt Net
The `load` and `load_all` methods will issue a warning when they are called without the 'Loader=' parameter. The warning will point to a URL that is always up to date with the latest information on the usage of `load`. There are several ways to stop the warning: * Use `full_load(input)` - sugar for `yaml.load(input, FullLoader)` * FullLoader is the new safe but complete loader class * Use `safe_load(input)` - sugar for `yaml.load(input, SafeLoader)` * Make sure your input YAML consists of the 'safe' subset * Use `unsafe_load(input)` - sugar for `yaml.load(input, UnsafeLoader)` * Make sure your input YAML consists of the 'safe' subset * Use `yaml.load(input, Loader=yaml.<loader>)` * Or shorter `yaml.load(input, yaml.<loader>)` * Where '<loader>' can be: * FullLoader - safe, complete Python YAML loading * SafeLoader - safe, partial Python YAML loading * UnsafeLoader - more explicit name for the old, unsafe 'Loader' class * yaml.warnings({'YAMLLoadWarning': False}) * Use this when you use third party modules that use `yaml.load(input)` * Only do this if input is trusted The above `load()` expressions all have `load_all()` counterparts. You can get the original unsafe behavior with: * `yaml.unsafe_load(input)` * `yaml.load(input, Loader=yaml.UnsafeLoader)` In a future release, `yaml.load(input)` will raise an exception. The new loader called FullLoader is almost entirely complete as Loader/UnsafeLoader but it does it avoids all known code execution paths. It is the preferred YAML loader, and the current default for `yaml.load(input)` when you get the warning. Here are some of the exploits that can be triggered with UnsafeLoader but not with FullLoader: ``` python -c 'import os, yaml; yaml.full_load("!!python/object/new:os.system [echo EXPLOIT!]")'` python -c 'import yaml; print yaml.full_load("!!python/object/new:abs [-5]")' python -c 'import yaml; yaml.full_load("!!python/object/new:eval [exit(5)]")' ; echo $? python -c 'import yaml; yaml.full_load("!!python/object/new:exit [5]")' ; echo $?
2018-06-30Reverting https://github.com/yaml/pyyaml/pull/74Ingy döt Net
Revert "Make pyyaml safe by default." This reverts commit bbcf95fa051fdba9bbf879332e2f7999b195cf95. This reverts commit 7b68405c81db889f83c32846462b238ccae5be80. This reverts commit 517e83e8058e9d6850ab432ef22d84c2ac2bba5a.
2017-08-26Now, for py3k!Alex Gaynor
2017-08-26Make pyyaml safe by default.Alex Gaynor
Change yaml.load/yaml.dump to be yaml.safe_load/yaml.safe_dump, introduced yaml.danger_dump/yaml.danger_load, and the same for various other classes. (python2 only at this moment) Refs #5
2017-05-10Suspicious 'expected an exception' messages trimmedPeter Murphy
2017-05-09Added emoticon test data files (which will probably break testing)Peter Murphy
2017-02-08Allow colon in a plain scalar in a flow context (#45)Daniel Beer
* Allow colon in a plain scalar in a flow context * Restore behavior of flow mapping with empty value
2016-08-25Fixed handling --verbose flag in the test appliance.Kirill Simonov
2016-06-16removed a test which fails when wheel is imported.Kirill Simonov
2016-06-15Raise an error when test suite failed.Kirill Simonov
2011-05-30Clear cyclic references in the parser and the emitter to avoid extra GC calls.Kirill Simonov
2009-08-31Fixed tests on the Windows platform.Kirill Simonov
2009-08-31Fixed another encoding issue.Kirill Simonov
2009-08-29Fixed a problem with a scanner error not detected when no line break at the ↵Kirill Simonov
end of the stream.
2009-08-29Fixed emitting of invalid BOM for UTF-16.Kirill Simonov
2009-08-29Fixed a problem when CDumper incorrectly serializes a node anchor.Kirill Simonov
2008-12-30Final touches before the release.Kirill Simonov
2008-12-30Minor compatibility fixes.Kirill Simonov
2008-12-30Fixed str/bytes issues with Python 3 in _yaml.pyx.Kirill Simonov
2008-12-30Handle the encoding of input and output streams in a uniform way.Kirill Simonov
2008-12-29Use Cython if available; added Python 3 support to _yaml.pyx.Kirill Simonov
2008-12-29Share data files between Py2 and Py3 test suites.Kirill Simonov
2008-12-28Minor 2.3 and win32 compatibility fixes; clarify the 'feature not found' ↵Kirill Simonov
message in setup.py.
2008-12-28Fixed an issue with ReaderError generated by the LibYAML wrapper.Kirill Simonov
2008-12-28Refactored the test suite; updated include and library paths in setup.cfg.Kirill Simonov
2008-12-27Fixed test errors for LibYAML bindings; added a test on emitting nodes in ↵Kirill Simonov
all possible styles.
2008-12-27Minor fixes in the test subsystem to prevent failures in LibYAML bindings tests.Kirill Simonov
2008-10-01Added the script tests/test_all.py.Kirill Simonov