Skip to content

CSRF-TOKEN cookie may be sent with HttpOnly = true. #8

@ghost

Description

When the CSRF-TOKEN cookie is added to the response header, SessionConfig.cookieHTTPOnly is used to determine whether or not the cookie should be sent with the HTTPOnly attribute. However, for CSRF-TOKEN cookie to make sense it should always be sent without HTTPOnly so that JavaScript can copy its content to the X-CSRF-Token header when accessing APIs.

In the top-most comment of PerfectSession/WebSecurity/CSRF.swift this intention is actually documented. It is just the implementation that configures the cookie in an unexpected way.

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