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

user_id can only be an Integer #47

Open
tordne opened this issue Dec 31, 2020 · 1 comment
Open

user_id can only be an Integer #47

tordne opened this issue Dec 31, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tordne
Copy link
Contributor

tordne commented Dec 31, 2020

Hi,

So my second issue I've come across with the user_id's is the fact that you expect us to use an Integer.

Initially I started off using normal Integers as Id's, but it creates a very obvious security risk, that in every project user_id 1 will probably be the admin/root user.

I've been reading through several projects, and the most secure ones use UUID as id's for their tables.
easily done by
from sqlalchemy.dialects.postgresql import UUID
import uuid

and in the users table
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)

I also have not really looked into the code of flask-authorize, but it would be a nice idea, to adopt a more secure approach and give a choice in between Integer or uuid4, which will solve a major security issue of easily guessing user ID's

@bprinty
Copy link
Owner

bprinty commented Jan 11, 2021

Thanks for the suggestion! You make a good point - I agree that the type of the User.id field should be flexible enough to accommodate UUIDs. It would make this package more useful in large applications that require split databases or multitenancy.

I'll add this to the feature roadmap for the project and comment back on this issue when it has been added to a production release of this package. Thanks!

@bprinty bprinty self-assigned this Jan 11, 2021
@bprinty bprinty added the enhancement New feature or request label Jan 11, 2021
@bprinty bprinty added this to the 0.3.0 milestone Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants