Skip to content

fix(security): honor every #[AuthorizedAdminSetting] attribute - #66619

Open
mprashantpandey wants to merge 1 commit into
nextcloud:masterfrom
mprashantpandey:fix/authorized-admin-setting-repeatable-66617
Open

mprashantpandey wants to merge 1 commit into
nextcloud:masterfrom
mprashantpandey:fix/authorized-admin-setting-repeatable-66617

Conversation

@mprashantpandey

@mprashantpandey mprashantpandey commented Nov 14, 2026 •

Copy link
Copy Markdown

Summary

Since Nextcloud 35, SecurityMiddleware::getAuthorizedAdminSettingClasses() only reads the first #[AuthorizedAdminSetting] attribute on a controller method. A user who is delegated a later setting gets 403. The attribute is still IS_REPEATABLE, and the developer manual still tells apps to repeat it.

This restores the Nextcloud 34 behaviour: every repeated attribute is collected, and any one of those settings authorises the user. The deprecated @AuthorizedAdminSetting(settings=A;B) docblock form is unchanged.

The method now uses a ControllerMethodReflector::getAttributes() helper that returns every attribute of a class, not only the first. getAttribute() still returns the first one.

This should be backported to stable35.

TODO

  • Collect every #[AuthorizedAdminSetting] attribute
  • Unit tests for two repeated attributes (including a user who only has the second setting)

Checklist

AI (if applicable)

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

Grok Bot in Cursor helped implement the getAttributes() loop and the unit tests. I reviewed the change. The official PHPUnit file was not run in a full Nextcloud checkout; a standalone PHP script covering the repeated-attribute collection passed.

getAuthorizedAdminSettingClasses() only read the first repeatable
attribute, so a user delegated a later setting received 403.

Assisted-by: GrokBot:Grok-Bot
Signed-off-by: Prashant Pandey <mprashantpandey@users.noreply.github.com>
@mprashantpandey
mprashantpandey requested a review from a team as a code owner November 14, 2026 13:34
@mprashantpandey
mprashantpandey requested review from icewind1991 and provokateurin and removed request for a team November 14, 2026 13:35
@susnux
susnux requested a review from CarlSchwan November 14, 2026 15:04
@susnux susnux added 3. to review Waiting for reviews bug labels Nov 14, 2026
@susnux susnux added this to the Nextcloud 36 milestone Nov 14, 2026

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

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Only the first #[AuthorizedAdminSetting] attribute is honoured since 35 (regression from #62610)

2 participants