-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Username is not sanitized on registration #955
Comments
The SanitationMiddleware uses the types it reflects from the tables to sanitize. These types are not available for the dbAuth calls. Maybe the dbAuth middleware should do it's own sanitizing? What do you think? |
I see. I thought the SanitationMiddleware handles all tables. Anyway, for username, it is usually a string so maybe we don't need to reflect or check the column type from the database table. Perhaps it would be enough to check if the nominated username is a correctly formatted email address (thru If it's not an email address, check if it contains only the characters |
Hi @mevdschee , I checked my PR#911 and I think some commits on that can be applied here. I just don't know how to unbundle the multiple commits on that PR if it can be done. Still learning my way around github. 😢 Particularly, these changes. It sets new properties, |
First of all, I agree and this is something that dbAuth should somehow support.
Whether that is a desirable or not depends on your application.
For some applications that is true.
For some applications that is desirable.. I think we need some clever applying of SanitationMiddleware to the dbAuth calls.. I just don't know how yet. |
On html tags in username,
I think it would be good to have a sane default, for example by excluding html tags in usernames. If for some reason html tags in username is desirable in the application, the application should purposely override the default.
I agree and I also can't figure it out yet. 😁 |
Just a quick note, in case anyone else is having same problem:
|
I'm using dbAuth for a project and one issue I encounter is that the username is not sanitized even if the sanitation middleware is active. For example, a user can input usernames with html tags such as
<h1>bigname
or<marquee>runningname</marquee>
and this gets inserted to the database as-is. I'm using the sanitation middleware per basic example. Any idea how to sanitize username on registration?SanitationMiddleware config
The middleware sanitizes/strips html tags from other inputs during updating but not on user creation.
The text was updated successfully, but these errors were encountered: