upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-08-15 15:17:39 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-08-15 15:53:59 +0100
commit28a37393ee62e3b53dad69d58810f72151bd58c2 (patch)
tree834224a4b2c3965878a03fd7ffc5fcccc223918e /src/bin
parentb7f48324a02093d0214b6788e8d7005569a08145 (diff)
feat(remote): list proposals as `refs/pr-by-id/*`
This branch name cannot be attacked by brute forcing a shorthand event id like refs/pr/<branch-name(<shorthand-event-id) can.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/git_remote_nostr/list.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs
index 137c13f..f5eaee4 100644
--- a/src/bin/git_remote_nostr/list.rs
+++ b/src/bin/git_remote_nostr/list.rs
@@ -86,7 +86,7 @@ pub async fn run_list(
86 ); 86 );
87 87
88 state.extend( 88 state.extend(
89 // get as refs/pr/<branch-name>(<shorthand-event-id>) 89 // get as refs/pr/<branch-name>(<shorthand-event-id>) and refs/pr-by-id/<event-id>
90 get_all_proposals_state(git_repo, repo_ref).await?, 90 get_all_proposals_state(git_repo, repo_ref).await?,
91 ); 91 );
92 92
@@ -248,11 +248,13 @@ async fn get_all_proposals_state(
248 { 248 {
249 if let Ok(tip) = tag_value(pr_or_pr_update, "c") { 249 if let Ok(tip) = tag_value(pr_or_pr_update, "c") {
250 state.insert(format!("refs/{branch_name}"), tip.clone()); 250 state.insert(format!("refs/{branch_name}"), tip.clone());
251 state.insert(format!("refs/pr-by-id/{}", proposal.id), tip);
251 } 252 }
252 } else if let Ok(tip) = 253 } else if let Ok(tip) =
253 make_commits_for_proposal(git_repo, repo_ref, &events_to_apply) 254 make_commits_for_proposal(git_repo, repo_ref, &events_to_apply)
254 { 255 {
255 state.insert(format!("refs/{branch_name}"), tip.clone()); 256 state.insert(format!("refs/{branch_name}"), tip.clone());
257 state.insert(format!("refs/pr-by-id/{}", proposal.id), tip);
256 } 258 }
257 } 259 }
258 } 260 }