Uploaded image for project: 'JCommune'
  1. JCommune
  2. JC-2008

Error 500 appears if "SPRING_SECURITY_REMEMBER_ME_COOKIE" is empty and new "_ga" cookie is set

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.11 Larks
    • Fix Version/s: 2.14 Larks
    • Labels:
      None
    • Environment:

      production

    • Sprint:
      2.13 Larks, 2.14 Larks

      Description

      Pre-conditions:
      Install plugin for editing cookies for your browser.
      I.e. "EditThisCookie" for Chrome or "Cookies Manager+" for Mozilla Firefox

      Steps:
      1. Open javatalks.ru
      2. Delete cookie with name "_ga" for domain .javatalks.ru
      3. Delete cookie with name "SPRING_SECURITY_REMEMBER_ME_COOKIE" for domain javatalks.ru if it exists
      3. Create new cookie with next data:

      Name: SPRING_SECURITY_REMEMBER_ME_COOKIE
      Domain: javatalks.ru
      Path: /
      Secure: No
      Http only: No
      Expiration: Session
      Leave "Value" empty

      4. Reload page 2 times

      Actual result: Page with error "HTTP Status 500" is displayed (see screenshot in attachment)
      Expected result: Main page of javatalks.ru is displayed

      Note: Couldn't reproduce bug at testing instance, because it doesn't set "_ga" cookie.

        Attachments

          Activity

          Hide
          ppavlov Pavlov Pasha (Inactive) added a comment -

          Comment to step 4: At first reload new "_ga" cookie is set and no errors appear. At second reload all cookies are send to server and cause error.

          Show
          ppavlov Pavlov Pasha (Inactive) added a comment - Comment to step 4 : At first reload new "_ga" cookie is set and no errors appear. At second reload all cookies are send to server and cause error.
          Hide
          anatolievi4 Andrei Alikov added a comment - - edited

          Please find below the stack trace from the PROD server:

          java.lang.ArrayIndexOutOfBoundsException: 0
          
          org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.decodeCookie(AbstractRememberMeServices.java:175)	org.jtalks.jcommune.web.rememberme.RememberMeCookieDecoderImpl.extractSeriesAndToken(RememberMeCookieDecoderImpl.java:90)
          org.jtalks.jcommune.web.filters.UsernamePasswordAuthenticationFilter.extractAndCheckRememberMeToken(UsernamePasswordAuthenticationFilter.java:75)
          org.jtalks.jcommune.web.filters.UsernamePasswordAuthenticationFilter.doFilter(UsernamePasswordAuthenticationFilter.java:62)
          org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
          org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
          org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)	org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
          org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
          org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
          org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
          com.cj.trim.trimFilter.doFilter(Unknown Source)
          org.jtalks.jcommune.web.filters.TrimFilter.doFilter(TrimFilter.java:82)
          
          Show
          anatolievi4 Andrei Alikov added a comment - - edited Please find below the stack trace from the PROD server: java.lang.ArrayIndexOutOfBoundsException: 0 org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.decodeCookie(AbstractRememberMeServices.java:175) org.jtalks.jcommune.web.rememberme.RememberMeCookieDecoderImpl.extractSeriesAndToken(RememberMeCookieDecoderImpl.java:90) org.jtalks.jcommune.web.filters.UsernamePasswordAuthenticationFilter.extractAndCheckRememberMeToken(UsernamePasswordAuthenticationFilter.java:75) org.jtalks.jcommune.web.filters.UsernamePasswordAuthenticationFilter.doFilter(UsernamePasswordAuthenticationFilter.java:62) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) com.cj.trim.trimFilter.doFilter(Unknown Source) org.jtalks.jcommune.web.filters.TrimFilter.doFilter(TrimFilter.java:82)
          Hide
          anatolievi4 Andrei Alikov added a comment - - edited

          Pavlov Pasha I can reproduce the issue on the javatalks.ru server without removing the "_ga" cookie.
          But still can't reproduce it on my own PC.

          Show
          anatolievi4 Andrei Alikov added a comment - - edited Pavlov Pasha I can reproduce the issue on the javatalks.ru server without removing the "_ga" cookie. But still can't reproduce it on my own PC.
          Hide
          anatolievi4 Andrei Alikov added a comment -

          1. "_ga" cookie is not related to the issue.
          2. To reproduce the issue on my PC I've used Tomcat 6 with default settings.

          Show
          anatolievi4 Andrei Alikov added a comment - 1. "_ga" cookie is not related to the issue. 2. To reproduce the issue on my PC I've used Tomcat 6 with default settings.
          Hide
          ctapobep Stanislav Bashkyrtsev added a comment -

          Andrei Alikov, please see comments in github.

          Show
          ctapobep Stanislav Bashkyrtsev added a comment - Andrei Alikov , please see comments in github.
          Hide
          anatolievi4 Andrei Alikov added a comment -

          Fixed after the code review.

          Show
          anatolievi4 Andrei Alikov added a comment - Fixed after the code review.
          Hide
          julik Julia Atlygina added a comment -

          virtus do not forget to update issues in 3 days..

          Show
          julik Julia Atlygina added a comment - virtus do not forget to update issues in 3 days..
          Hide
          virtus80 virtus added a comment - - edited

          Build: 2.14.2743.7e1eda4 (localhost)
          Browsers: Opera 26.0 (with EditThisCookie), Firefox 34.0.5 (with Cookies Manager+), Google Chrome 39.0 (with EditThisCookie)
          Tools: apache-tomcat-6.0.43-windows-x64

          Test scenario:
          1. Open jcommune:8080
          Cookie with name "_ga" for domain jcommune don't exist.
          2. Create new cookie with next data:

          Name: SPRING_SECURITY_REMEMBER_ME_COOKIE
          Domain: jcommune
          Path: /
          Secure: No
          Http only: No
          Expiration: Session
          Leave "Value" empty

          3. Reload page 2 times

          Actual result: In Opera and Google Chrome cookie 'SPRING_SECURITY_REMEMBER_ME_COOKIE' isn't saved. In all browsers main page of forum is displayed after double reloading page.

          Issue can be closed.

          Show
          virtus80 virtus added a comment - - edited Build : 2.14.2743.7e1eda4 (localhost) Browsers : Opera 26.0 (with EditThisCookie), Firefox 34.0.5 (with Cookies Manager+), Google Chrome 39.0 (with EditThisCookie) Tools : apache-tomcat-6.0.43-windows-x64 Test scenario : 1 . Open jcommune:8080 Cookie with name "_ga" for domain jcommune don't exist. 2 . Create new cookie with next data: Name: SPRING_SECURITY_REMEMBER_ME_COOKIE Domain: jcommune Path: / Secure: No Http only: No Expiration: Session Leave "Value" empty 3 . Reload page 2 times Actual result : In Opera and Google Chrome cookie 'SPRING_SECURITY_REMEMBER_ME_COOKIE' isn't saved. In all browsers main page of forum is displayed after double reloading page. Issue can be closed .

            People

            • Assignee:
              virtus80 virtus
              Reporter:
              ppavlov Pavlov Pasha (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Structure Helper Panel