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

Re: [PATCH] Authentication support for pserver

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 14, 2007, 05:32 UTC
Message-ID
<7vd4t9x2lw.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<87wsrhex4c.fsf@cpan.org>
avar@cpan.org (Ævar Arnfjörð Bjarmason) writes:
Show 18 quoted lines
> +    unless ($user eq 'anonymous') {
> +        # Trying to authenticate a user
> +        if (not exists $cfg->{gitcvs}->{users}) {
> +            print "E the repo config file needs a [gitcvs.users] section with user/password key-value pairs\n";
> +            print "I HATE YOU\n";
> +            exit 1;
> +        } elsif (exists $cfg->{gitcvs}->{users} and not exists $cfg->{gitcvs}->{users}->{$user}) {
> +            print "E the repo config file has a [gitcvs.users] section but the user $user is not defined in it\n";
> +            print "I HATE YOU\n";
> +            exit 1;
> +        } else {
> +            my $descrambled_password = descramble($password);
> +            my $cleartext_password = $cfg->{gitcvs}->{users}->{$user};
> +            if ($descrambled_password ne $cleartext_password) {
> +                print "E The password supplied for user $user was incorrect\n";
> +                print "I HATE YOU\n";
> +                exit 1;
> +            }

I do not know what the real pserver does but by sending these E lines in the latter two different forms back to the client you are leaking sensitive information, which is probably not what you want (the first one is Ok, though. It would help the server administrator to notice misconfiguration, and until it is corrected nobody would be able to log in anyway).

Admittedly, the pserver password scrambling is not a real security, but if we were paranoid, we would probably be even adding random delay in "no user found" case and "password does not match" case, so that the client cannot even tell from the response latency if a username exists at the server.

Show 10 quoted lines
> @@ -1176,12 +1196,6 @@ sub req_ci
>  
>      $log->info("req_ci : " . ( defined($data) ? $data : "[NULL]" ));
>  
> -    if ( $state->{method} eq 'pserver')
> -    {
> -        print "error 1 pserver access cannot commit\n";
> -        exit;
> -    }
> -

Is this correct? You are still allowing anonymous pserver access, so shouldn't you check if this was an anonymous access or authenticated one and refuse access like before for anonymous people?

Show 6 quoted lines
> +    my ($str) = @_;
> +
> +    # This should never happen, the same format has been used since
> +    # CVS was spawned
> +    $str =~ s/^(.)//;
> +    die "invalid password format $1" unless $1 eq 'A';
I do not quite understand what "spawn" means in this sentence.
Previous: Ævar Arnfjörð BjarmasonNext: Shawn O. Pearce
Message 2 of 25 in “Authentication support for pserver”
  1. Authentication support for pserverÆvar Arnfjörð Bjarmason, Dec 14, 2007
  2. Junio C HamanoDec 14, 2007
  3. Shawn O. PearceDec 14, 2007
  4. Ævar Arnfjörð BjarmasonDec 14, 2007
  5. Junio C HamanoDec 14, 2007
  6. Ævar Arnfjörð BjarmasonDec 14, 2007
  7. Martin LanghoffDec 18, 2007
  8. Martin LanghoffDec 18, 2007
  9. Ævar Arnfjörð BjarmasonMar 7, 2008
  10. Ævar Arnfjörð BjarmasonMar 7, 2008
  11. Ævar Arnfjörð BjarmasonJun 19, 2008
  12. Martin LanghoffJun 19, 2008
  13. Junio C HamanoJun 19, 2008
  14. Junio C HamanoJun 19, 2008
  15. 0/6 git-cvsserver: password support for pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  16. 1/6 git-cvsserver: authentication support for pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  17. 1/6 git-cvsserver: authentication support for pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  18. 2/6 git-cvsserver: use a password file cvsserver pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  19. 2/6 git-cvsserver: use a password file cvsserver pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  20. 3/6 git-cvsserver: indent & clean up authdb codeÆvar Arnfjörð Bjarmason, May 15, 2010
  21. 4/6 git-cvsserver: Improved error handling for pserverÆvar Arnfjörð Bjarmason, May 15, 2010
  22. 5/6 git-cvsserver: document making a password without htpasswdÆvar Arnfjörð Bjarmason, May 15, 2010
  23. 6/6 git-cvsserver: test for pserver authentication supportÆvar Arnfjörð Bjarmason, May 15, 2010
  24. Ævar Arnfjörð BjarmasonDec 18, 2007
  25. Junio C HamanoDec 18, 2007

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.