Skip to content

Add Base64 encoding option to DefaultCookieSerializer #611

Closed

Description

@rwinch

In order to support RFC 6265 we should consider adding Base64 encoding option to DefaultCookieSerializer since the spec states:

To maximize compatibility with user agents, servers that wish to
store arbitrary data in a cookie-value SHOULD encode that data, for
example, using Base64

NOTE:

  • We must remain JDK 5 compliant, so we will likely need to copy code from Spring Security into a package private class. See Base64 and Base64Tests
  • We should also be safe when decoding the value. If we get an error decoding the cookie value, we should return null. This prevents internal server errors if a user has a cookie with a non-base64 encoded value (i.e. there was a migration). Additionally, it prevents information leakage in the event a malicious user specifies an invalid value

Activity

  1. added this to the 1.3.0 M1 milestone on Sep 2, 2016
  2. added
    status: ideal-for-contribution
    on Sep 2, 2016
  3. modified the milestones: , 1.3.0 M1 on Sep 2, 2016
  4. vpavic commented on Sep 2, 2016

    @vpavic
    Contributor

    @rwinch Will take a look into this one and come up with PR.

  5. vpavic commented on Sep 5, 2016

    @vpavic
    Contributor

    @rwinch I've created the PR (#614) to address this using the guidelines you outlined above.

    However I wonder if this should be the default, rather than an option, considering it does not seem likely the Tomcat will change the default behavior?

  6. rwinch commented on Sep 6, 2016

    @rwinch
    MemberAuthor

    @vpavic Thanks. I don't think we can make this the default:

    • This only impacts users who are leveraging both:
      • multiple sessions in a single browser
      • Tomcat 8.5 which is a small subset of users
    • The change is non-passive. Specifically, all existing session cookie values will be invalid.
    • Base64 encoding increases the size of the cookie rather significantly.
    • Users might wish to simply change the delimiter rather than Base64 encoding. See Add CookieHttpSessionStrategy.setCookieValueDelimiter #615
  7. added 2 commits that reference this issue on Sep 7, 2016
    7fd0739
    1ead9f7
  8. self-assigned this
    on Sep 7, 2016
  9. removed
    status: ideal-for-contribution
    on Jan 13, 2017
  10. added a commit that references this issue on Jan 20, 2025
    2792d2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions