Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-9072

NewCookieHeaderProvider does not support SameSite attribute on cookies

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.9, 4.0.5, 3.6.4
    • 4.1.0, 3.5.11, 3.6.6, 4.0.7
    • JAX-RS
    • None
    • Unknown

    Description

      ResponseImpl.getCookies (which works via NewCookieHeaderProvider) does not work for cookies using the SameSite attribute.

      Example:

      System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8"))
      System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8;Comment=none"))
      System.out.println(new NewCookieHeaderProvider().fromString("Set-Cookie: sessionId=38afes7a8;SameSite=none"))
      

      Expected output:

      Set-Cookie: sessionId=38afes7a8;Version=1
      Set-Cookie: sessionId=38afes7a8;Comment=none;Version=1
      Set-Cookie: sessionId=38afes7a8;SameSite=none;Version=1

      Current output:

      Set-Cookie: sessionId=38afes7a8;Version=1
      Set-Cookie: sessionId=38afes7a8;Comment=none;Version=1
      SameSite=none;Version=1

      Note that the SameSite attribute is mistaken for the cookie name and value.

      In addition to explicitly supporting the SameSite attribute, it would be much better if the parser behaved in a forward-compatible manner, at the very least ignoring unknown attributes, or better, keeping them in a general attribute map. (Cf. Jakarta’s `Cookie` class.) See also the current valid Set-Cookie syntax.)

      Attachments

        Activity

          People

            reta Andriy Redko
            mormegil Petr Kadlec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: