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

[PATCH 1/7] credential.c: store "wwwauth[]" values in `credential_read()`

From
Taylor Blau <me@ttaylorr.com>
Date
May 1, 2023, 15:53 UTC
Message-ID
<a104afd5e1de792fadd51bbd6887725880dd23f9.1682956419.git.me@ttaylorr.com>
In-Reply-To
<cover.1682956419.git.me@ttaylorr.com>

Teach git-credential to read "wwwauth[]" value(s) when parsing the output of a credential helper.

These extra headers are not needed for Git's own HTTP support to use the feature internally, but the feature would not be available for a scripted caller (say, git-remote-mediawiki providing the header in the same way).

As a bonus, this also makes it easier to use wwwauth[] in synthetic credential inputs in our test suite.

Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 credential.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/credential.c b/credential.c
index e6417bf880..96fc0daa35 100644
--- a/credential.c
+++ b/credential.c
@@ -238,6 +238,8 @@ int credential_read(struct credential *c, FILE *fp)
 		} else if (!strcmp(key, "path")) {
 			free(c->path);
 			c->path = xstrdup(value);
+		} else if (!strcmp(key, "wwwauth[]")) {
+			strvec_push(&c->wwwauth_headers, value);
 		} else if (!strcmp(key, "password_expiry_utc")) {
 			errno = 0;
 			c->password_expiry_utc = parse_timestamp(value, NULL, 10);
-- 
2.40.1.452.gb3cd41c833
Previous: Taylor BlauNext: Taylor Blau
Message 2 of 10 in “contrib/credential: avoid protocol injection attacks”
  1. 0/7 contrib/credential: avoid protocol injection attacksTaylor Blau, May 1, 2023
  2. 1/7 credential.c: store "wwwauth[]" values in `credential_read()`Taylor Blau, May 1, 2023
  3. 2/7 t/lib-credential.sh: ensure credential helpers handle long headersTaylor Blau, May 1, 2023
  4. 3/7 contrib/credential: avoid fixed-size buffer in osxkeychainTaylor Blau, May 1, 2023
  5. 4/7 contrib/credential: remove 'gnome-keyring' credential helperTaylor Blau, May 1, 2023
  6. 5/7 contrib/credential: .gitignore libsecret build artifactsTaylor Blau, May 1, 2023
  7. 6/7 contrib/credential: avoid fixed-size buffer in libsecretTaylor Blau, May 1, 2023
  8. 7/7 contrib/credential: embiggen fixed-size buffer in wincredTaylor Blau, May 1, 2023
  9. Derrick StoleeMay 5, 2023
  10. Taylor BlauMay 5, 2023

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.