Commit Graph

2915 Commits

Author SHA1 Message Date
Adrian Duke b5e8776efd fetch: Improve `refs/rad/id` resolution
The previous resolution would favour one `Oid` over another, due to
the call to `Option::or`.

This was found to result in scenarios where an identity document being
advertised was older than the identity document that the fetching node
already has, and would not fetch namespaces by newly added delegates.

The resolution logic is updated to handle all cases for these `Oid`s,
and when they are both present, uses a commit graph check to see which
one is the latest.

An e2e test is added to check ensure behaviour works correctly.
2026-02-16 21:39:11 +01:00
Fintan Halpenny 84320919e2 node/tests/e2e: use assert_eq! in test
The use of `assert_eq!` will highlight the differences in the two
values when it fails.
2026-02-16 17:13:39 +00:00
Fintan Halpenny 7862e108b6 Update gix-* crates
Fixes [CVE-2026-0810].

The `gix` crates require updating due to the security vulnerability above.
They require updating together in lock-step so both `radicle-fetch`
and `radicle-oid` are affected.

`radicle-oid` handles the non-exhaustive nature of `ObjectId`.

`radicle-fetch` updates to the new API types, however, this comes with
some updates to the `ls_refs` protocol.

A regression is documented in [gitoxide issue 2429].
The regression highlighted that it is the duty of the caller to also
filter the outcome of ls-refs, and `ref-prefix` is simply an
optimisation.

The ls-refs code is refactored to better represent and handle this operation.

[CVE-2026-0810]: https://www.cve.org/CVERecord?id=CVE-2026-0810
[gitoxide issue 2429]: https://github.com/GitoxideLabs/gitoxide/issues/2429
2026-02-16 17:13:39 +00:00
Fintan Halpenny 391571178e fetch: introduce domain type RefPrefix
Better represent the domain by introducing the `RefPrefix` type.
It captures the different `ref-prefix` values that can be used in the
`ls-refs` step of the protocol.

These are turned into their equivalent `ref-prefix` values using
`RefPrefix::into_bstring`.

This better connects the `ProtocolStage::ls_refs` method with the
`ls_refs::run` through the use of the `RefPrefix` type, rather than
any set of `BString` values.
2026-02-16 17:11:32 +00:00
Fintan Halpenny 8070f98a5b fetch/transport/ls_refs: Post-filter of references
The Git protocol specification states about `ls-refs`[^1]:

>    ref-prefix <prefix>
> When specified, only references having a prefix matching one of
> the provided prefixes are displayed. Multiple instances may be
> given, in which case references matching any prefix will be
> shown. Note that this is purely for optimization; a server MAY
> show refs not matching the prefix if it chooses, and clients
> should filter the result themselves.

The `ref-prefix` arguments should not be relied on and post-filtering
after the ls-refs invocation should also be performed.

[^1]: https://git-scm.com/docs/protocol-v2#_ls_refs
2026-02-16 17:10:40 +00:00
Fintan Halpenny 980ed56186 protocol/service: rename `Responder::new` to `Responder::oneshot`
The `Responder` is a oneshot channel where it sends one result and the
other side receives that result.

This surfaced that the `AnnounceRefs` command was returning one result
at a time. At the moment, this is only used for a single namespace,
the local user's.
2026-02-16 13:33:00 +01:00
Fintan Halpenny 0d628a45e2 protocol: refactor to use Responder
Refactors every command that uses a `Sender` to use a `Responder`
instead. There is an exception for `QueryState` since its usage
differs slightly to the other cases.

To make the usage more ergonomic, constructors for the variants that
require a `Responder` are added.
2026-02-16 13:33:00 +01:00
Fintan Halpenny b1eedd3b64 protocol/service: introduce Responder type
Introduce a `Responder` type that wraps a
`crossbeam_channel::Sender<Result<T>>`.

It provides a standard constructor and three sending methods: one for
a `Result`, one for an `Ok` value, and one for an `Err` value.
2026-02-16 13:25:58 +01:00
Fintan Halpenny 61a9b2140f protocol/service: introduce Result synonym
Create a type synonym for `Result<T, Error>`, to simplify result types
being returned by commands in a later change.
2026-02-16 13:25:58 +01:00
Fintan Halpenny 2c1972151d protocol: opaque command error
Refactor `CommandError` to be an opaque, boxed error.
Rename it to `Error`, so that it is imported via `command::Error`.
2026-02-16 13:25:58 +01:00
Fintan Halpenny 38713a8e62 protocol/service: drop `chan` qualifier
Small refactor to drop the `chan` qualifier and use `Sender` directly.
2026-02-16 13:25:58 +01:00
Fintan Halpenny 912a5ca42b protocol/service: create command module
Create a `command` module to house the command related types.
2026-02-16 13:25:58 +01:00
Lorenz Leutgeb fa94638abb radicle/storage/init: Remove placeholder files
These files contain stub texts (see added reference) and only clutter
storage.
2026-02-16 11:16:30 +00:00
Lorenz Leutgeb 7425ae4b49 ssh: Treat "connection refused" on Windows
Slightly relax the conditions under which an error is considered to
indicate that the SSH agent is not running, to accommodate differences
in the API of named pipes on Windows vs. Unix domain sockets.
2026-02-16 09:47:08 +00:00
Lorenz Leutgeb 5099c25df7 node/debug: Use derived serializers
The construction of the debug object is unwieldy, and error prone
(for example, renamed struct members have to be manually renamed
in the serialization code, see "refs" vs. "refsAt").

Use derived serializers where possible to make this easier to maintain.
2026-02-16 09:43:38 +00:00
Lorenz Leutgeb a1fa38018e protocol: Depend on `cypheraddr` not `cyphernet`
`radicle-protocol` depends on `cyphernet`, but only uses the module
`cyphernet::addr`, which is a re-export of `cypheraddr`, which is
unnecessary (as `cypheraddr` alone would do), and invites accidentally
pulling in more dependencies via `cyphernet`.

To prevent accidentally depending on further types from `cyphernet`,
change this to more conservativeley depend on `cypheraddr`.
2026-02-16 09:43:38 +00:00
Lorenz Leutgeb d530f1265e node/test: Remove unused file `environment.rs` 2026-02-16 09:38:37 +00:00
Lorenz Leutgeb 730d696d74 node/test: Bind to loopback interface 2026-02-16 09:38:37 +00:00
Lorenz Leutgeb dfe3b501c7 radicle/git/raw: `Config` not used on Windows
Fix a clippy lint that sneaked in…
2026-02-16 09:24:05 +00:00
Lorenz Leutgeb ed2b36cf9c cli-test: Log line of assertion being executed 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 9055a2043c cli-test: Add placeholder for executable extension
Help text generated by `clap` contains the full file name (including
extension) of the binary. On Unix-like systems, binaries commonly do not
have any file extension. On Windows, ".exe" is common.

To allow testing such output, introduce a new marker "[EXE]" that is 
substituted accordingly. The idea and syntax is taken from
https://docs.rs/trycmd/1.0.0/trycmd/#toml
2026-02-16 08:39:55 +00:00
Lorenz Leutgeb e831aeb57b cli-test: Do not store `bins` 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 8fbdd46ce4 cli-test: Cheat to find coreutils on Windows 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 4894657bcb cli-test: Simplify cargo path handling 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 25d1974c60 cli-test: Deduplicate populating `bins` 2026-02-16 08:39:55 +00:00
Lorenz Leutgeb 44f52f4c18 cli-test: Fix uses of `PATH_SEPARATOR`
Some occurrences of ":" literals were missed earlier.
2026-02-16 08:39:55 +00:00
Lorenz Leutgeb dd122f10cf cli/test: Ignore `rad_diff` on Windows
The command is deprecated already.
2026-02-16 08:37:20 +00:00
Lorenz Leutgeb 5974fa32d0 windows: Add installer build
For distribution of Radicle on Windows machines, Windows Installer
provides a well-known solution, that comes built in to the operating
system. It also integrates with the Windows package manager WinGet.

Provide an initial version of an `*.msi` build, and integrate it into
GitHub actions to allow downloads via build artifacts.
2026-02-16 08:33:58 +00:00
Fintan Halpenny c06b00e330 CVE-2026-25727
Report: <https://www.cve.org/CVERecord?id=CVE-2026-25727>

The `time` crate was a transitivie dependency of `human-panic`.
Updating `human-panic` to 2.0.6 removes the `plist`, and in turn,
`time` dependencies.
2026-02-13 19:08:26 +01:00
Fintan Halpenny 31607cf7ad CVE-2026-25541
Report: <https://www.cve.org/CVERecord?id=CVE-2026-25541>

This vulnerability was introduced via the `bytes` crate.

Update to 1.11.1, as recommended.
2026-02-13 19:07:39 +01:00
Fintan Halpenny 2d0db3c6b2 CVE-2025-58160
Report: <https://www.cve.org/CVERecord?id=CVE-2025-58160>

This vulnerability was introduced via the `test-log` crate.

