Commit Graph

3126 Commits

Author SHA1 Message Date
Lorenz Leutgeb 6967bf8fca
radicle: Automatically upgrade sigrefs
When enumerating repositories in storage, gracefully handle the
case where the identity root is missing from sigrefs and automatically
migrate.
2026-03-17 21:31:42 +01:00
Lorenz Leutgeb 20598d39a0
radicle: Remove unused `SyncedAt::load`
This function is unused in heartwood and returns a `git2::Error`. Remove
it.
2026-03-17 21:31:42 +01:00
Lorenz Leutgeb 0f9eace839
crypto: Remove markers `Verified` and `Unverified`
These are now unused in heartwood.
2026-03-17 21:31:42 +01:00
Lorenz Leutgeb 304a66311a
radicle: Remove generics for verification markers
`SignedRefs` are now always verified.
2026-03-17 21:31:42 +01:00
Fintan Halpenny 393eca3976 node/e2e: `rad/sigrefs-parent` is not fetched
Introduce a test to ensure that the `SIGREFS_PARENT` reference is
never created during a fetch from another node.
2026-03-17 21:31:42 +01:00
Fintan Halpenny d40fa9a347 radicle/sigrefs: Switch to new implementation 2026-03-17 21:31:42 +01:00
Fintan Halpenny d3bc868e84 radicle/sigrefs: Rewrite Signed References
Split up signed references into its read and write components.

On the write side:
 - Preserve the old behavior of writing references to the blob `/refs`
   and sign over the blob.
 - Ensure `refs/rad/root` is contained in the `/refs` blob.
 - Ensure `refs/rad/sigrefs` is *not* contained in the `/refs` blob.
 - Introduce a new (internal) reference `refs/rad/sigrefs-parent`
   so that no two `/refs` blob are equal, even if they contain
   the same set of (non-internal) refs.

On the read side:
 - Preserve the verification of the signature in `/signature` and
   the reference `refs/rad/root` (if present).
 - Fail verification of `refs/rad/root` is not present.
 - Protect against replay attacks by walking the history of the
   head of `refs/rad/sigrefs`, skipping interpretation of `/refs`
   blobs in case they are identical to a previous `/refs` blob.
   This is achieved by searching for repeated contents of the
   `/signature` blob.

The reference `refs/rad/sigrefs-parent` is never read from or written to
the Git repository in storage.

The pre-existing implementation of signed references did not include
a nonce, thus duplicate but legitimate sets of references could not
be distinguished from maliciously replayed sets of references.

The new implementation uses `radicle-git-metadata` which is moved from
`dev-dependencies` to `dependencies`.
2026-03-17 21:31:42 +01:00
Lorenz Leutgeb 52a660fd3b
node/test: Set `RAD_RNG_SEED` 2026-03-17 19:17:03 +01:00
Matthias Beyer 99d9242122 Use humantime to parse timeouts
In issue

    29c6c6fc8171287faa0079798ba2d6e3e7fd86f3

was noted that it would be nice to use value parsers for the timeouts in
the CLI.

This patch implements this.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Co-Authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2026-03-17 11:39:09 +00:00
Defelo 52e5581228 cli: Don't override existing seeding scope in `rad seed` 2026-03-17 10:31:29 +00:00
Defelo 281f92e9ff cli/tests: Add test for `rad clone --scope` 2026-03-17 10:31:29 +00:00
justarandomgeek eea3617781 use `CONIN$` instead of `/dev/tty` on windows 2026-03-17 10:27:30 +00:00
Fintan Halpenny a1fd9e04fe radicle: Update `sqlite` to 0.37
The `concat` function is not present in version 0.32 of `sqlite`, since
it was introduced in 3.44[^0].
Update the `sqlite` to version 0.37, which brings in 3.45[^1], via
`sqlite3_sys`.

[^0]: https://sqlite.org/forum/forumpost/c14028be1b9c0e20de9e39d70706adc9f5a36bb5ccaad6db22f7d99633eafff8
[^1]: https://docs.rs/sqlite3-sys/0.18.0/sqlite3_sys/constant.SQLITE_VERSION.html
2026-03-17 10:19:40 +01:00
Lorenz Leutgeb 0736977170
node: Migrate IPv6 addresses in database
The format for IPv6 addresses was changed in
df8e4e6c88 to require '[' and ']'.

IPv6 addresses that were stored in the database in the past must be
migrated.
2026-03-16 23:12:58 +01:00
Fintan Halpenny 9e8f09a144 Remove stray files
These files were accidentally committed.
They were used for ensuring a refactor was performed correctly, and
are no longer needed.
2026-03-16 13:49:05 +00:00
Fintan Halpenny 0c47d06f2d radicle/storage/refs: Strengthen Encapsulation
`radicle::storage::Refs` carries a map from reference names to OIDs, and
there are some invariants.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb f4495e92bc
radicle/device: `impl Keypair for BoxedSigner`
Most consumers of `Device` are interested in the public key of the
device, and `Keypair` is the trait from `signature` which captures
this, so implement it.

Further, for boxing a signer, introduce a new trait `BoxableSigner`
(to remain dyn-compatible) which additionally requires `Keypair`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 74fa4425a1
crypto: Require `Signer: signature::Signer`
All implementations of `radicle_crypto::Signer` are also
`signature::Signer`. Also, the implementations of `Signer::sign` and
`Signer::try_sign` call each other.

To simplify, make `signature::Signer` a requirement for
`radicle_crypto::Signer`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 06fae85e67
crypto: `impl Signer` based on `Keypair`
Since all signers implement `signature::Keypair`, we can simplify the
implementations of `signature::Signer<ExtendedSignature>`. A blanket
implementation is not possible, because we do not control
`signature::Signer`.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb f2ad54542e
crypto: `impl signature::KeypairRef` for Signers
The various signers defined in `radicle-crypto` all allow borrowing
the corresponding public key a.k.a. "verifying key". This is captured
by implementing `signature::KeypairRef`, so implement it in addition
to `signature::Signer`.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 768ecf56ba crypto: Add `impl Verifier for PublicKey`
Add `impl Verifier<Signature> for PublicKey`, to allow using the popular
trait from the `signature` crate in verification codepaths.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 01c60388db git-metadata: Add parsing of `CommitData`
This change adds parsing of `CommitData` from raw bytes, i.e. `&[u8]`.
The intended use is to allow the `radicle-*` crates to be able to
parse raw commit data from any underlying Git implementation, such
as the `git2` and `gix` crates.

The tests are broken down into `success` cases, `error` cases, and
`unit` tests.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 58624148d4 git-metadata: Add `CommitData::strip_signatures`
To allow for the verification of a commit signature, the signature
needs to be stripped before converting the commit data to bytes.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 60871de89d git-metadata: Add derivable traits
Add more derivable traits to structs in `radicle-git-metadata` types to
make them easier to use.
2026-03-16 14:30:48 +01:00
Lorenz Leutgeb 0e45347b92
radicle/storage: Improve `Validation` error
`Validation::MismatchedRef` always happens in the context of a remote,
so have it carry the corresponding `RemoteId`.
2026-03-16 14:30:48 +01:00
Fintan Halpenny ba9c09facb radicle/refs: Better `SignedRefs` Encapsulation
Ensure that the public interface of signed references does not leak its
implementation details.

This allows the evolution of the interface in a safer manner, and does
not leak implementation details to the rest of the crate or any
dependents.
2026-03-16 14:30:48 +01:00
Fintan Halpenny 39a58ded05 node/test: Use `Arbitrary` for `SignedRefs`
Ensure the test code does not rely on `SignedRefs` construction, but
rather the `Arbitrary` construction.
2026-03-16 14:30:48 +01:00
Fintan Halpenny f7ff4d8f4e radicle/arbitrary: Move `impl Arbitrary` of refs
Avoid leaking the types of the signed reference types by moving their
`Arbitrary` implementations to a `refs::arbitrary` sub-module.

Since `SignedRefsAt` require a correctly signed payload, a helper
constructor is added: `signed_refs_at`.
In turn, a function, `arbitrary::with_gen` is introduced so that this
constructor can be easily called with a `Gen` value.
2026-03-16 14:30:48 +01:00
Fintan Halpenny b8502397a5 protocol/wire: Remove SignedRefs encoding/decoding
The implementations for `Encode` and `Decode` for `SignedRefs` existed
for when `SignedRefs` was communicated over the wire. This was traded
for communicating `RefsAt` instead. So, these can safely be removed.
2026-03-16 14:30:36 +01:00
Fintan Halpenny ba8d6b8864 radicle/storage: Remove unused Remote methods
Remove the methods and constructors, that are unused, from
`struct Remote`.
2026-03-13 16:19:10 +01:00
Lorenz Leutgeb e78d477bcf
radicle/git: Remove unused `fn remote_refs` 2026-03-13 16:19:10 +01:00
Fintan Halpenny 759a6fb982 radicle: Compile `rad::fork_remote` only for tests
The `rad::fork_remote` function is only used in tests.
2026-03-13 16:19:10 +01:00
Fintan Halpenny 7bac17146c CHANGELOG: fix typo
The command that changed is `rad node debug`, not `rad debug`.
2026-03-13 14:51:41 +01:00
Fintan Halpenny cb3ca6225f radicle/CHANGELOG: remove variant typo
The `typos` tool has no way of ignoring a particular typo in a particular file.
Reword the changelog entry so that it does not fire the hook.
2026-03-13 14:50:05 +01:00
Fintan Halpenny 9dbbb01dc6 radicle: remove `TryFrom` 2026-03-13 14:47:24 +01:00
Sebastian Martinez 57da779949 radicle: Add a `load` method to `radicle::profile::Home`
radicle: refactor `Home::load`

- Refactor out getting the subdirectories to ensure they are the same
across `new` and `load`
- Return all missing directories in the error message
- Document `load` and make it `pub`
2026-03-13 14:47:24 +01:00
Matthias Beyer ff85c74eaa cli: Add blank line after issue reply header
This patch adds a blank line to seperate the issue reply header from the
issue reply payload.

This makes visually parsing the output easier.

Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2026-03-12 13:30:09 +00:00
Fintan Halpenny 1b986af006 cli/tests: Refactor workflow test 2026-03-11 10:51:57 +00:00
Adrian Duke fa82bd5f76 cli/tests: Refactor watch command tests 2026-03-11 10:51:57 +00:00
Fintan Halpenny 45e6afd010 cli/tests: Refactor utility command tests
Place utility command tests in their own module.
These commands relate to inspection of state, such as: `rad self`,
`rad config`, `rad inspect`, etc.
2026-03-11 10:51:57 +00:00
Fintan Halpenny d282e0d0f8 cli/tests: Refactor sync command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 7d2842a458 cli/tests: Refactor remote command tests 2026-03-11 10:51:57 +00:00
Adrian Duke c1ab7c386e cli/tests: Refactor policy command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 18d7f99e33 cli/tests: Refactor patch command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 4ffabde605 cli/tests: Refactor node command tests 2026-03-11 10:51:57 +00:00
Adrian Duke b2568f0b47 cli/tests: Refactor jj command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 4753b889dc cli/tests: Refactor issue command tests 2026-03-11 10:51:57 +00:00
Adrian Duke 8bf655ef97 cli/tests: Refactor init command tests 2026-03-11 10:51:57 +00:00
Adrian Duke a1c1b03b66 cli/tests: Refactor inbox command tests 2026-03-11 10:51:57 +00:00
Adrian Duke cd4532ecd5 cli/tests: Refactor id command tests 2026-03-11 10:51:57 +00:00