Repository navigation
Conversation
mitchelljkotler
left a comment
There was a problem hiding this comment.
Claude pointed out one security issue:
documentcloud/projects/serializers.py:194: The new writable user field uses queryset=User.objects.all(), so anyone who can manage a project can add any user ID on the platform. This bypasses User.objects.get_viewable. Before this change you had to know the user's email.
Failure scenario: An attacker creates a project and POSTs {"user": N} for N=1,2,3,… A 201 shows the user exists. Each added user then shares a project with the attacker, so get_viewable and GET /api/projects//users/?expand=user reveal their name, username, uuid, avatar and organizations. The attacker can list the whole user base and push unwanted project memberships onto arbitrary users.
Should we require the user already be visible to the project owner before they can add someone?
That makes sense and I just pushed the change. There may also be a need to align user visibility conditions across Squarelet and DocumentCloud. The Squarelet user search API returns all non-private users, so this restriction introduces some new cases where you can see a user in search but not add them to your project. The reverse is also true — DocumentCloud doesn't seem to respect (or even store) users' private status from Squarelet, so there will also be cases where a user is eligible to be added to a project but doesn't appear in the collaborator search results. Should Squarelet's visibility rules eventually become the source of truth for other products too? |
More preparation for MuckRock/documentcloud-frontend#1219. When inviting a project collaborator, the
/projects/<id>/users/endpoint now accepts a DocumentCloud user ID (or an email address as before).