#23011: Getting user ID from a request shouldn't hit the database
---------------------------------+--------------------------------------
Reporter: BertrandBordage | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by timo):
* needs_better_patch: => 0
* needs_tests: => 0
* version: 1.6 => master
* easy: 1 => 0
* needs_docs: => 0
* type: Cleanup/optimization => New feature
Comment:
I haven't thought it through completely, but I'd want to be cautious about
this change for security reasons. For example, without checking if the
user exists in the database, I think we could end up with a situation
where `request.user_id` returns some integer value in a spoofed session,
but `request.user` is an `AnonymousUser`. This could encourage users to
write insecure or error prone code.
--
Ticket URL: <https://code.djangoproject.com/ticket/23011#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.207f9862c1e56b3f355eb82129645175%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.