You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2003/11/25 05:51:07 UTC

broken Digest auth

cmpilato and I have been investigating issue 1608, whereby svn 0.33
broke Digest Authentication.  We now understand the problem, but we're
not sure what the right solution is.  We're looking for feedback and
suggestions.

Background -- let me first explain how things are *supposed* to work:

1. mod_dav_svn begins to send data to the client via an editor
(checkout, update, diff, merge, etc.)  svn_repos_dir_delta() is driving
the editor.

2. Before sending data, svn_repos_dir_delta() invokes an authorization
'read' callback function:  "does the user have permission to read this
(rev, path?)"

3. mod_dav_svn has a read-callback function which always does the same
thing:  it converts the (rev, path) in question into a uri, and then
issues an internal _subrequest_ to apache, attempting to GET the uri.  
This gives any apache authz modules a chance to validate the read
operation.

This subrequest system works just fine for http Basic Auth.  In that
system, every client request contains a header that looks something like

   WWW-Authorization: Basic [crypted encoding of username+password]

When the subrequest is created, it inherits all of the headers from its
parent, so there's no problem with authn or authz.

But along comes Digest authentication.  According to the RFC, each
client request looks something like this:

  WWW-Authorization: Digest username="XXX" password="XXX" nonce="XXX"
method="XXX" URI="XXX"

In other words, the http client needs to build an authorization header
that is *specific* to the method and URI being requested.  And this is
now breaking our subrequest system.  Typically, we invoke
svn_repos_dir_delta by issuing some kind of REPORT request on
'!svn/vcc/default'.  But the authz subrequests are all GET methods on
specific repository-path URIs.  Because the method and URI is different
from the parent request, the inherited Authorization: header fails to
authenticate.  We get 'password mismatch' errors in the log, and
svn_repos_dir_delta() stops dead in its tracks.

One solution is to hack custom support into our authz_read callback: 
look for the Authorization header, see if it's Digest auth.  If it is,
then call various internal apache functions to rebuild a new header
that's custom to the 'GET !svn/ver/N/path' request.  But man, how nasty.

Anyone have any thoughts?



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: broken Digest auth

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Monday, November 24, 2003 11:51 PM -0600 Ben Collins-Sussman 
<su...@collab.net> wrote:

> '!svn/vcc/default'.  But the authz subrequests are all GET methods on
> specific repository-path URIs.  Because the method and URI is different
> from the parent request, the inherited Authorization: header fails to
> authenticate.  We get 'password mismatch' errors in the log, and
> svn_repos_dir_delta() stops dead in its tracks.

Well, it's a little complicated, but I think httpd can 'fix' this with the 
right patches applied to httpd.

I think some short-circuit logic in the authn hook could be in place if we're 
a sub-req - return DECLINED if !ap_is_initial_req?  I don't know how well 
that'll work, but I'd start there and see how it works for this particular 
issue.  The r->user should be inherited from the parent request_rec, IIRC.

If that doesn't work, I'd say that in this case the authn (authentication, 
i.e. mod_auth_digest) should work against the original method and sub-req for 
digest auth.  That is, it needs to go off of the credentials provided in the 
r->main chain (see mainreq logic in authenticate_digest_user).  It shouldn't 
really care what the method and URI of the subreq are as the user has 
*already* been authenticated against us by this point (in almost all 
probability).  We just need to identify *who* the person is at this stage, but 
we already know that based on the main request_rec.  Yet, I'm wondering if 
there could be conflict between a req and its sub-reqs - i.e. different digest 
realms - perhaps that is possible and why it is not done already.  (Confused 
yet?)

However, authz (authorization) needs to know the subreq method and URI to work 
properly.  mod_authz_svn is doing the 'right' thing, and I think it's 
mod_auth_digest that's broken.  So, you should focus on getting 
mod_auth_digest working correctly on sub-reqs with different method and URIs.

While digest auth has been around for a while, I don't believe many people use 
it in practice; so I'd expect it to be fragile.  *shrug*  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: broken Digest auth

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2003-11-25 at 00:51, Ben Collins-Sussman wrote:
> Anyone have any thoughts?

It sounds like either subrequests aren't a great mechanism for checking
authorization, or perhaps the subrequest system isn't architected right
(the subrequest should not be authenticated separately from the main
request).  Not sure which.

I see three options:

  * Hack around this problem.  In addition to being ugly and a layer
violation, this option leaves open the possibility that there might be
another authentication system in the future where we simply can't
rewrite the authentication headers--say, because it involves the client
signing the entire request using a private key, and we only have the
public key.

  * Get an enhancement into Apache, where you can tell a subrequest to
pull its authentication from the main request, instead of processing the
WWW-Authorization header.

  * Abandon mod_authz_svn, and build authorization checks into
mod_dav_svn.  As far as the Apache configuration is concerned, don't
pretend that a checkout involves authorizing GET requests.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org