git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] http: store credential when PKI auth is used

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 12, 2021, 00:58 UTC
Message-ID
<xmqqeeglb32i.fsf@gitster.g>
In-Reply-To
<20210312004842.30697-2-john@szakmeister.net>
John Szakmeister <john@szakmeister.net> writes:
Show 8 quoted lines
> Likewise, we also need to reject the credential when there is a failure.
> Curl appears to report client-related certificate issues are reported
> with the CURLE_SSL_CERTPROBLEM error.  This includes not only a bad
> password, but potentially other client certificate related problems.
>
> Since we cannot get more information from curl, we'll go ahead and
> reject the credential upon receiving that error, just to be safe and
> avoid caching or saving a bad password.

I think this is sensible enough. As long as a tentative network failure to talk to the server, or an overloaded server that fails to accept new connection, won't trigger rejection of a password, it is OK, I would think.

Show 27 quoted lines
> Signed-off-by: John Szakmeister <john@szakmeister.net>
> ---
>  http.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/http.c b/http.c
> index f8ea28bb2e..12a8aaba48 100644
> --- a/http.c
> +++ b/http.c
> @@ -1637,7 +1637,17 @@ static int handle_curl_result(struct slot_results *results)
>  		credential_approve(&http_auth);
>  		if (proxy_auth.password)
>  			credential_approve(&proxy_auth);
> +		credential_approve(&cert_auth);
>  		return HTTP_OK;
> +	} else if (results->curl_result == CURLE_SSL_CERTPROBLEM) {
> +		/*
> +		 * We can't tell from here whether it's a bad path, bad
> +		 * certificate, bad password, or something else wrong
> +		 * with the certificate.  So we reject the credential to
> +		 * avoid caching or saving a bad password.
> +		 */
> +		credential_reject(&http_auth);
> +		return HTTP_NOAUTH;
>  	} else if (missing_target(results))
>  		return HTTP_MISSING_TARGET;
>  	else if (results->http_code == 401) {
Previous: John SzakmeisterNext: brian m. carlson
Message 3 of 9 in “http: store credential when PKI auth is used”
  1. 0/2 http: store credential when PKI auth is usedJohn Szakmeister, Mar 12, 2021
  2. 1/2 http: store credential when PKI auth is usedJohn Szakmeister, Mar 12, 2021
  3. Junio C HamanoMar 12, 2021
  4. brian m. carlsonMar 12, 2021
  5. Jeff KingMar 12, 2021
  6. John SzakmeisterMar 12, 2021
  7. 2/2 http: drop the check for an empty proxy password before approvingJohn Szakmeister, Mar 12, 2021
  8. Jeff KingMar 12, 2021
  9. John SzakmeisterMar 12, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.