Skip to content

net/http: parsing of cookie attribute values is too lax #7751

Closed
@vdobler

Description

@vdobler
Currently the parsing of the values for the cookie attributes
Domain, Path, Secure, Max-Age, Expires and HttpOnly is too lax:
1. Quoted values are unquoted (which is okay for the cookie-value
itself, but not for the attribute values according to RFC 6265)
2. All values are parsed with basically the full set of allowed
characters.

Point 2 might be overkill, but there is no need to unquote
as browsers do not handle quoted attribute values.

As the infrastructure for restricted set of characters is
already in place with func parseCookieValueUsing(...) it
might be worth to allow only '0' to '9' while parsing Max-Age
and fail early (now malformed values fail in strconv.Atoi)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions