Skip to content

Commit a368d8f

Browse files
christian-schillingLMG
authored andcommitted
Make --require-auth only apply to push
This enables anonymous read access if even if the flag is present. Change-Id: push-auth
1 parent 037fe41 commit a368d8f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

josh-proxy/src/bin/josh-proxy.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,13 @@ async fn call_service(
490490
headref = "HEAD".to_string();
491491
}
492492

493-
if !josh_proxy::auth::check_auth(&remote_url, &auth, ARGS.is_present("require-auth"))
494-
.in_current_span()
495-
.await?
493+
if !josh_proxy::auth::check_auth(
494+
&remote_url,
495+
&auth,
496+
ARGS.is_present("require-auth") && parsed_url.pathinfo == "/git-receive-pack",
497+
)
498+
.in_current_span()
499+
.await?
496500
{
497501
tracing::trace!("require-auth");
498502
let builder = Response::builder()

0 commit comments

Comments
 (0)