Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25917

Spaces in URL (from project name or view) cause invalid cookies to be saved

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • Jenkins v1.565.2 on Windows Server 2003, analysis-core-plugin v1.55. Firefox 30, IE 11

      One of our developers noticed that our PC-Lint warnings trend graph only showed builds from the last 30 days and that configuring the graph to show more had no effect.

      I noticed while debugging this that the cookie being generated to save the trend graph configuration had the wrong path set so that the project dashboard wasn't loading it. The path was being set to the URL of the trend graph's configuration page (ex. http://jenkins/project with spaces/warnings0/config). If I manually edited the cookie's path to point to the project dashboard (ex. http://jenkins/project with spaces/) it worked. The same issue exists if a project dashboard is opened from a view with spaces in the name (ex. http://jenkins/view/View with spaces/Project_with_underscores).

      Near as I can tell the source of the issue is in CookieHandler.java:

      CookieHandler.java
          /**
           * Sends a cookie with the specified value.
           *
           * @param requestAncestors
           *            the ancestors of the request
           * @param value
           *            the cookie value
           * @return the created cookie
           */
          public Cookie create(final List<Ancestor> requestAncestors, final String value) {
              Cookie cookie = new Cookie(name, value);       
      Ancestor ancestor = requestAncestors.get(requestAncestors.size() - ANCESTOR_PATH_PREFIX);
              cookie.setPath(ancestor.getUrl());
              cookie.setMaxAge(ONE_YEAR);
      
              return cookie;
          }
      

      I think this line of code is the culprit which returning the wrong URL for the cookie's path.

      Ancestor ancestor = requestAncestors.get(requestAncestors.size() - ANCESTOR_PATH_PREFIX);

          [JENKINS-25917] Spaces in URL (from project name or view) cause invalid cookies to be saved

          David Schamber created issue -
          Ulli Hafner made changes -
          Labels Original: configuration plugin
          Priority Original: Major [ 3 ] New: Minor [ 4 ]
          Ulli Hafner made changes -
          Component/s New: core [ 15593 ]
          Component/s New: junit-plugin [ 15499 ]
          Component/s Original: warnings-plugin [ 15513 ]
          Summary Original: Spaces in URL (from project name or view) cause invalid cookie to be saved when configuring trend graphs New: Spaces in URL (from project name or view) cause invalid cookies to be saved
          Ulli Hafner made changes -
          Labels New: stapler
          Ulli Hafner made changes -
          Assignee Original: Ulli Hafner [ drulli ]
          Ulli Hafner made changes -
          Link New: This issue is duplicated by JENKINS-29269 [ JENKINS-29269 ]
          evernat made changes -
          Link New: This issue depends on JENKINS-32377 [ JENKINS-32377 ]
          evernat made changes -
          Link New: This issue is duplicated by JENKINS-23063 [ JENKINS-23063 ]
          Ulli Hafner made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Ulli Hafner made changes -
          Assignee New: Kohsuke Kawaguchi [ ci_jenkinsci_org ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 159904 ] New: JNJira + In-Review [ 196237 ]

            ci_jenkinsci_org Kohsuke Kawaguchi
            schambda David Schamber
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: