Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25243

Make CSRF tokens identical on all nodes of a cluster

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.9.0-rc-1
    • 18.8.0
    • CSRF
    • None
    • Unit
    • Unknown

    Description

      CSRF tokens are kept in a JVM-local map (DefaultCSRFToken). In a cluster behind a load balancer without sticky sessions, a form rendered by one node and submitted to another is rejected ("Secret CSRF token verification failed"), and a node restart invalidates every open form.

      Proposal: derive the token deterministically with an HMAC of the authentication validation key (xwiki.authentication.validationKey, which a cluster already has to share for cookies to work) and the user reference, so every node computes the same token. Compare tokens in constant time.

      Attachments

        Issue Links

          Activity

            People

              ciaens Clément Christiaens
              ciaens Clément Christiaens
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: