Skip to content

fs: check read permissions for WebDAV opens - #7934

Open
oluceps wants to merge 1 commit into
juicedata:mainfrom
oluceps:webdav-read-permissions
Open

oluceps wants to merge 1 commit into
juicedata:mainfrom
oluceps:webdav-read-permissions

Conversation

@oluceps

@oluceps oluceps commented Nov 27, 2026

Copy link
Copy Markdown

webdavFS.OpenFile tested os.O_RDONLY (zero) as a bit, so read-only opens passed flags 0 to FileSystem.Open, which skips meta.Open and its access check. A non-root WebDAV server could serve or COPY files its UID cannot read (e.g. another user's 0600 file).

Change

See short changes.

Validation

  • go test ./pkg/fs -run '^TestWebdav': pass. TestWebdavPermissions fails on private and write-only-read with the old condition restored.
  • Ad-hoc probe (UID 1000 server, UID 2000 0600 file), before -> after: GET 200 -> 404, COPY 201 -> 500; readers left after 21 GETs: 21 -> 0.

Risks and open questions

x/net/webdav opens every PROPFIND entry read-only and skips entries that return EACCES, so files the server UID cannot read no longer show up in listings. That matches webdav.Dir. A Depth 0 PROPFIND on such a file returns an empty 200.

O_RDONLY is zero, so testing it as a bit skipped the read permission mask and opened files without metadata authorization. Request read access for every access mode except write-only, and cover non-owner read, write, and read-write opens.
@CLAassistant

CLAassistant commented Nov 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants