RealDevSquad / RealDevSquad/website-backend
[RFC] Restrict modification of sensitive data in user model.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 74
- Forks
- 276
- Avg merge
- 1d 26m
- Merged PRs (30d)
- 14
Description
Problem statement
Currently any user registered with RDS can modify their own roles/sensitive data using an API and this updates the user model in our DB. This is a security risk as most of our websites filter content based on the roles received from the same user model. Also user can update their own discord ID after being verified.
Impact:
Known places where the endpoint is currently being used:
- User Profile page - my-site.
- signup page - my-site.
- Authorise discord page - my-site.
Proposed work
Implement a new user update flow where user is not allowed to update their roles and other sensitive information.
Success criteria
- All our existing user flow should remain same.
- Users should not be allowed to update their sensitive data
Solutions
Solution 1:
Update the validator for this particular route so that it doesn't allow users to update their own restricted data.
Solution 2:
As a stopgap solution, whenever this endpoint updates any sensitive user data and if it's used by someone other than super user then we will archive the user.
Solution 3:
Create a Data-Access module to restrict access to read and write to user model. This module should intercept both request and response of a route and filter it based on the userid received from the authentication token.
Solution 4:
Develop a Role Bases Access control (RBAC). Where we store sensitive information in a different table/document.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the user-update endpoint from the User Profile, signup, and Authorise Discord flows listed in the issue. Review how the validator handles roles and other sensitive user data, then compare the proposed approaches with the existing user model and authentication token flow. Done means existing flows still work while users cannot update restricted data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, authorization, backend, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100