From 09bf648d4a36bc9ada0cff9438aa3b3f98631600 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 20 Aug 2024 12:32:26 +0100 Subject: fix:(remote): only maintainers can push and update / issue a state event. normal users can only push branches prefiex with pr/ and these go on nostr, not the git server. --- src/git_remote_helper.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/git_remote_helper.rs') diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 2019bd2..99eea78 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs @@ -655,6 +655,21 @@ async fn push( ) .await?; + if !repo_ref.maintainers.contains(&user_ref.public_key) { + for refspec in &git_server_refspecs { + let (_, to) = refspec_to_from_to(refspec).unwrap(); + println!( + "error {to} your nostr account {} isn't listed as a maintainer of the repo", + user_ref.metadata.name + ); + } + git_server_refspecs.clear(); + if proposal_refspecs.is_empty() { + println!(); + return Ok(()); + } + } + if !git_server_refspecs.is_empty() { let new_state = generate_updated_state(git_repo, &existing_state, &git_server_refspecs)?; -- cgit v1.2.3