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

Re: [PATCH] http.c: shell command evaluation for extraheader

From
CAColin Arnott <colin@urandom.co.uk>
Date
Mar 6, 2018, 06:09 UTC
Message-ID
<-mpHjLv0pGYld30rBagku1GYfPM2FqZQubWD4rHt2K_uijQg0ehMjeBnZgr4K77zc2E4HAlm3eqNtP7-lXzhR8o7udP0TdNHMJK7WRauzmk=@urandom.co.uk>
In-Reply-To
<nycvar.QRO.7.76.6.1803051437000.20700@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
Johannes,
On March 5, 2018 1:47 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> As the credential-helper is already intended for sensitive data, and as it
> already allows to interact with a helper, I would strongly assume that it
> would make more sense to try to extend that feature (instead of the simple
> extraHeader one).
To confirm you are suggesting that the credential struct, defined in credential.h, be extended to include a headers array, like so:
--- a/credential.h
+++ b/credential.h
@@ -15,6 +15,7 @@ struct credential {
        char *protocol;
        char *host;
        char *path;
+       char **headers
 };
 
 #define CREDENTIAL_INIT { STRING_LIST_INIT_DUP }

> This would also help alleviate all the quoting/dequoting issues involved
> with shell scripting.
> 
> Besides, the http.extraHeader feature was designed to accommodate all
> kinds of extra headers, not only authentication ones (and indeed, the
> authentication was only intended for use in build agents, where both
> environment and logging can be controlled rather tightly).

I realise that my examples are scoped for auth, but I can conceive of other mutating headers that are not explicitly authentication related, and could benefit from shell execution before fetch, pull, push actions.

> I also see that in your implementation, only the extraHeader value is
> evaluated, without any access to the rest of the metadata (such as URL,
> and optionally specified user).
>
> It would probably get a little more complicated than a shell script to
> write a credential-helper that will always be asked to generate an
> authentication, but I think even a moderate-level Perl script could be
> used for that, and it would know the URL and user for which the
> credentials are intended...

You are correct; the scope provided by http.<url>.* is enough to meet my use cases, however I agree the lack of access to metadata limits what can be done within in the context of the shell, and makes the case for a credential-helper implementation stronger. I think there is something to be said about the simplicity and user-friendliness of allowing shell scripts for semi-complex config options, but authentication is a task that should be handled well and centrally, thus extending the credential-api makes sense.

​Without Wax,
Colin Arnott​
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 4 in “http.c: shell command evaluation for extraheader”
  1. http.c: shell command evaluation for extraheaderColin Arnott, Mar 4, 2018
  2. Johannes SchindelinMar 5, 2018
  3. Colin ArnottMar 6, 2018
  4. Johannes SchindelinApr 28, 2018

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.