diff --git a/radicle-remote-helper/src/lib.rs b/radicle-remote-helper/src/lib.rs index bad32e61..15beb66d 100644 --- a/radicle-remote-helper/src/lib.rs +++ b/radicle-remote-helper/src/lib.rs @@ -25,6 +25,9 @@ pub enum Error { /// Public key doesn't match the remote namespace we're pushing to. #[error("public key `{0}` does not match remote namespace")] KeyMismatch(PublicKey), + /// No public key is given + #[error("no public key given as a remote namespace, perhaps you are attempting to push to restricted refs")] + NoKey, /// Invalid command received. #[error("invalid command `{0}`")] InvalidCommand(String), @@ -52,8 +55,6 @@ pub fn run(profile: radicle::Profile) -> Result<(), Box Result<(), Box { + if profile.public_key != namespace { + return Err(Error::KeyMismatch(profile.public_key).into()); + } + } + None => return Err(Error::NoKey.into()), } + let signer = profile.signer()?; Some(signer) @@ -101,7 +109,10 @@ pub fn run(profile: radicle::Profile) -> Result<(), Box