Skip to content

parse_cookie_str can be crashed by end users via cookie_str = 'true' #135

@gmseb

Description

@gmseb

Hi!

I stumbled upon a crash report ValueError: not enough values to unpack (expected 2, got 1) in Sentry from django-cookie-consent code line…

https://github.com/jazzband/django-cookie-consent/blob/81aae63a289d67cdc9803c61ae6d3239a2af83a2/cookie_consent/util.py#L15

…today. cookie_str has value "true" in this case, and playing with IPython shows how the current code breaks:

In [1]: 'foo=bar'.split('=')
Out[1]: ['foo', 'bar']

In [2]: ''.split('=')
Out[2]: ['']

In [3]: 'true'.split('=')
Out[3]: ['true']

The issue still exists on master so until this is fixed, Django setups can be crashed like this. Would be great to have fixed, thank you!

Best, Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions