radicle/sigrefs: Implement feature detection

To be able to reason about backwards compatibility, downgrade attacks,
and future configurable enforcement of minimum required (security)
features, introduce the concept of a "feature level" in Signed
References.

In this implementation feature levels are assumed to be monotonic, i.e.,
that higher feature levels behave like lower ones, and only add
semantics on top.

Implementing this as an `enum` that is `Ord` flows nicely.

Treatment of the write-side is left for the next commit. Currently,
the write side "promises" `FeatureLevel::Parent`, but is not able
to "keep the promise", since it does not actually inspect the
feature level of the head in case it is unchanged.

CHANGELOG
This commit is contained in:
Lorenz Leutgeb
2026-03-24 14:40:42 +00:00
committed by Fintan Halpenny
parent 9a4539fe82
commit 372a78754a
17 changed files with 507 additions and 151 deletions
+12 -1
View File
@@ -7,11 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## Fixed Bugs
## New Features
- Fix the signed references reading process by correctly choosing the first,
non-replayed commit. This only occurs if duplicate signatures are found and
the process needs to find the first legitimate commit of the namespace.
- Signed references now implement feature detection. The features are marked as
`none`, `root`, and `parent`. If the signed references are marked as `none`
this implies that they only contain `/refs` and `/signature` with no
`refs/rad/root` entry nor `refs/rad/sigrefs-parent`. The next feature is
`root`, which implies `none`, but includes `refs/rad/root`. Finally, `parent`
implies `root`, but includes `refs/rad/sigrefs-parent`.
This means that feature levels are monotonically increasing. This allows the
signed references processes to detect downgrades, preventing downgrade
attacks.
Note that this means that a node which upgrades, and subsequently downgrades
will appear as a downgrade attacker.
## 1.7.1