Skip to content

Commit 289f5b9

Browse files
authored
Don't reflect user input in raw response (#11887)
**THIS VULNERABILITY CAN'T BE EXPLOITED** - We only allow values that are a from an existing username (usernames are alphanumeric) - The user needs to have been added to the project - The action is from a post request, the button that triggers that action is marked as disabled when the user is the last owner.
1 parent da5fc65 commit 289f5b9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

readthedocs/projects/views/private.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,8 @@ def post(self, request, *args, **kwargs):
622622
username=username,
623623
)
624624
if self._is_last_user():
625-
return HttpResponseBadRequest(
626-
_(f"{username} is the last owner, can't be removed")
627-
)
625+
# NOTE: don't include user input in the message, since it's a security risk.
626+
return HttpResponseBadRequest(_("User is the last owner, can't be removed"))
628627

629628
project = self.get_project()
630629
project.users.remove(user)

0 commit comments

Comments
 (0)