-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limited subdirectory access handled differently #85
Comments
Looking forward too. This may be related also the the |
Regarding my tests,
The following returns success:
While the following doesn't:
The following is the old implementation and where it has been used:
https://github.com/websvnphp/websvn/blob/2.3/include/auth.php#L152
https://github.com/websvnphp/websvn/blob/2.3/listing.php#L109 I don't see how the old behaviour can be restored without parsing @trentfisher Is changing your |
Even toplevel folder are not shown. user2 in the example below can't see /tags in websvn [/] [/branches/] [/tags/]
In contrast to the behavior above at least this is inconsistent with apache (mod_dav_svn) and does not follow the AuthzSVNAccessFile Guidelines |
Guten Tag neeral85,
am Montag, 8. Juli 2019 um 10:46 schrieben Sie:
Even toplevel folder are not shown. user2 in the example can't see /tags in websvn
Are you sure you are using the exact same auth-file in both cases?
Because when I copy 1:1 what you have provided as example, I get the
following error messages:
svnauthz: E220003: Error while parsing authz file: 'authz_websvn_ghi':
svnauthz: E220003: Non-canonical path '/branches/' in authz rule [/branches/]
svnauthz: E220003: Found empty name in authz rule path
I need to remove the "/" at the end of "branches" and "tags" to make
things working and get "r" as the result in the shell. In case of two
different files, this might easily explain why WebSVN doesn't allow
access.
If that is not the problem, I'm afraid you must debug further on where
exactly access is denied wrongly under which circumstances.
Mit freundlichen Grüßen,
Thorsten Schöning
…--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
|
sorry, that's my mistake as I extracted the example from my working copy.
Now /tags does not show up for user2 in websvn.
|
Guten Tag neeral85,
am Montag, 8. Juli 2019 um 15:12 schrieben Sie:
# /tags/a may not exist. however, it required to be configured to reproduce the issue.
[/tags/a]
*=
admin=rw
```
Now /tags does not show up for user2 in websvn.
Doesn't make much sense to me: How can a non-existing directory WebSVN
doesn't know a thing about influence access checks? Please provide more
details about how exactly your repo looks like, what gets shown in
WebSVN when, what you need to click to not see some dirs anymore with
which user etc.
Afterwards you can debug this further, especially looking at the file
include/authz.php and the function "hasReadAccess". Simply add some
debug statements to see where that function goes and how it gets
called. The results can be found in the error logs of your web server.
https://www.php.net/manual/de/function.var-dump.php
Mit freundlichen Grüßen,
Thorsten Schöning
…--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
|
tested now with ubuntu 18.4:
WebSVN generates:
if i run it without option -R:
i did not found man for svnauthz, so I've no idea what "-R" means. |
From |
Guten Tag neeral85,
am Montag, 8. Juli 2019 um 16:52 schrieben Sie:
WebSVN generates:
```
svnauthz accessof --repository test --path '/tags/' --username 'user2' -R '[...]/authz_websvn'
no
```
There seems to be only one place where -R comes into play in listing
directories in listing.php:
// Only list files/directories that are not designated as off-limits
$access = ($isDir) ? $rep->hasReadAccess($path.$file, true)
: $accessToThisDir;
Looking at the history of that code, the behaviour is like that for
quite some time already and has only been refactored. I wonder what's
the purpose of looking into children at that point? Might have to do
with download links rendered as well.
@neeral85, change "true" to "false" and see what happens, if things
start to work for you. Most likely they do, than please additionally
test how downloads behave, if those links are rendered and can be
executed and what gets downloaded and stuff like that.
Mit freundlichen Grüßen,
Thorsten Schöning
…--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
|
I've done that and couldn't see that issue anymore. Everything I've tested (downloading, sub-folder, ..) was working well, so this may come in the next release...? |
Guten Tag neeral85,
am Montag, 8. Juli 2019 um 20:07 schrieben Sie:
I've done that and couldn't see that issue anymore. Everything I've
tested (downloading, sub-folder, ..) was working well[...]
Where exactly did you test downloading for which directory and user?
Remember that you have acces restrictions in place, which should
reflect the downloads, that's the whole point for test.
In your example, "user2" has no access to "/tags/a" and because of
"-R" access checks fail even on parent directories. Without "-R" those
access checks succeed until the point "user2" wants to access
"/tags/a", which should fail again or that directory might not even be
shown in the first place.
But what happens in case of downloading "/tags" by "user2"? I have the
feeling that's why "-R" has been implemented in the first case, so
that people can't see things they are not allowed to download as well
or stuff like that.
Mit freundlichen Grüßen,
Thorsten Schöning
…--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
|
user2 does not even see /tags/a (I've created this especially for this test), so everything works as expected. I assume -R was implemented in svnauthz to know if the user can access the full sub-tree because of that behavior: However, as far as I can see there is no need ever for WebSVN to use this option as you never need to know access for sub-folders. There is always a dedicated request for every folder/file in WebSVN. |
Guten Tag neeral85,
am Dienstag, 9. Juli 2019 um 08:43 schrieben Sie:
However, as far as I can see there is no need ever for WebSVN to
use this option as you never need to know access for sub-folders.
There is always a dedicated request for every folder/file in WebSVN.
Not for downloads: You can easily start a download for a directory
tree at a level in which you can still see dirs, "/tags" in your case,
while the download would contain dirs to which access is forbidden,
"/tags/a" in your case. The download links don't seem to depend on
individual access checks.
OTOH, doing the actual download DOES properly seem to recognize -R
because of using the function "hasUnrestrictedReadAccess". So, "-R"
must not be removed entirely, but instead we need to decide if the
line using it in "listing.php" can be used without -R, by not
providing "true" to the call.
Looking at the history, the line has been introduced with "true" for
recursive checks right from the start, but I don't see any documented
reason:
adaa59f#diff-b7327c6d2d9e03285f57b2039cc45055
@neeral85
Please provide a PR simply changing "true" to "false" linking to your
first comment with the problem here. We can think of this a bit more
and most likely simply merge it at some point. Thanks!
Mit freundlichen Grüßen,
Thorsten Schöning
…--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
|
…anymore in case of access to their subdirs is restricted for the current user. Reason is a recursive check of access to subdirs when their parent should be shown, for which nobody seems to know the reason currently. This commit reverts that behaviour. #85 (comment)
#85 mentions a problem in which top level directories are not shown anymore in case of access to their subdirs is restricted for the current user. Reason is a recursive check of access to subdirs when their parent should be shown, for which nobody seems to know the reason currently. This commit reverts that behaviour. #85 (comment) #85 (comment)
Note: this is an issue with the following access file as well:
When accessing /, a 500 error is sent back to the browser:
Accessing the repo directly via the URL does work(listing.php?repname=repo+name), however it says "You do not have the necessary permissions to view this content.". I tried the fix in #89, and that didn't seem to fix anything; in fact it seems to cause it to stop working. I tried using 'svnauthz' from the command line, and no combination of options seems to make this work correctly. It seems like this was all introduced in 60788a5, and it mostly works, but fails in these specific edge cases, so it seems to me like that commit needs to be reverted. |
The error message is confusing. I have removed all authentication code from WebSVN. Authn has to happen by webserver means. @rm5248 Can you retry from master? |
Hello,
user1 can't see Project repo in WebSVN and he gets an auth error when accessing to https://websvn/browse/Project? (he can access to https://websvn/browse/Project/Folder1?) Do you have any fix for this please? |
Hello, We have a lot of personal repos where only the owner has rw rights on the root folder and others have no rights. But subfolders are shared with others by setting explicit rights. I think the problem can be found of the usage of svnauthz. Bests |
Unfortunately not, but I think the best approach is to call the decision logic from Subversion with C (C lib to PHP shim, like the Apache module does) instead of reimplementing and tracking every new release. |
I know this is a weird case, imagine an authz file like this:
In v2.3.3 when I access websvn it will list this repository on the repository list and I can navigate in directly, though it shows me nothing other than /branches/a (that is, / only contains "branches" and /branches only contains "a")
But in v2.5 it omits the repository from the repository list and attempting to access /branches (by doctoring the URL) yields "You do not have the necessary permissions to view this content." But if I doctor the URL to access /branches/a, it works fine.
To be honest, the new behavior makes sense since it just reflects what svnauthz reports, but it is causing a lot of wailing amongst my user base. So I need to figure out how to revert to the old behavior. I will try to dig into the source code to fix this, but any assistance would be welcome.
The text was updated successfully, but these errors were encountered: