summaryrefslogtreecommitdiff
path: root/passlib/utils
Commit message (Collapse)AuthorAgeFilesLines
* python compat cleanup -- replace stray ".im_func" refsEli Collins2020-10-061-6/+4
|
* python compat cleanup -- use magic super() callsEli Collins2020-10-062-23/+23
|
* cleanup old python compat - assorted minor cleanups & fixes from conversionEli Collins2020-10-061-2/+1
|
* cleanup old python compat -- removed int_types aliasEli Collins2020-10-062-5/+3
|
* cleanup old python compat -- removed join_byte_elems() and ↵Eli Collins2020-10-064-26/+15
| | | | join_byte_values() wrappers
* cleanup old python compat -- removed iter_byte_values() wrapperEli Collins2020-10-061-6/+0
|
* cleanup old python compat -- removed byte_elem_value() wrapperEli Collins2020-10-062-7/+2
|
* cleanup old python compat -- removed str_to_usascii() wrapperEli Collins2020-10-062-7/+2
|
* cleanup old python compat -- removed uascii_to_str() wrapperEli Collins2020-10-062-10/+6
|
* cleanup old python compat -- removed u() wrapper from some regexesEli Collins2020-10-061-10/+0
|
* cleanup old python compat -- replaced "unicode" alias in favor of "str"Eli Collins2020-10-064-49/+45
|
* cleanup old python compat -- unified "unicode_or_bytes" aliasesEli Collins2020-10-064-17/+9
|
* cleanup old python compat -- removed "unicode_or_str" and ↵Eli Collins2020-10-064-24/+14
| | | | "native_string_types" aliases
* cleanup old python compat -- removed IO aliases (BytesIO etc)Eli Collins2020-10-061-14/+1
|
* cleanup old python compat -- removed suppress_cause() and error_from() wrappersEli Collins2020-10-063-19/+4
|
* cleanup old python compat -- removed get_unbound_method_function() wrapperEli Collins2020-10-061-6/+1
|
* cleanup old python compat -- removed OrderedDict backportEli Collins2020-10-062-252/+0
|
* cleanup old python compat -- removed izip() wrapperEli Collins2020-10-062-8/+0
|
* cleanup old python compat -- removed nextgetter() wrapperEli Collins2020-10-063-12/+4
|
* cleanup old python compat -- removed itervalues() wrapperEli Collins2020-10-061-4/+0
|
* cleanup old python compat -- removed iteritems() wrapperEli Collins2020-10-061-3/+1
|
* cleanup old python compat -- removed imap() / lmap() aliasesEli Collins2020-10-063-17/+7
|
* cleanup old python compat -- removed irange() aliasEli Collins2020-10-064-11/+6
|
* cleanup old python compat -- removed PY2 & PY3 conditionalsEli Collins2020-10-065-200/+63
|
* cleanup old python compat -- removed PY26 conditional, and unittest2 imports.Eli Collins2020-10-061-7/+4
| | | | removing unittest2 also allowed removing "passlib.tests.backports"
* cleanup old python compat -- removed all "from __future__" importsEli Collins2020-10-064-4/+0
|
* docs & setup: updates text & setup requirements to indicate we need minimumEli Collins2020-10-061-2/+2
| | | | of Python 3.5.
* Merge from stableEli Collins2020-10-063-31/+222
|\
| * bugfix: passlib.utils: add stub safe_crypt() control flags when crypt() ↵Eli Collins2020-10-061-0/+3
| | | | | | | | | | | | isn't available. (needed for windows)
| * passlib.utils: add thread lock to fix some UT failures.Eli Collins2020-10-052-3/+49
| |
| * passlib.handlers: cases where crypt() returns malformed hashEli Collins2020-10-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | now return a single unified InternalBackendError() class, instead of AssertionError. This change has a couple of parts: * assert statements replaced with permanent checks, since crypt() is unpredictable enough that we need to have this always on, even if production runs code in "-O2" mode. * added debug_only_repr() helper which allows including sensitive stuff like salts & hash digests within error tracebacks -- will only do so when global flag is enabled; and that's currently only set by unittest suite. * added new InternalBackendError() exception class (a RuntimeError subclass); which is raised instead of an AssertionError.
| * passlib.handlers.bcrypt: safe_verify() calls should test for NotImplementedEli Collins2020-10-051-1/+1
| | | | | | | | | | before boolean; bool(NotImplemented) is deprecated as of python 3.9 (fixes issue 125)
| * utils.safe_crypt(): turns out pypy3's crypt() *does* support raw bytes.Eli Collins2020-10-031-17/+48
| | | | | | | | | | | | | | | | so instead of assuming safe_crypt() can only take UTF8 under py3, and anything under py2; code is now tied to "crypt_accepts_bytes" flag which does quick capability-detection when module loads. this updates the changes from rev 67c619208229
| * py39 compat - fixed some uneeded escape sequencesEli Collins2020-10-031-1/+1
| |
| * bugfix: bcrypt os_crypt backend: fix some more crypt.crypt() utf8 encoding ↵Eli Collins2020-05-121-8/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues which were causing it to fail to generate a hash. bcrypt ------ * _norm_digest(): fixed some PasslibValueError()s being thrown by os_crypt backend during UT fuzz verifier. These were due to non-UTF8 input being provided to crypt.crypt()... even though secret itself was UTF8 safe! This was because secret was being truncated/repeated as part of various backend bug workarounds; and the truncate/repeat operations weren't being done in manner that respected UTF8 character boundaries. This has now been fixed via _require_valid_utf8_bytes flag (which has been set for os_crypt backend), that enables utf8-safe mode of operation. utils ----- * added utf8_truncate() and utf8_repeat_string() helpers, for bcrypt fixes above. * simplified repeat_string() internals
| * tests / bcrypt: bcrypt_os_crypt_test now strips out non-UTF8 test vectors ↵Eli Collins2020-05-121-0/+13
| | | | | | | | | | | | under py3, since these can't be passed through crypt.crypt()
| * bugfix: bcrypt os_crypt backend wasn't being detected properly under py3;Eli Collins2020-05-121-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | due to a few interlocking issues. passlib.utils: test_crypt() shouldn't accept hash=<bytes>, because equality comparison with str will always fail under py3. * test_crypt() now enforces hash=<unicode_or_str> as input. it previously allowed hash=bytes, but equality comparison with unicode (output by safe_crypt) would always return False under python 3. * bcrypt's TEST_HASH_2A constant was stored bytes, which was causing os_crypt detection to fail due to test_crypt() bug above. changed to use native str. sidewnote: this would have been caught by UTs, except for bug in test_82_crypt_support() that was fixed in rev 43bae3f786b7.
| * reworked lookup_hash() and create_hex_digest() internals to work betterEli Collins2020-05-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on FIPS systems (issue 116). * lookup_hash(): - moved all hash consturctor error checks / handling into HashInfo object, which simplifies lookup_hash() internals - [minor] added "required" kwd, inverse of the now-deprecated "return_unknown" kwd - [minor] now caches unknown/unsupported HashInfo records. * HashInfo: - now catches ValueErrors thrown by hash constructor, and special-cased detection of "disabled for fips" errors. - stub instances now have constructor that throws UnknownHashError, instead of being None. calling code should detect stub instances via the new "not info.supported" instead of testing for "info.const is None". * create_hex_digest() now defaults to creating handlers w/ mock hash func when it's not present (e.g. due to FIPS). this should let them be imported; and defer the errors until they're actually used. * added _set_mock_fips_mode() and some helps to make lookup_hash() fake a FIPS mode system (per traceback provided in issue comments). used this to make some preliminary UTs for the digest & hasher changes above.
| * passlib.utils: have safe_crypt() catch OSError thrown by crypt() -- py39 compatEli Collins2020-03-281-1/+9
| | | | | | | | (fixes issue 115)
| * passlib.utils: have safe_crypt() check if crypt() is returning bytesEli Collins2020-02-171-0/+5
| | | | | | | | (fixes issue 113)
* | Merge from stableEli Collins2019-11-223-16/+38
|\ \ | |/
| * general: Python 2.6 & 3.3 support deprecated -- added notes in docsEli Collins2019-11-221-0/+1
| |
| * bugfix: argon2: replace directive with equivalent that will work under ↵Eli Collins2019-11-191-0/+4
| | | | | | | | | | | | py26/33/34 (dict comprehensions and b"" % format directives both cause issues)
| * passlib.utils.handlers: split _sanitize() helper out as separate ↵Eli Collins2019-11-121-16/+33
| | | | | | | | | | | | mask_value() function; adjusted UTs
* | Merge from stableEli Collins2019-11-102-15/+32
|\ \ | |/
| * argon2 -- added support for type "ID" hashes & for generating type "D" hashes.Eli Collins2019-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | * updated requirements to latest version of argon2_cffi & argon2pure; though internal code should work with older versions. * reworked argon2 module internals to handle wider range of hash types; and make default customizable via "type" kwd. * added reference vectors for "D" and "ID" hashes
| * added tests for parsehash() method; fixed argon2 error (fixes issue 97)Eli Collins2019-11-101-3/+19
| | | | | | | | | | | | * UTs now has basic tests for parsehash() method * argon2: excluded some settings kwd aliases from parsehash() call
| * additional py38 compat fixesEli Collins2019-11-091-0/+1
| |
| * Fix for Python 3.8Alan Pevec2019-07-121-3/+8
| | | | | | | | | | | | | | This was a deprecation when running in Python 3.7: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working if isinstance(source, collections.Sequence):
| * Remove time.clock(), deprecated in 3.8Alan Pevec2019-07-111-9/+3
| | | | | | | | | | | | | | | | | | The function time.clock(), used in passlib/utils/__init__.py has been removed. It was deprecated since Python 3.3. More info: https://docs.python.org/3.8/whatsnew/3.8.html#api-and-feature-removals To make the code both Python 2 and 3 compatible, use timeit.default_timer