Skip to content

fix(dav): challenge WebDAV clients for the password of a public share - #67133

Closed
skjnldsv wants to merge 1 commit into
masterfrom
fix/public-dav-password-challenge
Closed

skjnldsv wants to merge 1 commit into
masterfrom
fix/public-dav-password-challenge

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Summary

Cadaver can't open a password-protected public share over public.php/dav. Without credentials the server answers 401 with no WWW-Authenticate header, and Cadaver only sends the password once it's challenged.

The cause is PublicAuth::checkToken(): it throws NotAuthenticated, which skips Sabre's challenge(). I now add the same header the authenticated endpoint sends: Basic for clients, DummyBasic over ajax so the browser doesn't open its login popup.

Before / after, no credentials:

$ curl -s -o /dev/null -D - -X PROPFIND https://example.com/public.php/dav/files/$TOKEN
HTTP/1.1 401 Unauthorized
                                                     # before: nothing
WWW-Authenticate: Basic realm="Nextcloud", charset="UTF-8"   # after

Checked against a local master instance: plain, ajax (DummyBasic) and right password (207) all match remote.php/dav. I didn't try it with Cadaver itself.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

A public share with a password answered a request without credentials
with a 401 but no WWW-Authenticate header. Clients like Cadaver only
send credentials once challenged, so they could never open such a
share. Challenge like the authenticated endpoint does: basic auth, or
DummyBasic over ajax so the browser does not open its login popup.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv requested a review from a team as a code owner November 28, 2026 06:36
@skjnldsv
skjnldsv requested review from leftybournes and provokateurin and removed request for a team November 28, 2026 06:36
@skjnldsv skjnldsv added this to the Nextcloud 36 milestone Nov 28, 2026
@skjnldsv skjnldsv self-assigned this Nov 28, 2026
@joshtrichards

Copy link
Copy Markdown
Member

#63420

@skjnldsv

Copy link
Copy Markdown
Member Author

Closing in favor of #63420, which fixes the same missing challenge and also the cookie redirect loop.

@skjnldsv skjnldsv closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants