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

Firebase auth branch #11

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Firebase auth branch #11

wants to merge 22 commits into from

Conversation

emma-x1
Copy link
Collaborator

@emma-x1 emma-x1 commented Nov 22, 2024

Notion ticket link

Ticket Name

Implementation description

Steps to test

What should reviewers focus on?

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Sorry, something went wrong.

@mslwang mslwang requested a review from mmiqball November 30, 2024 23:50
def role_based_access_control(allowed_roles: List[str]):
def middleware_decorator(endpoint: Callable):
async def wrapper(request: Request, *args, **kwargs):
roles = getattr(request.state, "user_roles", [])
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's much much safer to get a user's roles from firebase or the db ourselves using the methods in the auth service, instead of sending it in the request

imagine someone malicious adding in roles to their requests that they don't have access to, which would let them access other roles that they haven't been assigned to in the db

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.

None yet

2 participants