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

fix: prevent setting user attributes from JWT in Studio #660

Conversation

Agrendalath
Copy link
Member

This backports the security fix from Quince to Palm.

Refs:

Private-ref: SE-6196

@Agrendalath Agrendalath requested a review from 0x29a May 20, 2024 14:35
@Agrendalath Agrendalath self-assigned this May 20, 2024
Open edX implements its a JwtAuthentication class in edx-drf-extensions
(in edx_rest_framework_extensions.auth.jwt.authentication). This class
updates the local User database entry to match certain values in the
token. It's used as a way to automatically provision and update users
with their LMS user information on other Open edX services like
ecommerce.

Since LMS and Studio keep the record of truth in its database tables,
they should *not* update their database user information based on the
JWT. Doing so would allow stale JWTs to incorrectly reset user values
after they had been changed in the LMS. This is done by having the
EDX_DRF_EXTENSIONS['JWT_PAYLOAD_USER_ATTRIBUTE_MAPPING'] setting be an
empty dictionary, and was set correctly for the LMS in its common.py env
settings module. Unfortunately, this was *not* being set for Studio.

This commit adds the same setting to Studio's common settings module.
Prior to this commit, it was possible for a stale JWT to reset user
attributes if the user hit a Studio API endpoint that used JWT for  auth
(e.g. endpoints used by the Course Authoring MFE). This opened up a
potential security issue where a global staff user (is_staff=True) that
had their global staff status removed (is_staff=False) could have up to
a one hour window in which they could use their stale-but-still-valid
global-staff JWT token to regain global staff status by calling a Studio
endpoint with their browser.
@Agrendalath Agrendalath force-pushed the agrendalath/se-6196-privilege-escalation-backport branch from 81d806a to 47e4bb8 Compare May 20, 2024 15:47
Copy link
Member

@0x29a 0x29a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

  • The change seems to be trivial, also cherry-pick seems to be clean.

@0x29a 0x29a merged commit cc6e48d into opencraft-release/palm.1 May 20, 2024
41 checks passed
@0x29a 0x29a deleted the agrendalath/se-6196-privilege-escalation-backport branch May 20, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants