Skip to content

[JENKINS-16278] "Remember me on this computer" does not work, cookie is not accepted in new session #13196

Closed

Description

@jenkins-infra-bot

As of Jenkins version 1.498 the "Remember me" login cookie is not accepted resulting in a necessary login each time a new Jenkins session is started (loss of session cookie). The versions 1.496 and 1.497 did not show this issue.

We are using Jenkin's built-in user authentication


Originally reported by lime, imported from: "Remember me on this computer" does not work, cookie is not accepted in new session
  • assignee: lime
  • status: Resolved
  • priority: Major
  • component(s): core
  • label(s): 1.480.3-fixed, security
  • resolution: Fixed
  • resolved: 2014-03-11T17:04:06+00:00
  • votes: 29
  • watchers: 34
  • imported: 2025-11-24
Raw content of original issue

As of Jenkins version 1.498 the "Remember me" login cookie is not accepted resulting in a necessary login each time a new Jenkins session is started (loss of session cookie). The versions 1.496 and 1.497 did not show this issue.

We are using Jenkin's built-in user authentication

  • environment: Jenkins 1.498 on Debian Squeeze with Java 1.6.0_26

Activity

  1. jenkins-infra-bot commented on Jan 11, 2013

    @jenkins-infra-bot
    Author
    xiaopan3322:
    • Original comment link
    • Raw content of original comment:

      Same Problem occurred in my side... What's the latest status for this topic?!

    Same Problem occurred in my side...
    What's the latest status for this topic?!

  2. jenkins-infra-bot commented on Jan 15, 2013

    @jenkins-infra-bot
    Author
    tle:
    • Original comment link
    • Raw content of original comment:

      We are experiencing the same issue, but on the LTS version 1.480.2

    We are experiencing the same issue, but on the LTS version 1.480.2

  3. jenkins-infra-bot commented on Jan 15, 2013

    @jenkins-infra-bot
    Author
    lime:
    • Original comment link
    • Raw content of original comment:

      commit a9aff088 [SECURITY-49] introduced a change in signature generation for the remember me token in jenkins/core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java: String expectedTokenSignature = MAC.mac(userDetails.getUsername() + ":" + tokenExpiryTime + ":" + "N/A" + ":" + getKey());

      This code is used to VERIFY a cookie sent to Jenkins. The new verification process seems fine, but the change in code is NOT reflected in org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.class . loginSuccess, where remember me cookies are created and sent to the user. Here, the old signature generation is still being used: String signatureValue = DigestUtils.md5Hex(username + ":" + expiryTime + ":" + password + ":" + key);

      I suggest either @Overriding TokenBasedRememberMeServices.loginSuccess in /jenkins-core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java as well to rely on TokenBasedRememberMeServices2.makeTokenSignature, or revert to the old md5 signature.

      Any comments?

    commit a9aff08 [SECURITY-49] introduced a change in signature generation for the remember me token in jenkins/core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java:
    String expectedTokenSignature = MAC.mac(userDetails.getUsername() + ":" + tokenExpiryTime + ":" + "N/A" + ":" + getKey());

    This code is used to VERIFY a cookie sent to Jenkins. The new verification process seems fine, but the change in code is NOT reflected in org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.class . loginSuccess, where remember me cookies are created and sent to the user. Here, the old signature generation is still being used:
    String signatureValue = DigestUtils.md5Hex(username + ":" + expiryTime + ":" + password + ":" + key);

    I suggest either @​Overriding TokenBasedRememberMeServices.loginSuccess in /jenkins-core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java as well to rely on TokenBasedRememberMeServices2.makeTokenSignature, or revert to the old md5 signature.

    Any comments?

  4. jenkins-infra-bot commented on Jan 15, 2013

    @jenkins-infra-bot
    Author
  5. jenkins-infra-bot commented on Jan 16, 2013

    @jenkins-infra-bot
    Author
    marscher:
    • Original comment link
    • Raw content of original comment:

      would love to see this pull request in the LTS version, as this affected too.

    would love to see this pull request in the LTS version, as this affected too.

  6. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original comment:

      Code changed in jenkins User: Hendrik Millner Path: core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java http://jenkins-ci.org/commit/jenkins/91bbae3c35230734fd2cf6926a7ac1239119fc6e Log: [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49)

      New cookie signature generation was not implemented in creation of RememberMe cookie, but only in its verification. Fixed by new override TokenBasedRememberMeServices2.loginSuccess

    Code changed in jenkins
    User: Hendrik Millner
    Path:
    core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java
    http://jenkins-ci.org/commit/jenkins/91bbae3c35230734fd2cf6926a7ac1239119fc6e
    Log:
    [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49)

    New cookie signature generation was not implemented in creation of RememberMe cookie, but only in its verification.
    Fixed by new override TokenBasedRememberMeServices2.loginSuccess

  7. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Olivier Lamy
    Path:
    core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java
    http://jenkins-ci.org/commit/jenkins/4325e006d84113f8e100ec59d03f94f98a6ef3a5
    Log:
    Merge pull request #673 from denebolar/JENKINS-16278

    [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49)
    Thanks

    Compare: de9002b...4325e00

  8. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Olivier Lamy
    Path:
    changelog.html
    http://jenkins-ci.org/commit/jenkins/0b5a4a3550dcff91b1bedeb77415f683b659634b
    Log:
    changelog entry for JENKINS-16278

  9. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    dogfood:

    Integrated in jenkins_main_trunk #2213
    [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49) (Revision 91bbae3)
    changelog entry for JENKINS-16278 (Revision 0b5a4a3)

    Result = SUCCESS
    hendrik.millner : 91bbae3c35230734fd2cf6926a7ac1239119fc6e
    Files :

    • core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java

    Olivier Lamy : 0b5a4a3550dcff91b1bedeb77415f683b659634b
    Files :

    • changelog.html
  10. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    pickgr1:
    • Original comment link
    • Raw content of original comment:

      Please create a new LTS version including this fix.

    Please create a new LTS version including this fix.

  11. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    jglick:
    • Original comment link
    • Raw content of original comment:

      @pickgr1 it is already on the 1.480.3 backport candidate list.

    @​pickgr1 it is already on the 1.480.3 backport candidate list.

  12. jenkins-infra-bot commented on Jan 24, 2013

    @jenkins-infra-bot
    Author
    jglick:
    • Original comment link
    • Raw content of original comment:

      Not sure why this did not already get marked fixed automatically.

    Not sure why this did not already get marked fixed automatically.

  13. jenkins-infra-bot commented on Jan 25, 2013

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original comment:

      Code changed in jenkins User: Hendrik Millner Path: core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java http://jenkins-ci.org/commit/jenkins/83c95d51bae57fc328e5b1fb080875234a1b0429 Log: [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49)

      New cookie signature generation was not implemented in creation of RememberMe cookie, but only in its verification. Fixed by new override TokenBasedRememberMeServices2.loginSuccess (cherry picked from commit 91bbae3c35230734fd2cf6926a7ac1239119fc6e)

    Code changed in jenkins
    User: Hendrik Millner
    Path:
    core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java
    http://jenkins-ci.org/commit/jenkins/83c95d51bae57fc328e5b1fb080875234a1b0429
    Log:
    [FIXED JENKINS-16278] Fixed RememberMe cookie signature generation (bugfix on SECURITY-49)

    New cookie signature generation was not implemented in creation of RememberMe cookie, but only in its verification.
    Fixed by new override TokenBasedRememberMeServices2.loginSuccess
    (cherry picked from commit 91bbae3)

  14. jenkins-infra-bot commented on Jan 25, 2013

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Olivier Lamy
    Path:
    changelog.html
    http://jenkins-ci.org/commit/jenkins/fa6a84c54506fc25531a039f931870880f6fa182
    Log:
    changelog entry for JENKINS-16278(cherry picked from commit 0b5a4a3)

    Conflicts:
    changelog.html

  15. jenkins-infra-bot commented on Jan 30, 2013

    @jenkins-infra-bot
    Author
    tomhe:
    • Original comment link
    • Raw content of original comment:

      For which release will this fix be available? I'm at 1.500 and still have to keep logging in over and over.

    For which release will this fix be available? I'm at 1.500 and still have to keep logging in over and over.

  16. 19 remaining items

  17. jenkins-infra-bot commented on Dec 6, 2017

    @jenkins-infra-bot
    Author
    lime:

    Hi Kim,

    May I also ask you to set up a logger according to comment https://issues.jenkins-ci.org/browse/JENKINS-16278?focusedCommentId=174193&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-174193 please? It would be great to be sure whether a correct remember me cookie is created, or not.

  18. jenkins-infra-bot commented on Dec 7, 2017

    @jenkins-infra-bot
    Author
    rupunzlkim:
    • Original comment link
    • Raw content of original comment:

      Thank you Hendrik, I did set up a logger, here is what appears repeatedly from Jenkins 3.

      SecurityContextHolder not populated with remember-me token, as it already contained: 'org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken@edd9cf3c: Username: hudson.security.HudsonPrivateSecurityRealm$Details@7e08bf1b; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@3bcc: RemoteIpAddress: <my PC IP>; SessionId: null; Granted Authorities: authenticated'

      And this is the exact same message I get from Jenkins 2.

      The entry from Jenkins 1 though is a bit different - note there is a SessionID value:

      SecurityContextHolder not populated with remember-me token, as it already contained: 'org.acegisecurity.providers.UsernamePasswordAuthenticationToken@9a1e6431: Username: hudson.security.HudsonPrivateSecurityRealm$Details@305806; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@ffff8868: RemoteIpAddress: <my PC IP>; SessionId: 1sc6t6z8jn1cr2fvqou5qovze; Granted Authorities: authenticated'

       

    Thank you Hendrik, I did set up a logger, here is what appears repeatedly from Jenkins 3.

    SecurityContextHolder not populated with remember-me token, as it already contained: 'org.acegisecurity.providers.rememberme.RememberMeAuthenticationToken@​edd9cf3c: Username: hudson.security.HudsonPrivateSecurityRealm$Details@​7e08bf1b; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@​3bcc: RemoteIpAddress: ; SessionId: null; Granted Authorities: authenticated'

    And this is the exact same message I get from Jenkins 2.

    The entry from Jenkins 1 though is a bit different - note there is a SessionID value:

    SecurityContextHolder not populated with remember-me token, as it already contained: 'org.acegisecurity.providers.UsernamePasswordAuthenticationToken@​9a1e6431: Username: hudson.security.HudsonPrivateSecurityRealm$Details@​305806; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@​ffff8868: RemoteIpAddress: ; SessionId: 1sc6t6z8jn1cr2fvqou5qovze; Granted Authorities: authenticated'

     

  19. jenkins-infra-bot commented on Dec 7, 2017

    @jenkins-infra-bot
    Author
    lime:
    • Original comment link
    • Raw content of original comment:

      This shows that your authentication is retained by the session ID cookie, at least if it is not null. Does this message look different after you were kicked out from the system? Please check the log on the Jenkins instance, you were kicked out of. Actually, you should be re-authenticated by your session ID cookie, at least as long as you do not close your browser, or any add-on deletes the cookie. Do you have simultaneous session ID cookies for all of your Jenkins instances in your browser, after you logged in into all instances? Or only one cookie for the last instance, you logged into? The session ID cookies expire only when you close your browser.

      Anyways, the different Jenkins instances should not be able to influence each other in you browser, especially if they are hosted on different servers. Do you route the Jenkins UIs through one and the same web server, so that the cookies from the different instances may collide (e.g. http://myserver/jenkins1/ and http://myserver/jenkins2/) ?

    This shows that your authentication is retained by the session ID cookie, at least if it is not null. Does this message look different after you were kicked out from the system? Please check the log on the Jenkins instance, you were kicked out of. Actually, you should be re-authenticated by your session ID cookie, at least as long as you do not close your browser, or any add-on deletes the cookie. Do you have simultaneous session ID cookies for all of your Jenkins instances in your browser, after you logged in into all instances? Or only one cookie for the last instance, you logged into? The session ID cookies expire only when you close your browser.

    Anyways, the different Jenkins instances should not be able to influence each other in you browser, especially if they are hosted on different servers. Do you route the Jenkins UIs through one and the same web server, so that the cookies from the different instances may collide (e.g. http://myserver/jenkins1/ and http://myserver/jenkins2/) ?

  20. jenkins-infra-bot commented on Dec 13, 2017

    @jenkins-infra-bot
    Author
    rupunzlkim:
    • Original comment link
    • Raw content of original comment:

      So, I am now noticing that it appears that I'm only running into an issue when I attempt to stay logged into the older Jenkins 1 alongside one of the newer Jenkins 2/3.  Lately appears that if I'm only trying to stay logged into either Jenkins 2/3 I stay logged in, but I can't maintain a login with Jenkins 1 and Jenkins 2/3.

    So, I am now noticing that it appears that I'm only running into an issue when I attempt to stay logged into the older Jenkins 1 alongside one of the newer Jenkins 2/3.  Lately appears that if I'm only trying to stay logged into either Jenkins 2/3 I stay logged in, but I can't maintain a login with Jenkins 1 and Jenkins 2/3.

  21. jenkins-infra-bot commented on Dec 14, 2017

    @jenkins-infra-bot
    Author
    lime:
    • Original comment link
    • Raw content of original comment:

      I am sorry, I cannot help you without further and deeper insight into your system (browser/ server). It seems you have a problem with the Jenkins cookies in general, not with the remember me token in particular.

    I am sorry, I cannot help you without further and deeper insight into your system (browser/ server). It seems you have a problem with the Jenkins cookies in general, not with the remember me token in particular.

  22. jenkins-infra-bot commented on Nov 24, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-9258]

  23. jenkins-infra-bot commented on Nov 24, 2025

    @jenkins-infra-bot
    Author

    [Original depends_on from Jira: JENKINS-17060]

  24. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions