I am using the Credential plugin for Jenkins, and I think I have detected a bug.

      I am going to explain the steps I have followed .(sorry for my English

      1. First, I create the domain and exclude the path XXXX
         
      2. Second, I created the credentials for my user inside this domain
         
      3. Then, I configure the job, pasting the url repo.
      4. And the credentials show me jsanchra and None values. I guess the Credentials only should show None value, is that correct? Maybe I have a configuration mistake?

        1. credential-exclusion-a-01.PNG
          credential-exclusion-a-01.PNG
          35 kB
        2. credential-exclusion-b-01.PNG
          credential-exclusion-b-01.PNG
          35 kB
        3. credentials-exclusion-a-02.png
          credentials-exclusion-a-02.png
          27 kB
        4. credentials-exclusion-a-03.png
          credentials-exclusion-a-03.png
          19 kB
        5. credentials-exclusion-b-02.png
          credentials-exclusion-b-02.png
          24 kB
        6. credentials-exclusion-b-03.png
          credentials-exclusion-b-03.png
          17 kB
        7. image1.png
          image1.png
          37 kB
        8. image2.png
          image2.png
          19 kB
        9. image3.png
          image3.png
          28 kB
        10. image5.png
          image5.png
          10 kB
        11. image6.png
          image6.png
          20 kB

          [JENKINS-43022] Not correct exclude path to domains

          Mark Waite added a comment -

          I've nothing new to report. I suspect the change needs a review of all locations in the git client plugin which refer to a credential, including the user interface portions and CliGitAPIImpl and JGitAPIImpl.

          Mark Waite added a comment - I've nothing new to report. I suspect the change needs a review of all locations in the git client plugin which refer to a credential, including the user interface portions and CliGitAPIImpl and JGitAPIImpl.

          Hi markewaite this solution to pull request : https://github.com/jenkinsci/git-client-plugin/pull/242 , tested my local and good working.

          Please you feedback to solution.

          Thanks

          juan francisco sanchez ramos added a comment - Hi markewaite this solution to pull request : https://github.com/jenkinsci/git-client-plugin/pull/242  , tested my local and good working. Please you feedback to solution. Thanks

          Mark Waite added a comment - - edited

          jsanchra I've tested the pull request and it doesn't behave the way I'd expected.

          I duplicated the bug by defining a GitHub credential in the lts-with-plugins branch of my docker instance with hostname github.com, URI scheme https, and URI path exclusion /MarkEWaite/jenkins-bugs-private* . When I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials.  That's the bug.

          When I merged your pull request onto a development branch based on the master branch with your changes, when I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials. That's good.

          Unfortunately, when I configure a job which should still show the credential, it does not show the credential. It is as though your changes have caused that credential to be hidden in all cases.

          Before your Changes

          Define the credential:

          See the credential (unexpected):

          See the credential (expected)

          After your Changes

          Define the credential:

          Don't see the credential (as expected)

          Don't see the credential (unexpected)

          Mark Waite added a comment - - edited jsanchra I've tested the pull request and it doesn't behave the way I'd expected. I duplicated the bug by defining a GitHub credential in the lts-with-plugins branch of my docker instance with hostname github.com , URI scheme https , and URI path exclusion /MarkEWaite/jenkins-bugs-private* . When I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials.  That's the bug. When I merged your pull request onto a development branch based on the master branch with your changes, when I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials. That's good. Unfortunately, when I configure a job which should still show the credential, it does not show the credential. It is as though your changes have caused that credential to be hidden in all cases. Before your Changes Define the credential: See the credential (unexpected): See the credential (expected) After your Changes Define the credential: Don't see the credential (as expected) Don't see the credential (unexpected)

          Hi markewaite the problem es .git, ok i review this case.

          Thanks

          juan francisco sanchez ramos added a comment - Hi markewaite the problem es .git, ok i review this case. Thanks

          Mark Waite added a comment -

          jsanchra I revised your pull request to reduce differences to the upstream master, and to add more tests, and have submitted it as a new pull request. It has passed my interactive testing. I've requested a review from Stephen Connolly to confirm that it behaves the way he expects.

          I found one surprise in relative path scp style URL's which is documented in the source code. If a user wants to apply an exclusion to a relative path scp URL (like mwaite@git.markwaite.net:git/bare/bin.git), then they must prefix the relative path with a '/' so that the exclusion is applied. The credentials Path component prefixes with a '/' if one is not detected in the string already. That credentials code is likely used in many places, so I believe that changing that behavior would be much worse than requiring users to make this minor adaptation.

          Mark Waite added a comment - jsanchra I revised your pull request to reduce differences to the upstream master, and to add more tests, and have submitted it as a new pull request . It has passed my interactive testing. I've requested a review from Stephen Connolly to confirm that it behaves the way he expects. I found one surprise in relative path scp style URL's which is documented in the source code. If a user wants to apply an exclusion to a relative path scp URL (like mwaite@git.markwaite.net:git/bare/bin.git), then they must prefix the relative path with a '/' so that the exclusion is applied. The credentials Path component prefixes with a '/' if one is not detected in the string already. That credentials code is likely used in many places, so I believe that changing that behavior would be much worse than requiring users to make this minor adaptation.

          Code changed in jenkins
          User: juan francisco sanchez
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java
          http://jenkins-ci.org/commit/git-client-plugin/a865e011e91050bc074b319f656436c3b7d88c13
          Log:
          JENKINS-43022 - Honor git credential path exclusion and inclusion

          Tests scp URL form in GitURIRequirementsBuilderTest

          Adds assertions for path.getPath(), including incorrect relative scp path.

          Credentials PathRequirement incorrectly converts relative path to
          absolute path. Adapt the test to that error, since PathRequirement
          is likely used in many other cases where the prefixing of a '/' to the
          relative path is the expected and desired behavior.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: juan francisco sanchez Path: src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java http://jenkins-ci.org/commit/git-client-plugin/a865e011e91050bc074b319f656436c3b7d88c13 Log: JENKINS-43022 - Honor git credential path exclusion and inclusion Tests scp URL form in GitURIRequirementsBuilderTest Adds assertions for path.getPath(), including incorrect relative scp path. Credentials PathRequirement incorrectly converts relative path to absolute path. Adapt the test to that error, since PathRequirement is likely used in many other cases where the prefixing of a '/' to the relative path is the expected and desired behavior.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java
          src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java
          http://jenkins-ci.org/commit/git-client-plugin/3ba074ccee0e9677e1f0431349c3e069206675dc
          Log:
          Merge pull request #249 from MarkEWaite/master-PR242-credentials-exclude-path

          JENKINS-43022 - Honor git credential path exclusion and inclusion

          Compare: https://github.com/jenkinsci/git-client-plugin/compare/eef4e1d17fef...3ba074ccee0e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java http://jenkins-ci.org/commit/git-client-plugin/3ba074ccee0e9677e1f0431349c3e069206675dc Log: Merge pull request #249 from MarkEWaite/master-PR242-credentials-exclude-path JENKINS-43022 - Honor git credential path exclusion and inclusion Compare: https://github.com/jenkinsci/git-client-plugin/compare/eef4e1d17fef...3ba074ccee0e

          Mark Waite added a comment - - edited

          Will be included in the next release of the git client plugin. A pre-release build is available from the last stable build of the git client plugin

          Mark Waite added a comment - - edited Will be included in the next release of the git client plugin. A pre-release build is available from the last stable build of the git client plugin

          Thanks markewaite , sorry to solvent your detected issue. I've been overworked lately

          Thanks man!!

          juan francisco sanchez ramos added a comment - Thanks markewaite , sorry to solvent your detected issue. I've been overworked lately Thanks man!!

          Mark Waite added a comment -

          Git client plugin 2.5.0 released 27 Jul 2017 includes this fix

          Mark Waite added a comment - Git client plugin 2.5.0 released 27 Jul 2017 includes this fix

            markewaite Mark Waite
            jsanchra juan francisco sanchez ramos
            Votes:
            15 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: