summary refs log tree commit diff
path: root/synapse/util/stringutils.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Prevent the media store from writing outside of the configured directorySean Quah2021-11-191-7/+14
| | | | | Also tighten validation of server names by forbidding invalid characters in IPv6 addresses and empty domain labels.
* Simplify exception handling in is_ascii. (#9985)Dan Callahan2021-05-141-3/+1
| | | | | | | | | | | | | | | We can get away with just catching UnicodeError here. ⋮ +-- ValueError | +-- UnicodeError | +-- UnicodeDecodeError | +-- UnicodeEncodeError | +-- UnicodeTranslateError ⋮ https://docs.python.org/3/library/exceptions.html#exception-hierarchy Signed-off-by: Dan Callahan <danc@element.io>
* Use Python's secrets module instead of random (#9984)Dan Callahan2021-05-141-8/+11
| | | | | | | | | | | | | | | | Functionally identical, but more obviously cryptographically secure. ...Explicit is better than implicit? Avoids needing to know that SystemRandom() implies a CSPRNG, and complies with the big scary red box on the documentation for random: > Warning: > The pseudo-random generators of this module should not be used for > security purposes. For security or cryptographic uses, see the > secrets module. https://docs.python.org/3/library/random.html Signed-off-by: Dan Callahan <danc@element.io>
* Change the format of access tokens away from macaroons (#5588)Richard van der Hoff2021-05-121-0/+20
|
* Sanity check identity server passed to bind/unbind. (#9802)Denis Kasak2021-04-191-0/+32
| | | | Signed-off-by: Denis Kasak <dkasak@termina.org.uk>
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Type hints and validation improvements. (#9321)Patrick Cloke2021-02-081-15/+18
| | | | | * Adds type hints to the groups servlet and stringutils code. * Assert the maximum length of some input values for spec compliance.
* Support icons for Identity Providers (#9154)Richard van der Hoff2021-01-201-0/+92
|
* Remote dependency on distutils (#9125)Richard van der Hoff2021-01-151-0/+19
| | | | | | | | | `distutils` is pretty much deprecated these days, and replaced with `setuptools`. It's also annoying because it's you can't `pip install` it, and it's hard to figure out which debian package we should depend on to make sure it's there. Since we only use it for a tiny function anyway, let's just vendor said function into our codebase.
* Remove : from allowed client_secret chars (#8101)Andrew Morgan2020-08-181-3/+1
| | | | | | | Closes: https://github.com/matrix-org/synapse/issues/6766 Equivalent Sydent PR: https://github.com/matrix-org/sydent/pull/309 I believe it's now time to remove the extra allowed `:` from `client_secret` parameters.
* Fix deprecation warning: import ABC from collections.abc (#7892)Karthikeyan Singaravelan2020-07-201-1/+1
|
* remove miscellaneous PY2 codeRichard van der Hoff2020-05-151-21/+7
|
* remove to_asciiRichard van der Hoff2020-05-151-19/+1
| | | | this is a no-op on python 3.
* Remove `exception_to_unicode`Richard van der Hoff2020-05-151-36/+0
| | | | this is a no-op on python 3.
* Rewrite prune_old_outbound_device_pokes for efficiency (#7159)Richard van der Hoff2020-03-301-1/+20
| | | | make sure we clear out all but one update for the user
* Validate client_secret parameter (#6767)Andrew Morgan2020-01-241-0/+17
|
* Run Black. (#5482)Amber Brown2019-06-201-10/+6
|
* Use SystemRandom for token generationRichard van der Hoff2019-05-031-2/+7
|
* Fix UnicodeDecodeError when postgres is not configured in english (#4253)Richard van der Hoff2018-12-041-1/+38
| | | | This is a bit of a half-assed effort at fixing https://github.com/matrix-org/synapse/issues/4252. Fundamentally the right answer is to drop support for Python 2.
* Port over enough to get some sytests running on Python 3 (#3668)Amber Brown2018-08-201-0/+15
|
* run isortAmber Brown2018-07-091-0/+1
|
* Move more xrange to sixAdrian Tschira2018-04-281-2/+3
| | | | | | plus a bonus next() Signed-off-by: Adrian Tschira <nota@notafile.com>
* Reduce size of joined_user cacheErik Johnston2017-04-251-0/+14
| | | | | | | | The _get_joined_users_from_context cache stores a mapping from user_id to avatar_url and display_name. Instead of storing those in a dict, store them in a namedtuple as that uses much less memory. We also try converting the string to ascii to further reduce the size.
* Remove some unused functions (#711)Mark Haines2016-04-081-4/+0
| | | | | | | | * Remove some unused functions * get_room_events_stream is only used in tests * is_exclusive_room might actually be something we want
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Allow non-ascii filenames for attachmentsMark Haines2015-08-261-0/+2
|
* Enforce ascii filenames for uploadsErik Johnston2015-06-301-0/+9
|
* Implement registering with shared secret.Erik Johnston2015-03-131-0/+10
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* add in whitespace after copyright statements to improve legibilityMatthew Hodgson2014-08-131-0/+1
|
* Reference Matrix Home Servermatrix.org2014-08-121-0/+24