Skip to content

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

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

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.

@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.

@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
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [martinvonz/jj](https://github.com/martinvonz/jj) | minor | `v0.26.0` -> `v0.27.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>martinvonz/jj (martinvonz/jj)</summary>

### [`v0.27.0`](https://github.com/jj-vcs/jj/releases/tag/v0.27.0)

[Compare Source](jj-vcs/jj@v0.26.0...v0.27.0)

##### About

jj is a Git-compatible version control system that is both simple and powerful. See the [installation instructions](https://jj-vcs.github.io/jj/v0.27.0/install-and-setup/) to get started.

##### Release highlights

-   `git.subprocess` is now enabled by default, improving compatibility with Git
    fetches and pushes by spawning an external `git` process. Users can opt out
    of this by setting `git.subprocess = false`, but this will likely be removed
    in a future release. Please report any issues you run into.

##### Breaking changes

-   Bookmark name to be created/updated is now parsed as [a revset
    symbol](docs/revsets.md#symbols). Quotation may be needed in addition to shell
    quotes. Example: `jj bookmark create -r@- "'name with space'"`

-   `jj bookmark create`, `jj bookmark set` and `jj bookmark move` onto a hidden
    commit make it visible.

-   `jj bookmark forget` now untracks any corresponding remote bookmarks instead
    of forgetting them, since forgetting a remote bookmark can be unintuitive.
    The old behavior is still available with the new `--include-remotes` flag.

-   `jj fix` now always sets the working directory of invoked tools to be the
    workspace root, instead of the working directory of the `jj fix`.

-   The `ui.allow-filesets` configuration option has been removed.
    [The "fileset" language](docs/filesets.md) has been enabled by default since v0.20.

-   `templates.annotate_commit_summary` is renamed to `templates.file_annotate`,
    and now has an implicit `self` parameter of type `AnnotationLine`, instead of
    `Commit`. All methods on `Commit` can be accessed with `commit.method()`, or
    `self.commit().method()`.

##### Deprecations

-   This release takes the first steps to make target revision required in
    `bookmark create`, `bookmark move` and `bookmark set`. Those commands will display
    a warning if the user does not specify target revision  explicitly. In the near
    future those commands will fail if target revision is not specified.

-   The `signing.sign-all` config option has been deprecated in favor of
    `signing.behavior`. The new option accepts `drop` (never sign), `keep` (preserve
    existing signatures), `own` (sign own commits), or `force` (sign all commits).
    Existing `signing.sign-all = true` translates to `signing.behavior = "own"`, and
    `false` translates to `"keep"`. Invalid configuration is now an error.

##### New features

-   The new `jj sign` and `jj unsign` commands allow for signing/unsigning commits.
    `jj sign` supports configuring the default revset through `revsets.sign` when
    no `--revisions` arguments are provided.

-   `jj git fetch` now supports [string pattern syntax](docs/revsets.md#string-patterns)
    on `--remote` option and `git.fetch` configuration.

-   Template functions `truncate_start()` and `truncate_end()` gained an optional
    `ellipsis` parameter; passing this prepends or appends the ellipsis to the
    content if it is truncated to fit the maximum width.

-   Templates now support `stringify(x)` function and string method
    `.escape_json()`. The latter serializes the string in JSON format. It is
    useful for making machine-readable templates by escaping problematic
    characters like `\n`.

-   Templates now support `trim()`, `trim_start()` and `trim_end()` methods
    which remove whitespace from the start and end of a `String` type.

-   The description of commits backed out by `jj backout` can now be configured
    using `templates.backout_description`.

-   New `AnnotationLine` templater type. Used in `templates.file_annotate`.
    Provides `self.commit()`, `.content()`, `.line_number()`, and
    `.first_line_in_hunk()`.

-   Templates now have `format_short_operation_id(id)` function for users to
    customize the default operation id representation.

-   The `jj init`/`jj revert` stubs that print errors can now be overridden with
    aliases. All of `jj clone/init/revert` add a hint to a generic error.

-   Help text is now colored (when stdout is a terminal).

-   Commands that used to suggest `--ignore-immutable` now print the number of
    immutable commits that would be rewritten if used and a link to the docs.

-   `jj undo` now shows a hint when undoing an undo operation that the user may
    be looking for `jj op restore` instead.

##### Fixed bugs

-   `jj status` now shows untracked files under untracked directories.
    [#&#8203;5389](jj-vcs/jj#5389)

-   Added workaround for the bug that untracked files are ignored when watchman is
    enabled. [#&#8203;5728](jj-vcs/jj#5728)

-   The `signing.backends.ssh.allowed-signers` configuration option will now
    expand `~/` to `$HOME/`.
    [#&#8203;5626](jj-vcs/jj#5626)

-   `config-schema.json` now allows arrays of strings for the settings `ui.editor`
    and `ui.diff.tool`.

-   `config-schema.json` now allows an array of strings or nested table for the
    `ui.pager` setting.

##### Contributors

Thanks to the people who made this release happen!

-   Alain Leufroy ([@&#8203;aleufroy](https://github.com/aleufroy))
-   Aleksey Kuznetsov ([@&#8203;zummenix](https://github.com/zummenix))
-   Alexander Mikhailov ([@&#8203;AM5800](https://github.com/AM5800))
-   Andrew Gilbert ([@&#8203;andyg0808](https://github.com/andyg0808))
-   Antoine Martin ([@&#8203;alarsyo](https://github.com/alarsyo))
-   Anton Bulakh ([@&#8203;necauqua](https://github.com/necauqua))
-   Austin Seipp ([@&#8203;thoughtpolice](https://github.com/thoughtpolice))
-   Baltasar Dinis ([@&#8203;bsdinis](https://github.com/bsdinis))
-   Benjamin Tan ([@&#8203;bnjmnt4n](https://github.com/bnjmnt4n))
-   Bryce Berger ([@&#8203;bryceberger](https://github.com/bryceberger))
-   Burak Varlı ([@&#8203;unexge](https://github.com/unexge))
-   David Rieber ([@&#8203;drieber](https://github.com/drieber))
-   Emily ([@&#8203;emilazy](https://github.com/emilazy))
-   Evan Mesterhazy ([@&#8203;emesterhazy](https://github.com/emesterhazy))
-   George Christou ([@&#8203;gechr](https://github.com/gechr))
-   HKalbasi ([@&#8203;HKalbasi](https://github.com/HKalbasi))
-   Ilya Grigoriev ([@&#8203;ilyagr](https://github.com/ilyagr))
-   Jacob Hayes ([@&#8203;JacobHayes](https://github.com/JacobHayes))
-   Jonathan Frere ([@&#8203;MrJohz](https://github.com/MrJohz))
-   Jonathan Tan ([@&#8203;jonathantanmy](https://github.com/jonathantanmy))
-   Josh Steadmon ([@&#8203;steadmon](https://github.com/steadmon))
-   maan2003 ([@&#8203;maan2003](https://github.com/maan2003))
-   Martin von Zweigbergk ([@&#8203;martinvonz](https://github.com/martinvonz))
-   Matthew Davidson ([@&#8203;KingMob](https://github.com/KingMob))
-   Philip Metzger ([@&#8203;PhilipMetzger](https://github.com/PhilipMetzger))
-   Philipp Albrecht ([@&#8203;pylbrecht](https://github.com/pylbrecht))
-   Roman Timushev ([@&#8203;rtimush](https://github.com/rtimush))
-   Samuel Tardieu ([@&#8203;samueltardieu](https://github.com/samueltardieu))
-   Scott Taylor ([@&#8203;scott2000](https://github.com/scott2000))
-   Stephan Hügel ([@&#8203;urschrei](https://github.com/urschrei))
-   Vincent Ging Ho Yim ([@&#8203;cenviity](https://github.com/cenviity))
-   Yuya Nishihara ([@&#8203;yuja](https://github.com/yuja))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODguMyIsInVwZGF0ZWRJblZlciI6IjM5LjE4OC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 10, 2025
## [0.27.0] - 2025-03-05

### Release highlights

* `git.subprocess` is now enabled by default, improving compatibility with Git
  fetches and pushes by spawning an external `git` process. Users can opt out
  of this by setting `git.subprocess = false`, but this will likely be removed
  in a future release. Please report any issues you run into.

### Breaking changes

* Bookmark name to be created/updated is now parsed as [a revset
  symbol](docs/revsets.md#symbols). Quotation may be needed in addition to shell
  quotes. Example: `jj bookmark create -r@- "'name with space'"`

* `jj bookmark create`, `jj bookmark set` and `jj bookmark move` onto a hidden
   commit make it visible.

* `jj bookmark forget` now untracks any corresponding remote bookmarks instead
  of forgetting them, since forgetting a remote bookmark can be unintuitive.
  The old behavior is still available with the new `--include-remotes` flag.

* `jj fix` now always sets the working directory of invoked tools to be the
  workspace root, instead of the working directory of the `jj fix`.

* The `ui.allow-filesets` configuration option has been removed.
  [The "fileset" language](docs/filesets.md) has been enabled by default since v0.20.

* `templates.annotate_commit_summary` is renamed to `templates.file_annotate`,
  and now has an implicit `self` parameter of type `AnnotationLine`, instead of
  `Commit`. All methods on `Commit` can be accessed with `commit.method()`, or
  `self.commit().method()`.

### Deprecations

* This release takes the first steps to make target revision required in
  `bookmark create`, `bookmark move` and `bookmark set`. Those commands will display
  a warning if the user does not specify target revision  explicitly. In the near
  future those commands will fail if target revision is not specified.

* The `signing.sign-all` config option has been deprecated in favor of
  `signing.behavior`. The new option accepts `drop` (never sign), `keep` (preserve
  existing signatures), `own` (sign own commits), or `force` (sign all commits).
  Existing `signing.sign-all = true` translates to `signing.behavior = "own"`, and
  `false` translates to `"keep"`. Invalid configuration is now an error.

### New features

* The new `jj sign` and `jj unsign` commands allow for signing/unsigning commits.
  `jj sign` supports configuring the default revset through `revsets.sign` when
  no `--revisions` arguments are provided.

* `jj git fetch` now supports [string pattern syntax](docs/revsets.md#string-patterns)
  on `--remote` option and `git.fetch` configuration.

* Template functions `truncate_start()` and `truncate_end()` gained an optional
  `ellipsis` parameter; passing this prepends or appends the ellipsis to the
  content if it is truncated to fit the maximum width.

* Templates now support `stringify(x)` function and string method
  `.escape_json()`. The latter serializes the string in JSON format. It is
  useful for making machine-readable templates by escaping problematic
  characters like `\n`.

* Templates now support `trim()`, `trim_start()` and `trim_end()` methods
  which remove whitespace from the start and end of a `String` type.

* The description of commits backed out by `jj backout` can now be configured
  using `templates.backout_description`.

* New `AnnotationLine` templater type. Used in `templates.file_annotate`.
  Provides `self.commit()`, `.content()`, `.line_number()`, and
  `.first_line_in_hunk()`.

* Templates now have `format_short_operation_id(id)` function for users to
  customize the default operation id representation.

* The `jj init`/`jj revert` stubs that print errors can now be overridden with
  aliases. All of `jj clone/init/revert` add a hint to a generic error.

* Help text is now colored (when stdout is a terminal).

* Commands that used to suggest `--ignore-immutable` now print the number of
  immutable commits that would be rewritten if used and a link to the docs.

* `jj undo` now shows a hint when undoing an undo operation that the user may
   be looking for `jj op restore` instead.

### Fixed bugs

* `jj status` now shows untracked files under untracked directories.
  [#5389](jj-vcs/jj#5389)

* Added workaround for the bug that untracked files are ignored when watchman is
  enabled. [#5728](jj-vcs/jj#5728)

* The `signing.backends.ssh.allowed-signers` configuration option will now
  expand `~/` to `$HOME/`.
  [#5626](jj-vcs/jj#5626)

* `config-schema.json` now allows arrays of strings for the settings `ui.editor`
  and `ui.diff.tool`.

* `config-schema.json` now allows an array of strings or nested table for the
  `ui.pager` setting.
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