CommonWealthRobotics / BowlerStudio

A Full-Stack Robotics Development Environment
GNU Lesser General Public License v3.0
136 stars 29 forks source link

org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner at line 162 #73

Open Octogonapus opened 4 years ago

Octogonapus commented 4 years ago

Auto Reported Issue OS = Linux amd64 x64

org.eclipse.jgit.api.errors.JGitInternalException: missing credentials provider
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.sign(BouncyCastleGpgSigner.java:162)
    at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:275)
    at com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine.commit(ScriptingEngine.java:486)
    at com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine.pushCodeToGit(ScriptingEngine.java:519)
    at com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine.pushCodeToGit(ScriptingEngine.java:436)
    at com.neuronrobotics.bowlerstudio.assets.ConfigurationDatabase.save(ConfigurationDatabase.java:68)
    at com.neuronrobotics.bowlerstudio.BowlerStudioMenuWorkspace.lambda$sort$3(BowlerStudioMenuWorkspace.java:173)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.bouncycastle.openpgp.PGPException: missing credentials provider
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyPassphrasePrompt.getPassphrase(BouncyCastleGpgKeyPassphrasePrompt.java:120)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKeyForKeyBoxPublicKey(BouncyCastleGpgKeyLocator.java:471)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKey(BouncyCastleGpgKeyLocator.java:368)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.locateSigningKey(BouncyCastleGpgSigner.java:124)
    at org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.sign(BouncyCastleGpgSigner.java:133)
    ... 7 more
madhephaestus commented 4 years ago

This looks like it tried to save without a valid login. Logout and log back in then close bowler studio to see if the issue is resolved.

Octogonapus commented 4 years ago

That did not fix it. Here is a log: https://pastebin.com/yr5E8xMh

Here are the actions I took in order:

  1. Open BS (and download the new version)
  2. After BS was done loading, log out
  3. Log in
  4. Close BS
  5. Open BS (looks like I got logged in properly?)
  6. Close BS
madhephaestus commented 4 years ago

This has something to do with where your store your gpg keys. Have you set up anything non-standard with these?

madhephaestus commented 4 years ago

I believe you are having this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=552091

Octogonapus commented 4 years ago

I do have gpgsign set to true. Something is weird because this isn't a problem on my other machine.

madhephaestus commented 4 years ago

Is there anything special about the filenames or paths on this machine? Does turning that signing off resolve the issue?

Octogonapus commented 4 years ago

Is there anything special about the filenames or paths on this machine?

No, it's a very recent 18.04 install.

Does turning that signing off resolve the issue?

Yes. What changed in the recent releases to break this?

madhephaestus commented 4 years ago

How recent? If it is since i added 2fa, then that makes sense. Also, i updataded the JGIT version to enable SSH cloning/pushing. Ill bet thats the difference, jgit now supports ssh, but is interfering with this somehow...

madhephaestus commented 4 years ago

https://github.com/CommonWealthRobotics/BowlerStudio/tree/0.36.0 is where the updated JGIT dep showed up.

madhephaestus commented 4 years ago

Specifically this commit:

https://github.com/CommonWealthRobotics/bowler-script-kernel/commit/f9ed927bffaab65c595c7bab13cc3d8cbe728bba

madhephaestus commented 4 years ago

To resolve there may need to be additional logic added to the ssh callback:

https://github.com/CommonWealthRobotics/bowler-script-kernel/blob/f9ed927bffaab65c595c7bab13cc3d8cbe728bba/src/main/java/com/neuronrobotics/bowlerstudio/scripting/SshTransportConfigCallback.java

Or perhaps this is an issue inherent to the newer JGIT library. Its hard to fix when i cant reproduce the error.

Octogonapus commented 4 years ago

You can't reproduce it even if you run git config --global commit.gpgsign true?

madhephaestus commented 4 years ago

Can you set the global to false and the repos that need signing to true?

Octogonapus commented 4 years ago

Technically, yes. But I want to sign all my commits.

Can you reproduce it?

Octogonapus commented 4 years ago

I bisected the versions I had on disk by hand. These are the results: 1.0.7 bad 1.0.6 bad 1.0.5 good 1.0.4 good

So 1.0.6 introduced something that broke it.

madhephaestus commented 4 years ago

are any other commits working for you? Is the issue just with configurations database?

The issue is in the kernel, and the only changes are to the logic of the configurations database, and some data sanitization on the incoming URL's. Do you see any reason this sanitization would be an issue?


    while(remoteURI.endsWith("/"))
        remoteURI=remoteURI.substring(0, remoteURI.length()-2);
    if(!remoteURI.endsWith(".git"))
        remoteURI=remoteURI+".git";
Octogonapus commented 4 years ago

remoteURI.substring(0, remoteURI.length()-2); is suspicious because you cut off an extra character. Can you cut me a build with those additions commented out and something that prints remoteURI?

madhephaestus commented 4 years ago

try rev 1.0.8 and let me know if it worked?

Octogonapus commented 4 years ago

BS auto-reported https://github.com/CommonWealthRobotics/BowlerStudio/issues/81 when I ran 1.0.8. Log: https://pastebin.com/nYBLFCB6

madhephaestus commented 4 years ago

BS auto-reported #81 when I ran 1.0.8. Log: https://pastebin.com/nYBLFCB6

This was a different mistake, resolved now.

Octogonapus commented 4 years ago

Yep. Same BouncyCastleGpgSigner issue, though.

madhephaestus commented 4 years ago

Kernel version was 0.50.2 in version 1.0.5 and was 0.51.0 in version 1.0.6. I don't see anything in there to affect the signing.

Octogonapus commented 4 years ago

Whatever the root cause may be, we can provide a workaround for now so I can still sign my commits by default. When BS clones a repo, it should run jgit's equivalent of git config commit.gpgsign false so the global-level commit signing is turned off.

Octogonapus commented 4 years ago

@madhephaestus Bumping this one :)

Octogonapus commented 4 years ago

Using this https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

You may be able to set the boolean commit.gpgsign to false for each repo that BS clones