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

Bug: Self hosted invite codes should only be generated by admins #1606

Open
hecht-a opened this issue Jan 8, 2025 · 1 comment · May be fixed by #1611
Open

Bug: Self hosted invite codes should only be generated by admins #1606

hecht-a opened this issue Jan 8, 2025 · 1 comment · May be fixed by #1611
Labels
🐛 Bug Something isn't working 💻 Self Hosting Issues pertaining to self-hosted versions of Maybe

Comments

@hecht-a
Copy link

hecht-a commented Jan 8, 2025

Hello 👋

Describe the bug
I found a security issue. All users can create invite codes.

To Reproduce
Steps to reproduce the behavior:

  1. Login or Signup
  2. Activate Require invite code for new sign ups
  3. Generate a code
  4. Create a new account with the code generated in the previous step
  5. With this new account got to Settings > Self Hosted

Expected behavior
I think only "admin" users could generate codes.

What version of Maybe are you using?
Self Hosted, v0.2.0

What operating system and browser are you using?
The problem is on all OS and browsers


An idea to fix this problem would be to set an "admin email" in env vars. Only the user logged in with this email could do some actions like generate invite code.
If this solution sounds good to you, I can implement it.

@hecht-a hecht-a added the 🐛 Bug Something isn't working label Jan 8, 2025
@zachgoll zachgoll added the 💻 Self Hosting Issues pertaining to self-hosted versions of Maybe label Jan 8, 2025
@zachgoll
Copy link
Collaborator

zachgoll commented Jan 8, 2025

@hecht-a yep, think that would be a good improvement. This should be relatively simple—we've already got a role field on the users table, so just a matter of checking Current.user.admin? prior to the code generation in InviteCodesController

@zachgoll zachgoll changed the title Bug: Security issue in invite code generation Bug: Self hosted invite codes should only be generated by admins Jan 8, 2025
@tonyvince tonyvince linked a pull request Jan 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working 💻 Self Hosting Issues pertaining to self-hosted versions of Maybe
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants