Skip to content

feat(dav): limit scoped app passwords to the collections they open - #65552

Draft
pringelmann wants to merge 1 commit into
feat/noid/app-password-route-gatefrom
feat/noid/app-password-dav-gate
Draft

pringelmann wants to merge 1 commit into
feat/noid/app-password-route-gatefrom
feat/noid/app-password-dav-gate

Conversation

@pringelmann

Copy link
Copy Markdown
Contributor

Note

I'm new to DAV and leaned heavily on Claude for this PR. I went through the code with it until I understood how the plugin hooks into Sabre and why each rule is there, but reviews from people who know DAV well would help the most here, especially on the calendar and contacts rules.

Summary

Stacked on #65340, which does the same for index.php and OCS.

Sabre plugin that refuses DAV requests outside the token's scopes (403) and drops refused items from multistatus responses, so multiget can't read around it. Loaded in remote.php/dav and the legacy caldav, carddav and webdav endpoints. Default deny per top-level collection.

  • Files collections need files:read. Writes are left to the mount permissions
  • Calendars and contacts: read or write scope by HTTP method. No sharing, publishing or calendar proxies
  • App calendars and address books are hidden; birthdays also need contacts:read
  • Tag definitions are read-only

Tokens without scopes aren't affected.

Testing

Tested locally with Thunderbird 140.17.0 and a calendar:read calendar:write token:

  • Discovery finds only Personal user calendar. The birthday calendar is hidden without contacts:read
  • Create, edit and delete events sync both ways
  • Inviting an external attendee: the server sends the invitation
  • A files:* token finds no calendars

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes
  • Documentation (manuals or wiki) has been updated or is not required
  • Backports requested where applicable (ex: critical bugfixes)
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component)
  • Milestone added for target branch/version (ex: 32.x for stable32)

AI (if applicable)

  • The content of this PR was partly or fully generated using AI (some dav-related code, tests, all reviewed by me)

Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
@pringelmann pringelmann added this to the Nextcloud 36 milestone Oct 15, 2026
@pringelmann pringelmann self-assigned this Oct 15, 2026
@pringelmann pringelmann added the 3. to review Waiting for reviews label Oct 15, 2026
@pringelmann
pringelmann requested a review from a team as a code owner October 15, 2026 13:19
@pringelmann
pringelmann added this pull request to stack #65341 October 15, 2026 13:19
@pringelmann
pringelmann removed the request for review from a team October 15, 2026 13:19
@pringelmann pringelmann added the feature: carddav Related to CardDAV internals label Oct 15, 2026
@pringelmann pringelmann added the team: IDP Code maintained by 🪪 IDP team label Oct 15, 2026
@pringelmann
pringelmann requested review from CarlSchwan, artonge, come-nc and nickvergessen and removed request for sorbaugh October 15, 2026 13:19
@pringelmann
pringelmann marked this pull request as draft October 15, 2026 15:47
@pringelmann pringelmann removed the 3. to review Waiting for reviews label Oct 15, 2026
@pringelmann

Copy link
Copy Markdown
Contributor Author

Drafting for now, got feedback that necessitates major changes

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

feature: authentication feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals feature: dav security team: IDP Code maintained by 🪪 IDP team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scoped app passwords: DAV

1 participant