Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit signing backend implementation #3007

Merged
merged 7 commits into from
Feb 20, 2024

Conversation

julienvincent
Copy link
Contributor

@julienvincent julienvincent commented Feb 9, 2024

This is an expansion on the work that was started by @necauqua in #2728 with the intent of getting the core implementation ready to land.

This involved some small behavioural tweaks such as adding config to control whether or not commit signatures are verified and displayed by default. This also involved a lot of massaging to get the test suite green again.

One significant addition to the original work is the addition of an SSH signing backend which works as closely as possible to the git SSH signing workflow.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@julienvincent julienvincent marked this pull request as draft February 9, 2024 23:24
@julienvincent julienvincent changed the title Jv/signing backend Commit signing backend implementation Feb 9, 2024
@julienvincent julienvincent force-pushed the jv/signing-backend branch 2 times, most recently from 77921f6 to c05e6a1 Compare February 9, 2024 23:57
@julienvincent julienvincent force-pushed the jv/signing-backend branch 15 times, most recently from 95f1361 to 4627b2a Compare February 12, 2024 23:34
@julienvincent
Copy link
Contributor Author

Wow it was an absolute nightmare to get the tests passing on Windows. I even have access to a windows machine and this was like pulling teeth.

So glad that's actually working now.

Surely nix can't be as bad. Right?

@julienvincent julienvincent force-pushed the jv/signing-backend branch 5 times, most recently from bbe63c3 to c9b720f Compare February 13, 2024 23:39
@julienvincent julienvincent marked this pull request as ready for review February 13, 2024 23:39
@julienvincent
Copy link
Contributor Author

@martinvonz I think this PR should be ready for an initial review. I've managed to get all the tests passing and it seems to function well in my personal use of it.

Would be great if I can get some eyes on it to see if I am missing anything or any changes are still required.

Let me know!

@julienvincent julienvincent force-pushed the jv/signing-backend branch 2 times, most recently from fda7fb1 to b09d5ae Compare February 19, 2024 14:25
@julienvincent
Copy link
Contributor Author

Ok, everything addressed! Let me know if you need anything more from me.

lib/src/ssh_signing.rs Outdated Show resolved Hide resolved
@julienvincent
Copy link
Contributor Author

Anything needed to merge this? I'm not sure what the process is

@martinvonz
Copy link
Member

Anything needed to merge this? I'm not sure what the process is

Once it's approved and you haven't made any non-trivial changes since the last round of reviews, feel free to merge. Thank for all your work on this! And thanks again to @necauqua too!

@julienvincent
Copy link
Contributor Author

Ok but I don't have permission to merge. Does someone else need to do it?

@martinvonz
Copy link
Member

Ok but I don't have permission to merge. Does someone else need to do it?

Oops, sorry! Now you do (once you accept the invite).

@julienvincent
Copy link
Contributor Author

Oh! Ok awesome. I will merge this now :)

Thank for all your work on this!
You are most welcome!

Thanks for all the help getting this ready.

@julienvincent julienvincent merged commit 84685a4 into jj-vcs:main Feb 20, 2024
15 checks passed
@julienvincent julienvincent deleted the jv/signing-backend branch February 20, 2024 00:02
@martinvonz
Copy link
Member

Thanks for all the help getting this ready.

Yes, thanks, @yuja! :)

@emesterhazy
Copy link
Contributor

FYI, this adds a dev dependency on gpg. The tests are failing for me locally since I don't have it installed. Might be worth documenting this somewhere if it isn't already (I didn't see it anywhere).

@julienvincent
Copy link
Contributor Author

FYI any future readers - this was also noted here #3096 and will be addressed hopefully later today in #3100.

Self::new(
config
.get_string("signing.backends.gpg.program")
.unwrap_or_else(|_| "gpg2".into())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@necauqua maybe the default should be "gpg"?
(just spotted because the test uses "gpg" not "gpg2")

Copy link
Contributor

@necauqua necauqua Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the gpg2 command is the one that requires the agent to work?.
(and also gpg 2.x)
So that agent use is enforced since we sign every snapshot and whatnot

Anyway I don't remember there being any other reasons, so could be gpg, yes, maybe I forgot to get back to think about this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, it's historical thing? I don't have gpg2 in my Debian unstable environment, and gpg --version says it's 2.x.
https://packages.debian.org/bookworm/gnupg2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't?.
I thought it was a symlink that every gpg 2.x also installs or something
I have it on NixOS
Yes it is a historical thing afaiu

Anyway I've no objections to changing the default to just gpg
Any unusual or historical setups could change the config value anyway

data,
&[
"--status-fd=1".as_ref(),
"--verify".as_ref(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuja but then here we'd also need to not forget to add --keyid-format=long which is the default in gpg2
(I just noticed that reading a commit message where they added that very argument to gpg call in git; I think I have it in my personal gpg config set to be the default too)

yuja added a commit to yuja/jj that referenced this pull request Feb 21, 2024
yuja added a commit that referenced this pull request Feb 21, 2024
This was referenced Feb 25, 2024
@jabielecki
Copy link

Implements #58, if I'm not mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants