[Django] #25847: is_authenticated is vulnerability-prone.

22 visualizações
Pular para a primeira mensagem não lida

Django

não lida,
2 de dez. de 2015, 06:26:2402/12/2015
para django-...@googlegroups.com
#25847: is_authenticated is vulnerability-prone.
-------------------------------+--------------------
Reporter: skorokithakis | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.auth | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
There's an inconsistency between `is_authenticated` and `is_superuser`.
The former is a method and the latter is a property, leading many people
to do:


{{{
if request.user.is_authenticated:
return sensitive_information
}}}

which is, of course, always executed.

I propose that is_authenticated be turned into a property, while it can
also be a callable, for backwards-compatibility.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

não lida,
2 de dez. de 2015, 09:21:3302/12/2015
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+--------------------------------------
Reporter: skorokithakis | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9
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 timgraham):

* needs_better_patch: => 0
* needs_docs: => 0
* type: Uncategorized => New feature
* needs_tests: => 0


Comment:

I bumped an old [https://groups.google.com/d/topic/django-
developers/7k6Z8JxKH5Q/discussion django-developers discussion] to get
opinions about this.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:1>

Django

não lida,
3 de dez. de 2015, 02:01:0503/12/2015
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+--------------------------------------
Reporter: skorokithakis | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9
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 zachborboa):

* cc: zachborboa@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:2>

Django

não lida,
3 de dez. de 2015, 03:59:2303/12/2015
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Accepted


Comment:

The discussion is leaning towards making this change.

A possible deprecation of the callable form wasn't discussed.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:3>

Django

não lida,
31 de jan. de 2016, 20:48:4431/01/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by DheerendraRathor):

* cc: dheeru.rathor14@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:4>

Django

não lida,
21 de mar. de 2016, 13:07:3221/03/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by timgraham):

#26388 suggested the same for `is_anonymous()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:5>

Django

não lida,
2 de abr. de 2016, 06:03:0002/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() a "callable property"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by jlaine):

* status: new => assigned
* owner: nobody => jlaine


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:6>

Django

não lida,
2 de abr. de 2016, 06:07:4702/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"

-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:7>

Django

não lida,
2 de abr. de 2016, 10:09:0002/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by jlaine):

I have put up a pull request here:

https://github.com/django/django/pull/6376

@apollo13 mentioned that we might want to support the case where a custom
user model defines is_anonymous / is_authenticated as methods instead of
properties. In this case we could do something like this to monkey-patch
that user model to the new style:

{{{
def __new__(cls):
if not isinstance(cls.is_anonymous, property):
real_is_anonymous = cls.is_anonymous
cls.is_anonymous = property(lambda x:
CallableBool(real_is_anonymous(x)))
return super(AbstractBaseUser, cls).__new__(cls)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:8>

Django

não lida,
2 de abr. de 2016, 10:32:3202/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by timgraham):

Alternatively, we could add a system check that raises a warning for an
incompatible implementation.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:9>

Django

não lida,
2 de abr. de 2016, 11:07:3502/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by jlaine):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:10>

Django

não lida,
4 de abr. de 2016, 12:41:2804/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: assigned
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left comments for improvement.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:11>

Django

não lida,
9 de abr. de 2016, 14:55:0009/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: closed
Component: contrib.auth | Version: 1.9
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c1aec0feda73ede09503192a66f973598aef901d" c1aec0fe]:
{{{
#!CommitTicketReference repository=""
revision="c1aec0feda73ede09503192a66f973598aef901d"
Fixed #25847 -- Made User.is_(anonymous|authenticated) properties.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:12>

Django

não lida,
10 de abr. de 2016, 08:18:2610/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: closed
Component: contrib.auth | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by apollo13):

@timgraham: I feel this should get reverted for now. We have to consider
custom user models which did define this as a method. A warning is not
enough, either his is a hard error or we ensure that it is backwards
compatible. Allowing custom user models to have a method is a security
risk since all checks will now return true…

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:13>

Django

não lida,
10 de abr. de 2016, 14:25:5710/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: new
Component: contrib.auth | Version: 1.9
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by claudep):

* status: closed => new
* resolution: fixed =>


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:14>

Django

não lida,
10 de abr. de 2016, 15:37:4810/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: 1.10 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* keywords: => 1.10
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
* version: 1.9 => master


Comment:

I was thinking of adding a "compatibility" system check to detect that.
I'll do it before 1.10 alpha if no one else takes it.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:15>

Django

não lida,
11 de abr. de 2016, 12:45:2811/04/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: 1.10 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by apollo13):

* cc: apollo13 (added)


Comment:

Unless that system check is a hard error I am against it. (Ie it does have
to be ERROR, so we can ensure that we do not open ourself to security
issues) -- can we justify the backwards incompatibility?

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:16>

Django

não lida,
5 de mai. de 2016, 13:13:1605/05/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: 1.10 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/6562 PR] for the system check to
detect `is_anonymous`/`is_authenticated` as methods.

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:17>

Django

não lida,
6 de mai. de 2016, 09:13:1906/05/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: 1.10 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"03efa304bce5ef0924948a74ae01cdf817dd416a" 03efa304]:
{{{
#!CommitTicketReference repository=""
revision="03efa304bce5ef0924948a74ae01cdf817dd416a"
Refs #25847 -- Added system check for
UserModel.is_anonymous/is_authenticated methods.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:18>

Django

não lida,
6 de mai. de 2016, 10:35:1006/05/2016
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------+------------------------------------
Reporter: skorokithakis | Owner: jlaine
Type: New feature | Status: closed
Component: contrib.auth | Version: master
Severity: Normal | Resolution: fixed

Keywords: 1.10 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:19>

Django

não lida,
17 de jan. de 2017, 22:09:5217/01/2017
para django-...@googlegroups.com
#25847: Make User.is_authenticated() and User.is_anonymous() "callable properties"
-------------------------------------+-------------------------------------
Reporter: Stavros | Owner: Jeremy
Korokithakis | Lainé

Type: New feature | Status: closed
Component: contrib.auth | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.10 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"eba093e8b02989af1857b1915907ca0897f565ff" eba093e]:
{{{
#!CommitTicketReference repository=""
revision="eba093e8b02989af1857b1915907ca0897f565ff"
Refs #25847 -- Removed support for User.is_(anonymous|authenticated) as
methods.

Per deprecation timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25847#comment:20>

Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem