Skip to content
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

webdav: return forbidden on failed proppatch #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

klarose
Copy link
Contributor

@klarose klarose commented Jan 26, 2021

Some file systems do not allow opening directories with a write flag.
The PROPPATCH implementation always opens all files it tries to patch
with O_RDWR. When running on Linux with the Dir implementation of
FileSystem, this leads to all PROPPATCH calls to a directory failing
with an Internal Server Error.

Some clients, such as git via the Microsoft Mini Redirector try to patch
directories' properties. A server using a Dir FileSystem fails in this
situation, which makes it unusable for that entire class of clients.

Rather than failing with a Internal Server Error we can instead return
Forbidden, which indicates to the client that it's not allowed to patch
properties on that file. This patch does so if we fail to open the file,
and the error is because of a lack of permission, or because the file is
a directory. We don't unconditionally return Forbidden in this case
because other errors are more likey to be ephemeral: a client retrying
could possibly succeed in a subsequent patch.

Fixes golang/go#43929

Some file systems do not allow opening directories with a write flag.
The PROPPATCH implementation always opens all files it tries to patch
with O_RDWR. When running on Linux with the Dir implementation of
FileSystem, this leads to all PROPPATCH calls to a directory failing
with an Internal Server Error.

Some clients, such as git via the Microsoft Mini Redirector try to patch
directories' properties. A server using a Dir FileSystem fails in this
situation, which makes it unusable for that entire class of clients.

Rather than failing with a Internal Server Error we can instead return
Forbidden, which indicates to the client that it's not allowed to patch
properties on that file. This patch does so if we fail to open the file,
and the error is because of a lack of permission, or because the file is
a directory. We don't unconditionally return Forbidden in this case
because other errors are more likey to be ephemeral: a client retrying
could possibly succeed in a subsequent patch.

Fixes golang/go#43929
@google-cla google-cla bot added the cla: yes label Jan 26, 2021
@gopherbot
Copy link
Contributor

This PR (HEAD: ee2d1dd) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/net/+/286992 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@drakkan
Copy link
Member

drakkan commented Mar 9, 2021

I had something similar here, I'll test your patch too, thank you

drakkan added a commit to drakkan/sftpgo that referenced this pull request Jul 25, 2021
drakkan added a commit to drakkan/sftpgo that referenced this pull request Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants