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

Re: [PATCH 2/2] gitweb: support hiding projects from user-visible lists

From
Matt McCutchen <matt@mattmccutchen.net>
Date
Dec 24, 2008, 01:40 UTC
Message-ID
<1230082831.2971.45.camel@localhost>
In-Reply-To
<m3ljujg2eh.fsf@localhost.localdomain>
On Sat, 2008-12-13 at 14:02 -0800, Jakub Narebski wrote:
Show 27 quoted lines
> Cannot you do this with new $export_auth_hook gitweb configuration
> variable, added by Alexander Gavrilov in 
>    dd7f5f1 (gitweb: Add a per-repository authorization hook.)
> It is used in check_export_ok subroutine, and is is checked also when
> getting list of project from file
> 
> >From gitweb/INSTALL
> 
>   - Finally, it is possible to specify an arbitrary perl subroutine that
>     will be called for each project to determine if it can be exported.
>     The subroutine receives an absolute path to the project as its only
>     parameter.
> 
>     For example, if you use mod_perl to run the script, and have dumb
>     http protocol authentication configured for your repositories, you
>     can use the following hook to allow access only if the user is
>     authorized to read the files:
> 
>       $export_auth_hook = sub {
>           use Apache2::SubRequest ();
>           use Apache2::Const -compile => qw(HTTP_OK);
>           my $path = "$_[0]/HEAD";
>           my $r    = Apache2::RequestUtil->request;
>           my $sub  = $r->lookup_file($path);
>           return $sub->filename eq $path
>               && $sub->status == Apache2::Const::HTTP_OK;
>       };

$export_auth_hook would work, and it would have the nice (but not essential) feature of including private projects in the list shown to suitably authenticated users. The only problem is that my Web host doesn't support mod_perl. Is there a practical way to accomplish the same thing as the above example in a CGI script? I would like to avoid reimplementing Apache authentication-checking functionality if at all possible.

-- 
Matt
Previous: Matt McCutchenNext: Jakub Narebski
Message 5 of 7 in “gitweb: support hiding projects from user-visible lists”
  1. 2/2 gitweb: support hiding projects from user-visible listsMatt McCutchen, Dec 13, 2008
  2. Jakub NarebskiDec 13, 2008
  3. Jakub NarebskiDec 13, 2008
  4. Sending a threaded patch series with EvolutionMatt McCutchen, Dec 14, 2008
  5. Matt McCutchenDec 24, 2008
  6. Jakub NarebskiJan 2, 2009
  7. gitweb config with some public, some basic-authenticated reposMatt McCutchen, Jan 3, 2009

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.