summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* The yaml.load{,_all} functions require Loader= nowIngy döt Net2021-09-231-1/+0
|
* Add a basic test file for yaml.load and yaml.dumpIngy döt Net2021-09-233-1/+26
|
* Fix float resolver for '.' and '._'Tina Müller2021-09-231-2/+0
| | | | | | 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.
* Use with statements to eliminate ResourceWarningsThom Smith2021-09-2316-91/+145
|
* Add a test for the YAML 1.1 typesTina Müller2021-09-234-0/+427
|
* Fix issue with representing Enum typesThom Smith2021-09-233-1/+5
|
* Move code from lib3 to libThom Smith2021-09-2221-0/+0
|
* Remove 2.7 supportThom Smith2021-09-2221-2150/+0
|
* constructor.timezone: __copy_ & __deepcopy__Ovv2021-01-131-0/+12
| | | | close #387
* Fix for CVE-2020-14343Ingy döt Net2021-01-132-2/+2
| | | | | Per suggestion https://github.com/yaml/pyyaml/issues/420#issuecomment-663888344 move a few constructors from full_load to unsafe_load.
* Build modernization (GHA, wheels, setuptools) (#407)Brad Solomon2021-01-132-8/+18
| | | | | | | | | | | | | | | * 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>
* Move test files back into tests/data/Ingy döt Net2020-03-183-0/+2
|
* Prevents arbitrary code execution during python/object/new constructor (#386)Riccardo Schirone2020-03-174-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add tests for timezone (#363)Tina Müller (tinita)2019-12-204-12/+40
| | | | After #163, this adds some test data to check if the datetime objects return the correct timezone
* increase size of index, line, and column fields (#310)Dwight Guth2019-12-202-2/+34
| | | | | | | | | | | | | | | | * 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
* Fix for Python 3.10 (#329)Hugo van Kemenade2019-12-204-4/+4
|
* Enable certain unicode tests when maxunicode not > 0xffffTina Müller2019-12-205-2/+0
| | | | | | They were disabled in d6cbff662084dd94bde5421ece495482d1b14454 After #351 the tests are working again
* Allow add_multi_constructor with None (#358)Tina Müller (tinita)2019-12-076-0/+135
| | | | | | | Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
* Fix handling of __slots__ (#161)Filip Salomonsson2019-12-074-2/+28
|
* Skip certain unicode tests when maxunicode not > 0xffffTina Müller2019-03-126-0/+4
|
* Allow to turn off sorting keys in DumperTina Müller2019-03-086-0/+71
|
* Apply FullLoader/UnsafeLoader changes to lib3Tina Müller2019-03-083-10/+10
|
* Deprecate/warn usage of yaml.load(input)Ingy döt Net2019-03-083-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 $?
* Reverting https://github.com/yaml/pyyaml/pull/74Ingy döt Net2018-06-304-10/+14
| | | | | | | | Revert "Make pyyaml safe by default." This reverts commit bbcf95fa051fdba9bbf879332e2f7999b195cf95. This reverts commit 7b68405c81db889f83c32846462b238ccae5be80. This reverts commit 517e83e8058e9d6850ab432ef22d84c2ac2bba5a.
* Now, for py3k!Alex Gaynor2017-08-262-7/+5
|
* Make pyyaml safe by default.Alex Gaynor2017-08-262-7/+5
| | | | | | | | 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
* Suspicious 'expected an exception' messages trimmedPeter Murphy2017-05-102-37/+12
|
* Added emoticon test data files (which will probably break testing)Peter Murphy2017-05-092-0/+11
|
* Allow colon in a plain scalar in a flow context (#45)Daniel Beer2017-02-081-1/+0
| | | | | | * Allow colon in a plain scalar in a flow context * Restore behavior of flow mapping with empty value
* Fixed handling --verbose flag in the test appliance.Kirill Simonov2016-08-252-0/+2
|
* removed a test which fails when wheel is imported.Kirill Simonov2016-06-161-1/+0
|
* Raise an error when test suite failed.Kirill Simonov2016-06-154-4/+6
|
* Clear cyclic references in the parser and the emitter to avoid extra GC calls.Kirill Simonov2011-05-302-0/+6
|
* Fixed tests on the Windows platform.Kirill Simonov2009-08-312-0/+2
|
* Fixed another encoding issue.Kirill Simonov2009-08-312-2/+57
|
* Fixed a problem with a scanner error not detected when no line break at the ↵Kirill Simonov2009-08-291-0/+2
| | | | end of the stream.
* Fixed emitting of invalid BOM for UTF-16.Kirill Simonov2009-08-2910-52/+60
|
* Fixed a problem when CDumper incorrectly serializes a node anchor.Kirill Simonov2009-08-293-2/+7
|
* Final touches before the release.Kirill Simonov2008-12-301-0/+3
|
* Minor compatibility fixes.Kirill Simonov2008-12-301-1/+7
|
* Fixed str/bytes issues with Python 3 in _yaml.pyx.Kirill Simonov2008-12-307-5/+131
|
* Handle the encoding of input and output streams in a uniform way.Kirill Simonov2008-12-308-36/+633
|
* Use Cython if available; added Python 3 support to _yaml.pyx.Kirill Simonov2008-12-292-7/+5
|
* Share data files between Py2 and Py3 test suites.Kirill Simonov2008-12-2975-8/+1853
|
* Minor 2.3 and win32 compatibility fixes; clarify the 'feature not found' ↵3.07Kirill Simonov2008-12-284-10/+20
| | | | message in setup.py.
* Fixed an issue with ReaderError generated by the LibYAML wrapper.Kirill Simonov2008-12-281-17/+17
|
* Refactored the test suite; updated include and library paths in setup.cfg.Kirill Simonov2008-12-2830-1641/+1666
|
* Fixed test errors for LibYAML bindings; added a test on emitting nodes in ↵Kirill Simonov2008-12-279-1/+42
| | | | all possible styles.
* Minor fixes in the test subsystem to prevent failures in LibYAML bindings tests.Kirill Simonov2008-12-272-5/+7
|
* Added the script tests/test_all.py.Kirill Simonov2008-10-011-0/+15
|