Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Validate data passed to REST api endpoints #13147

Open
14 of 75 tasks
DMRobertson opened this issue Jun 30, 2022 · 0 comments
Open
14 of 75 tasks

Validate data passed to REST api endpoints #13147

DMRobertson opened this issue Jun 30, 2022 · 0 comments
Labels
A-Validation 500 (mostly) errors due to lack of event/parameter validation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented Jun 30, 2022

Tracking issue for https://github.com/matrix-org/synapse/milestone/9

List files which contain rest endpoints as follows:

As with #12651 (comment), we should concentrate on finding something which provides good error messages first, and good type information second. I think Pydantic is the best choice; I've had a go with it in https://github.com/matrix-org/synapse/commits/dmr/oidc-config-pydantic for validating some of our config. The rest endpoint payloads should be considerably simpler to validate.

$ rg -l --case-sensitive "def .*(POST|PUT|DELETE|GET).*\(" synapse | sort | sed -e 's/^/- [ ] /'

To generate todo lists for each individual file, use the following write-only program:

sed -n -e 's/.*class \(.*\)(.*Servlet):.*/- [ ] \1/p' -e 's/.*def on_\(.*\)(.*/  - \1/p' synapse/rest/client/devices.py

app

  • synapse/app/generic_worker.py

federation

  • synapse/federation/transport/server/federation.py
  • synapse/federation/transport/server/init.py

http

  • synapse/http/server.py

metrics

  • synapse/metrics/_exposition.py

rest/admin

  • synapse/rest/admin/background_updates.py
  • synapse/rest/admin/devices.py
  • synapse/rest/admin/event_reports.py
  • synapse/rest/admin/federation.py
  • synapse/rest/admin/init.py
  • synapse/rest/admin/media.py
  • synapse/rest/admin/registration_tokens.py
  • synapse/rest/admin/rooms.py
  • synapse/rest/admin/server_notice_servlet.py
  • synapse/rest/admin/statistics.py
  • synapse/rest/admin/username_available.py
  • synapse/rest/admin/users.py

rest/client

rest/key

rest/media

  • synapse/rest/media/v1/config_resource.py (nothing to validate)
  • synapse/rest/media/v1/download_resource.py
  • synapse/rest/media/v1/preview_url_resource.py
  • synapse/rest/media/v1/thumbnail_resource.py
  • synapse/rest/media/v1/upload_resource.py

rest/synapse/client

  • synapse/rest/synapse/client/new_user_consent.py
  • synapse/rest/synapse/client/oidc/callback_resource.py
  • synapse/rest/synapse/client/password_reset.py
  • synapse/rest/synapse/client/pick_idp.py
  • synapse/rest/synapse/client/pick_username.py
  • synapse/rest/synapse/client/saml2/metadata_resource.py
  • synapse/rest/synapse/client/saml2/response_resource.py
  • synapse/rest/synapse/client/sso_register.py
  • synapse/rest/synapse/client/unsubscribe.py

rest miscellaneous

  • synapse/rest/consent/consent_resource.py
  • synapse/rest/well_known.py (nothing to validate)
  • synapse/rest/health.py (nothing to validate)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Validation 500 (mostly) errors due to lack of event/parameter validation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

1 participant