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

GitHubAppCredential token refresh no longer working

XMLWordPrintable

      Since the introduction of https://github.com/jenkinsci/credentials-plugin/pull/327 the `GitHubAppCredential` is replaced by a standard `UsernamePasswordCredential` and so the token refresh is no longer working.

      The writeReplace() is no longer called if the credential is snapshotted before use.  this means that the token sent to the agent is static and will not be replaced.

      unclear how best to reproduce the error - but it is obvious via code inspection that the GitHubAppCredential is replaced.

      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.createJwtProvider(GitHubAppCredentials.java:157)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.access$000(GitHubAppCredentials.java:54)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials$TokenProvider.<init>(GitHubAppCredentials.java:165)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials$TokenProvider$1.<init>(GitHubAppCredentials.java:179)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials$TokenProvider.createTokenRefreshGitHub(GitHubAppCredentials.java:178)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.generateAppInstallationToken(GitHubAppCredentials.java:216)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.getToken(GitHubAppCredentials.java:298)
      at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.getPassword(GitHubAppCredentials.java:327)
      at com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsSnapshotTaker.snapshot(UsernamePasswordCredentialsSnapshotTaker.java:28)
      at com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsSnapshotTaker.snapshot(UsernamePasswordCredentialsSnapshotTaker.java:9)
      at com.cloudbees.plugins.credentials.CredentialsProvider.snapshot(CredentialsProvider.java:821)

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

              Created:
              Updated:
              Resolved: