Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEPR]: cors_csrf middleware and utilities #33627

Open
timmc-edx opened this issue Oct 31, 2023 · 2 comments
Open

[DEPR]: cors_csrf middleware and utilities #33627

timmc-edx opened this issue Oct 31, 2023 · 2 comments
Labels
depr Proposal for deprecation & removal per OEP-21

Comments

@timmc-edx
Copy link
Contributor

timmc-edx commented Oct 31, 2023

Proposal Date

2023-10-31

Target Ticket Acceptance Date

2023-11-15

Earliest Open edX Named Release Without This Functionality

Redwood - 2024-04

Rationale

cors_csrf (the code under openedx/core/djangoapps/cors_csrf/ in edx-platform) is intended as an extension of the Django CSRF mechanism that distributes the CSRF cookie to all subdomains rather than just the site's exact domain, allowing for trusted cross-origin calls.

Problems:

  • CSRF was always intended as a same-site protection mechanism, and the standard way to permit trusted cross-site requests is CORS, which we use elsewhere in edxapp. Using this custom extension of the CSRF middleware makes it harder to perform security analysis on edxapp and the related IDAs.
  • This mechanism of distributing the CSRF cookie to all subdomains (e.g. .edx.org) is overly broad, and would allow unintended subdomains to make authorized calls to edxapp.
  • The middleware and other code in the cors_csrf Django app relies on undocumented internals of Django's csrf middleware, which recently lead to difficulties in upgrading to Django 4.x.

Removal

Everything under openedx/core/djangoapps/cors_csrf/ would be removed, as well as any calls to those utilities.

Replacement

Calls to cors_csrf, including decorators, should be replaced with code that uses existing CORS utilities.

Deprecation

The cors_csrf utilities could emit DeprecationWarnings pending full removal. If needed, it could be left in this state for one full release (Redwood), with removal occurring in the next release after that.

Migration

No response

Additional Info

No response


Discourse post: https://discuss.openedx.org/t/deprecation-removal-cors-csrf-middleware-and-utilities-edx-platform-33627/11577

@github-actions github-actions bot added the depr Proposal for deprecation & removal per OEP-21 label Oct 31, 2023
@dianakhuang
Copy link
Contributor

@timmc-edx Are you or someone else in the security working group planning on pushing this forward? We are trying to assign owners to active DEPR tickets.

@timmc-edx
Copy link
Contributor Author

No, unfortunately not at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depr Proposal for deprecation & removal per OEP-21
Projects
Status: Proposed
Development

No branches or pull requests

2 participants