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

Credentials masks nonexistent secrets between all chars when withCredentials is passed an empty list

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      First reported here in a comment under JENKINS-24805.

      Minimal reproduction script is:

      node() {
        withCredentials( [] ) {
            echo 'Test of the credentials binding decorator'
        }
      }
      

      So, passing an empty list of credentials--my concrete use case constructs the list based on upstream factors; some of the times there are no credentials to resolve so the list is empty. The relevant part of the log then winds up like this:

      [Pipeline] Bind credentials to variables : Start
      [Pipeline] withCredentials {
      [Pipeline] echo
      ****T****e****s****t**** ****o****f**** ****t****h****e**** ****c****r****e****d****e****n****t****i****a****l****s**** ****b****i****n****d****i****n****g**** ****d****e****c****o****r****a****t****o****r****
      ****
      ****[Pipeline] } //withCredentials
      [Pipeline] Bind credentials to variables : End
      
      

      I believe it's because BindingStep.Filter::Filter builds a zero-length pattern in this scenario, which matches like crazy.

      The obvious workaround is just to not wrap using withCredentials if the credentials list is empty, so it's not a huge deal. I'm also unsure if this issue should be distinct from JIRA-24805.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            I think Andrew Bayer made the corresponding fix for SecretBuildWrapper in his fix of JENKINS-24805.

            Show
            jglick Jesse Glick added a comment - I think Andrew Bayer made the corresponding fix for SecretBuildWrapper in his fix of JENKINS-24805 .
            Hide
            abayer Andrew Bayer added a comment -

            Yup, I did.

            Show
            abayer Andrew Bayer added a comment - Yup, I did.
            Hide
            brianeray Brian Ray added a comment - - edited

            Thanks Andrew Bayer and Jesse Glick. I'll grab the latest Credentials Binding today, rerun the use case, then wrap up this issue.

            [Still kind of a Jira newbie:] After testing should I put this in RESOLVED/Fixed a la JENKINS-24805?

            Show
            brianeray Brian Ray added a comment - - edited Thanks Andrew Bayer and Jesse Glick . I'll grab the latest Credentials Binding today, rerun the use case, then wrap up this issue. [Still kind of a Jira newbie:] After testing should I put this in RESOLVED/Fixed a la JENKINS-24805 ?
            Hide
            jglick Jesse Glick added a comment -

            Yes please.

            Show
            jglick Jesse Glick added a comment - Yes please.
            Hide
            brianeray Brian Ray added a comment -

            Unfortunately, no resolution after installing 1.10. I restarted twice just to be sure. The symptom is the same as described above.

            Show
            brianeray Brian Ray added a comment - Unfortunately, no resolution after installing 1.10. I restarted twice just to be sure. The symptom is the same as described above.
            Hide
            jglick Jesse Glick added a comment -

            Andrew Bayer’s fix applied only to the freestyle build wrapper, not to the Pipeline step.

            Show
            jglick Jesse Glick added a comment - Andrew Bayer ’s fix applied only to the freestyle build wrapper, not to the Pipeline step.
            Hide
            jglick Jesse Glick added a comment -

            Fix being tracked as JENKINS-41760.

            Show
            jglick Jesse Glick added a comment - Fix being tracked as  JENKINS-41760 .

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                brianeray Brian Ray
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: