Skip to content

Commit

Permalink
Merge pull request #301 from matrix-org/babolivier/dinsic-py3
Browse files Browse the repository at this point in the history
Add Python 3 compatibility to the DINUM-specific code
  • Loading branch information
babolivier authored Aug 18, 2020
2 parents a5c8802 + 3f0eb2f commit 00402a9
Show file tree
Hide file tree
Showing 108 changed files with 6,373 additions and 1,225 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
.idea/
.vscode/

sydent.conf
sydent.db
.git
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Pull Request Checklist

* [ ] Pull request includes a [changelog file](https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.md#changelog). The entry should:
- Be a short description of your change which makes sense to users. "Fix a bug that prevented receiving messages from other servers." instead of "Move X method from `EventStore` to `EventWorkerStore`.".
- Use markdown where necessary, mostly for `code blocks`.
- End with either a period (.) or an exclamation mark (!).
- Start with a capital letter.
* [ ] Pull request includes a [sign off](https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.md#sign-off)
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Development files
*.pyc
.idea/
.vscode/
*.iml
_trial_temp

# Runtime files
sydent.conf
sydent.db
/matrix_is_test/sydent.stderr
112 changes: 112 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
Sydent 2.0.1 (2020-05-20)
=========================

Features
--------

- Add a config option to disable deleting invite tokens on bind. ([\#293](https://github.com/matrix-org/sydent/issues/293))


Bugfixes
--------

- Fix a bug that prevented Sydent from checking for access tokens in request parameters when running on Python3. ([\#294](https://github.com/matrix-org/sydent/issues/294))


Internal Changes
----------------

- Make replication tests more reliable. ([\#278](https://github.com/matrix-org/sydent/issues/278))
- Add a configuration for towncrier. ([\#295](https://github.com/matrix-org/sydent/issues/295))


Changes in [2.0.0](https://github.com/matrix-org/sydent/releases/tag/v2.0.0) (2020-02-25)
=========================================================================================

**Note:** Starting with this release, Sydent releases are available on
[PyPI](https://pypi.org/project/matrix-sydent). This means that the
recommended method for stable installations is now by using the PyPI
project rather than a tarball of the `master` branch of this repository.
See [the README](https://github.com/matrix-org/sydent/blob/v2.0.0/README.rst)
for more details.

**Warning:** This release deprecates v1 APIs for existing endpoints in favour
of v2 APIs. Homeserver and client developers are encouraged to migrate their
applications to the v2 APIs. See below for more information.

Features
--------
* Implement the items and MSCs from the [privacy project](https://matrix.org/blog/2019/09/27/privacy-improvements-in-synapse-1-4-and-riot-1-4)
targeting identity servers. This introduces v2 APIs for every existing endpoint. v1 APIs are now deprecated and
homeserver and client developers are encouraged to migrate their applications to the v2 APIs.
* Add Python 3 compatibility to all of the codebase. Python 2 is still supported for now.
* Delete stored invites upon successful delivery to a homeserver
* Filter out delivered invites when delivering invites to a homeserver upon
successful binding
* Implement support for authenticating unbind queries by providing a `sid` and a
`client_secret`, as per [MSC1915](https://github.com/matrix-org/matrix-doc/blob/master/proposals/1915-unbind-identity-server-param.md)
* Add support for Prometheus and Sentry
* Handle `.well-known` files when talking to homeservers
* Validate `client_secret` parameters according to the Matrix specification
* Return 400/404 on incorrect session validation
* Add a default 10,000 address limit on v2 `/lookup` (which supports multiple lookups at once)

Documentation
-------------

* Rewrite part of the README to make it more user-friendly

Bugfixes
--------

* Fix a bug that would prevent requests to the `/store-invite` endpoint with
JSON payloads from being correctly processed
* Fix a bug where multiple cleanup tasks would be unnecessary spawned
* Fix logging so Sydent doesn't log 3PIDs when processing lookup requests
* Fix incorrect HTTP response from `/3pid/getValidated3pid` endpoint on
failure.
* Prevent a single failure from aborting the federation loop
* Fix federation lookups in `/onBind` callbacks
* Don't fail the unbind request if the binding doesn't exist
* Fix the signing servlet missing a reference to the Sydent object
* Fix content types & OPTIONS requests

Internal changes
----------------

* Add unit tests to test startup and replication
* Add support for testing with `matrix-is-tester`
* Remove instances of `setResponseCode(200)`


Changes in [1.0.3](https://github.com/matrix-org/sydent/releases/tag/v1.0.3) (2019-05-03)
=========================================================================================

* Use trustRoot instead of verify for request verification

Security Fixes
--------------
* Ensures that authentication tokens are generated using a secure random number
generator, ensuring they cannot be predicted by an attacker. Thanks to @opnsec
for identifying and responsibly disclosing the issue!
* Mitigate an HTML injection bug where an invalid room_id could result in
malicious HTML being injected into validation emails. Thanks to @opnsec
for identifying and responsibly disclosing this issue too!
* Randomise session_ids to avoid leaking info about the total number of
identity validations, and whether a given ID has been validated.
Thanks to @fs0c131y for this one.
* Don't send tracebacks to the browser when errors occur.


Changes in [1.0.2](https://github.com/matrix-org/sydent/releases/tag/v1.0.2) (2019-04-18)
=========================================================================================

Security Fixes
--------------
* Fix for validating malformed email addresses: https://github.com/matrix-org/sydent/commit/3103b65dcfa37a9241dabedba560c4ded6c05ff6


Changes in [1.0.1](https://github.com/matrix-org/sydent/releases/tag/v1.0.1) (2019-04-18)
=========================================================================================

Release pointed to wrong commit, fixed by 1.0.2
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# Step 1: Build sydent and install dependencies
#
FROM docker.io/python:3.8-alpine as builder

# Install dev packages
RUN apk add --no-cache \
build-base \
libressl-dev \
libffi-dev

# Add user sydent
RUN addgroup -S -g 993 sydent \
&& adduser -D --home /sydent -S -u 993 -G sydent -s /bin/ash sydent \
&& echo "sydent:$(dd if=/dev/random bs=32 count=1 | base64)" | chpasswd

# Copy resources
COPY --chown=sydent:sydent ["res", "/sydent/res"]
COPY --chown=sydent:sydent ["scripts", "/sydent/scripts"]
COPY --chown=sydent:sydent ["sydent", "/sydent/sydent"]
COPY --chown=sydent:sydent ["README.rst", "setup.cfg", "setup.py", "/sydent/"]

# Install dependencies
RUN cd /sydent \
&& su sydent -c 'pip install --user --upgrade pip setuptools sentry-sdk' \
&& su sydent -c 'pip install --user -e .' \
&& rm -rf /sydent/.cache \
&& find /sydent -name '*.pyc' -delete

#
# Step 2: Reduce image size and layers
#

FROM docker.io/python:3.8-alpine

# Install packages
RUN apk add --no-cache \
libressl \
libffi

# Add user sydent and create /data directory
RUN addgroup -S -g 993 sydent \
&& adduser -D --home /sydent -S -u 993 -G sydent -s /bin/ash sydent \
&& echo "sydent:$(dd if=/dev/random bs=32 count=1 | base64)" | chpasswd \
&& mkdir /data \
&& chown sydent:sydent /data

# Copy sydent
COPY --from=builder ["/sydent", "/sydent"]

ENV SYDENT_CONF=/data/sydent.conf
ENV SYDENT_PID_FILE=/data/sydent.pid
ENV SYDENT_DB_PATH=/data/sydent.db

WORKDIR /sydent
USER sydent:sydent
VOLUME ["/data"]
EXPOSE 8090/tcp
CMD [ "python", "-m", "sydent.sydent" ]
Loading

0 comments on commit 00402a9

Please sign in to comment.