Skip to content

Fix: enforce authorization in template field endpoints#5875

Open
rikled wants to merge 3 commits into
mainfrom
fix/fieldsendpoint
Open

Fix: enforce authorization in template field endpoints#5875
rikled wants to merge 3 commits into
mainfrom
fix/fieldsendpoint

Conversation

@rikled

@rikled rikled commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Assisted-by: Claude Code:Opus 4.8

  • Target version: main

Summary

extractFields and fillFields resolved a global fileId via rootFolder->getFirstNodeById(), which searches across all users' storage. Any authenticated user could pass an arbitrary id to read another user's file contents or fill/overwrite it.
Changes:

  • Resolve the id within the acting user's folder (getUserFolder()->getFirstNodeById()) so only accessible nodes (including valid shares) are returned, with a baseline READ check.
  • Require PERMISSION_UPDATE before filling a PDF, since that overwrites the source in place.

Because resolution is now user-scoped, getPermissions() reflects the caller's share-level rights, making the permission check meaningful.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

rikled added 3 commits July 17, 2026 12:04
Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Assisted-by: Claude Code:Opus 4.8
Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Assisted-by: Claude Code:Opus 4.8
Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Assisted-by: Claude Code:Opus 4.8
@rikled
rikled marked this pull request as ready for review July 17, 2026 19:18
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.

1 participant