Updating to `0.2.19` in turn updates `tracing-subscriber` to `0.3.22`
which is in the acceptable upgrade range.
2026-02-13 17:26:50 +00:00
Lorenz Leutgeb 03bbe52417 signals: Add support for Windows 2026-02-13 15:38:02 +00:00
Lorenz Leutgeb 865abd35e2
protocol/fetcher: Intro `RefsToFetch`
Using empty `Vec`s to mean "all refs" can be confusing. Avoid the chance
of confusion by introduction of a new type that clearly describes which
refs should be fetched.
2026-02-13 15:27:21 +01:00
Lorenz Leutgeb 9081c11b98
protocol/fetcher: Remove `from` from `QueuedFetch` 2026-02-13 15:25:42 +01:00
Lorenz Leutgeb 53a1286901
protocol/service: Remove unnecessary arg 2026-02-13 15:25:42 +01:00
Lorenz Leutgeb 94d7799ffe
protocol/fetcher/state: Typo 2026-02-13 15:25:42 +01:00
Lorenz Leutgeb 56ee626a51
protocol/fetcher: Delete unused file 2026-02-13 15:25:42 +01:00
Fintan Halpenny 41f77a495b RELEASE: start at rc.1 2026-02-13 13:34:11 +01:00
Fintan Halpenny 613c4e83e0 protocol: separate subscribers by RefsAt
It was found that if a fetch was started for a specific `Vec<RefsAt>`
and a following general, i.e. empty, `Vec<RefsAt>` was queued, the
subscriber for the general one would be removed when the specific
fetch completed.

This behaviour is undesirable, since the general fetch could
potentially fetch more data.

To prevent this from happening, the `Vec<RefsAt>` is added to the
`FetchKey`, so that `subscribers` are matched with the set of
references they want to hear results for.

A test was added for the above scenario.
2026-02-13 12:49:37 +01:00
Fintan Halpenny 993428df56 node: donwgrade log error to trace for disconnection
This is would be a very noisy error since disconnections should be
expected to happen frequently for nodes.

Downgrade the log level to trace.
2026-02-12 14:35:13 +00:00
Fintan Halpenny aeba81f4d9 core: add documentation to `RepoId::from_canonical` 2026-02-12 13:52:28 +01:00
Fintan Halpenny 35a01898e6 core: guard on expected multibase
When decoding an input string for a `RepoId`, the base was never checked.
This change ensures that the base is checked and will error otherwise.

To allow for future base codes, the change introduces a sanctioned set
of base codes, which only contains `Base58Btc` for now.

Tests are added to ensure that parsing is correct and includes a valid
multibase code 'Z', which is not the expected 'z'.
2026-02-12 13:52:28 +01:00
Fintan Halpenny 8ee32168b3 radicle: remove file
The `mod id` statement was removed, but the file was not removed.
Remove the file since it is no longer needed.
2026-02-12 13:52:28 +01:00
Lorenz Leutgeb ebf7d876b4
node: Control via `uds_windows` not `winpipe`
Recent versions of Windows support Unix Domain Sockets natively, see
<https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>.

By using that feature instead of Windows named pipes, the difference
for handling communication via the control socket comparing Unix-like
systems and Windows becomes smaller:

 1. No special paths like `\.\pipe\…` have to be handled.
 2. Not two I/O mechanisms are abstracted (named pipe and UDS) but
    just one.
 3. `winpipe` relies on background threads while `uds_windows` does
    not.

Once the feature `windows_unix_domain_sockets` (which is tracked at
https://github.com/rust-lang/rust/issues/150487) stabilizes, it will
likely be possible to just drop the dependency `uds_windows` and use
the implementation in `std::os::windows::net` directly.
2026-02-12 10:18:48 +01:00
Lorenz Leutgeb 90cf37c471
node: On Windows, use job for upload-pack child
Reports of zombie (grand)child processes were received. By associating
the `git upload-pack` process with a job, zombies are prevented.
2026-02-11 16:37:56 +01:00
Lorenz Leutgeb 990edbf055
windows: Introduce new crate
node: Use new windows crate to terminate job
2026-02-11 16:37:56 +01:00
Lorenz Leutgeb 50fb228ae4
term/editor: Implement `exists` for Windows
The paths checked by `fn exists` are well-known Unix locations, and not
meaningful to check on Windows.

Provide an implementation of `fn exists` for Windows, which uses
`which.exe` to look for binaries, and use that to provide sane defaults
for Windows.
2026-02-11 10:26:22 +01:00
Lorenz Leutgeb 450b664ad8
term/editor: Use `cfg`-attribute instead of macro
This might result in smaller binaries and is just as readable.
2026-02-11 10:26:22 +01:00
Lorenz Leutgeb 8fb2d96b5c
radicle/profile: No pager from Git on Windows
Git for Windows horribly mangles the configured binaries through a POSIX
`sh`-like environment even on Windows. We might be able to figure out
which `sh.exe` we would have to execute on Windows, but this is too
brittle. Windows users will have to use other mechanisms (like `$EDITOR`
and `$PAGER`) to configure their programs.
2026-02-11 10:26:22 +01:00
Lorenz Leutgeb 930ec175f1
term, cli: `winsplit` over `shlex` on Windows
Command line parsing differs on Windows vs. POSIX compliant operating
systems (just consider the differences in handling `\` for paths vs. as
a marker for escape sequences). Thus, on Windows use `winsplit` to
split command arguments instead of `shlex` for Unix-like OSes.

`winsplit` is a small crate with no other dependencies.
2026-02-11 10:26:22 +01:00