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

form submission data is occasionally garbage

XMLWordPrintable

      In some (as yet unexplained situations) the json form data when adding credentials is garbage.

      Steps to Reproduce

      Expected Results

      • test passes reliably

      Actual Results

      in some cases the test fails as the submitted json is broken,

      e.g.

      ------geckoformboundarydcb5b5e50fbcbf4c6b8b778cf6b754f6
      Content-Disposition: form-data; name="json"
      
      {"domain":"_","":["1",""],"credentials":{"scope":["GLOBAL","GLOBAL"],"username":["user1",""],"usernameSecret":[false,false],"password":"","$redact":["password","passphrase"],"id":["",""],"description":["Ssh key",""],"privateKeySource":{"value":"0","privateKey":"1212122112","$redact":"privateKey","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"},"passphrase":"","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"},"Jenkins-Crumb":"5f57c3863f722e8911937f70b05c7f385376d795b2d5b004eec8e4a8ae32e50d"}
      ------geckoformboundarydcb5b5e50fbcbf4c6b8b778cf6b754f6--
      

      Note that the values of many paramters (like scope) are doubled up.

      The following error is shown in the Jenkins logs

      2025-10-28 21:15:25.173+0000 [id=78]	WARNING	c.c.p.c.CredentialsSelectHelper$WrappedCredentialsStore#doAddCredentials: Failed to create Credentials
      org.kohsuke.stapler.WrongTypeException: Got type array but no lister class found for type class com.cloudbees.plugins.credentials.CredentialsScope
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:917)
      Caused: java.lang.IllegalArgumentException: Failed to convert the scope parameter of the constructor public com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey(com.cloudbees.plugins.credentials.CredentialsScope,java.lang.String,java.lang.String,com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$PrivateKeySource,java.lang.String,java.lang.String)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:1010)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:866)
      Caused: java.lang.IllegalArgumentException: Failed to instantiate class com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey from {"scope":["GLOBAL","GLOBAL"],"username":["user1",""],"usernameSecret":[false,false],"password":"[value redacted]","$redact":["password","passphrase"],"id":["",""],"description":["Ssh key",""],"privateKeySource":{"value":"0","privateKey":"[value redacted]","$redact":"privateKey","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"},"passphrase":"[value redacted]","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"}
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:870)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:633)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:628)
      	at hudson.model.Descriptor.bindJSON(Descriptor.java:662)
      	at hudson.model.Descriptor.newInstanceImpl(Descriptor.java:620)
      Caused: java.lang.LinkageError: Failed to instantiate class com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey from {"scope":["GLOBAL","GLOBAL"],"username":["user1",""],"usernameSecret":[false,false],"password":"[value redacted]","$redact":["password","passphrase"],"id":["",""],"description":["Ssh key",""],"privateKeySource":{"value":"0","privateKey":"[value redacted]","$redact":"privateKey","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"},"passphrase":"[value redacted]","stapler-class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey","$class":"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"}
      	at hudson.model.Descriptor.newInstanceImpl(Descriptor.java:626)
      	at hudson.model.Descriptor.newInstance(Descriptor.java:594)
      	at hudson.model.Descriptor$NewInstanceBindInterceptor.instantiate(Descriptor.java:709)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:980)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:866)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:633)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:628)
      	at hudson.model.Descriptor.bindJSON(Descriptor.java:662)
      	at hudson.model.Descriptor.bindJSON(Descriptor.java:637)
      	at PluginClassLoader for credentials//com.cloudbees.plugins.credentials.CredentialsSelectHelper$WrappedCredentialsStore.doAddCredentials(CredentialsSelectHelper.java:609)
      

      Whilst there is currently no HAR to show this faulty submission, you can start the devtools and enable HAR recording once the test has started (and hope you are lucky that you catch the failure!)

      Seems to fail about 1 in 10 for me - failed in the ATH job which reruns failed tests twice.

      https://github.com/jenkinsci/acceptance-test-harness/pull/2221/checks?check_run_id=53913818869

            Unassigned Unassigned
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: