git-HTTP: match Basic auth scheme case-insensitively (git sends lowercase)

e4d412b · gmorell · 2026-06-26 01:39

1 files +3 -1
Message
{commit_body(@commit)}

Files changed

modified lib/git_gud_web/plugs/git_smart_http.ex
+3 −1
@@ -228,7 +228,9 @@ defmodule GitGudWeb.Plugs.GitSmartHttp do
228 228 # The token is carried in the password field (the username is whatever
229 229 # the client sent — e.g. `x-access-token` — and is ignored for tokens).
230 230 defp authenticate(conn) do
231 with ["Basic " <> b64] <- get_req_header(conn, "authorization"),
231 + with [hdr | _] <- get_req_header(conn, "authorization"),
232 + [scheme, b64] <- String.split(hdr, " ", parts: 2),
233 + true <- String.downcase(scheme) == "basic",
232 234 {:ok, decoded} <- Base.decode64(b64),
233 235 [username, secret] <- String.split(decoded, ":", parts: 2) do
234 236 case RunnerJwt.verify(secret) do

Parents: 0229253