Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: josh-project/josh
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: tvlfyi/josh
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Apr 24, 2022

  1. josh-proxy: Always require authentication when pushing

    This supports the use-case where josh serves a public repo without
    auth, but requires auth for pushing back.
    tazjin committed Apr 24, 2022
    Copy the full SHA
    f0cb4bc View commit details
Showing with 4 additions and 3 deletions.
  1. +2 −2 josh-proxy/src/auth.rs
  2. +2 −1 josh-proxy/src/bin/josh-proxy.rs
4 changes: 2 additions & 2 deletions josh-proxy/src/auth.rs
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ impl Handle {
}
}

pub async fn check_auth(url: &str, auth: &Handle, required: bool) -> josh::JoshResult<bool> {
if required && auth.hash.is_empty() {
pub async fn check_auth(url: &str, pathinfo: &str, auth: &Handle, required: bool) -> josh::JoshResult<bool> {
if auth.hash.is_empty() && (required || pathinfo == "/git-receive-pack") {
return Ok(false);
}

3 changes: 2 additions & 1 deletion josh-proxy/src/bin/josh-proxy.rs
Original file line number Diff line number Diff line change
@@ -467,7 +467,8 @@ async fn call_service(
headref = "HEAD".to_string();
}

if !josh_proxy::auth::check_auth(&remote_url, &auth, ARGS.is_present("require-auth"))
if !josh_proxy::auth::check_auth(&remote_url, &parsed_url.pathinfo, &auth, ARGS.is_present("require-auth"))

.in_current_span()
.await?
{