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

sign: Support ~/ path expansion for allowed-signers #5626

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

JacobHayes
Copy link
Contributor

@JacobHayes JacobHayes commented Feb 9, 2025

I'm very new to rust so not sure this is the best approach - happy to hear any suggestions. I'll add tests and a changelog entry in a bit.

Fixes #5625

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

Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

Thanks.

lib/src/ssh_signing.rs Outdated Show resolved Hide resolved
@JacobHayes JacobHayes force-pushed the push-rutusswxmvlr branch 3 times, most recently from c5f3b97 to 8f34423 Compare February 10, 2025 05:47
@JacobHayes
Copy link
Contributor Author

Is it worth adding a test for this? A couple things I noticed:

  • I don't see a similar test for the existing ~/ expansion in signing.key
  • none of the current ssh signing tests create a UserSetting, so will need a bit of extra scaffolding since we only added the logic to .from_settings
  • to avoid std::env::set_var (which seems understandably rare in the test suite) for HOME, it might be easiest to just check that allowed_signers does not start with ~/ after expansion

Happy to dig in if you think it's worth it, but figured I'd check first.

Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

Is it worth adding a test for this?

I would say no. It's nice to have some e2e tests for SSH signing, but we'll need to write a fake-ssh-keygen stub or something.

CHANGELOG.md Outdated Show resolved Hide resolved
@JacobHayes JacobHayes enabled auto-merge February 10, 2025 09:53
@JacobHayes JacobHayes added this pull request to the merge queue Feb 10, 2025
Merged via the queue into jj-vcs:main with commit 6aefb58 Feb 10, 2025
41 checks passed
@JacobHayes JacobHayes deleted the push-rutusswxmvlr branch February 10, 2025 10:20
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.

signing.backends.ssh.allowed-signers doesn't support ~ expansion (as signing.key does)
2 participants