Repository navigation
feat(auth): store scopes on app passwords - #65268
Open
pringelmann wants to merge 4 commits into
Open
pringelmann wants to merge 4 commits into
pringelmann wants to merge 4 commits into
Conversation
pringelmann
requested review from
Altahrim,
CarlSchwan and
leftybournes
and removed request for
a team
October 7, 2026 09:47
come-nc
reviewed
Oct 7, 2026
come-nc
requested changes
Oct 7, 2026
pringelmann
force-pushed
the
feat/noid/app-password-scope-storage
branch
from
October 7, 2026 10:53
f50f496 to
dd472f6
Compare
come-nc
reviewed
Oct 7, 2026
pringelmann
force-pushed
the
feat/noid/app-password-scope-storage
branch
from
October 7, 2026 12:27
dd472f6 to
e3ec082
Compare
come-nc
approved these changes
Oct 8, 2026
5 of 7 tasks
pringelmann
added this pull request to stack #65341
October 9, 2026 11:15
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
pringelmann
force-pushed
the
feat/noid/app-password-scope-storage
branch
from
October 9, 2026 11:25
e3ec082 to
3f0d7ab
Compare
artonge
reviewed
Oct 15, 2026
Comment on lines
+28
to
+38
| private const VOCABULARY = [ | ||
| // Read-only files need a permissions mask on the mounts, which does not exist yet | ||
| self::FILES_READ => self::FILES_WRITE, | ||
| self::FILES_WRITE => self::FILES_READ, | ||
| self::FILES_SHARE => self::FILES_READ, | ||
| self::CALENDAR_READ => null, | ||
| self::CALENDAR_WRITE => self::CALENDAR_READ, | ||
| self::CONTACTS_READ => null, | ||
| self::CONTACTS_WRITE => self::CONTACTS_READ, | ||
| ]; | ||
|
|
Collaborator
There was a problem hiding this comment.
If we do not have a valid use case behind scope's dependency, then we can probably drop that.
|
|
||
| public const FILES_READ = 'files:read'; | ||
| public const FILES_WRITE = 'files:write'; | ||
| public const FILES_SHARE = 'files:share'; |
Collaborator
There was a problem hiding this comment.
Suggested change
| public const FILES_SHARE = 'files:share'; | |
| public const FILES_SHARE = 'files_sharing:write'; |
artonge
reviewed
Oct 15, 2026
Comment on lines
+19
to
+25
| public const FILES_READ = 'files:read'; | ||
| public const FILES_WRITE = 'files:write'; | ||
| public const FILES_SHARE = 'files:share'; | ||
| public const CALENDAR_READ = 'calendar:read'; | ||
| public const CALENDAR_WRITE = 'calendar:write'; | ||
| public const CONTACTS_READ = 'contacts:read'; | ||
| public const CONTACTS_WRITE = 'contacts:write'; |
Collaborator
There was a problem hiding this comment.
I think those should be move within their respective app to keep this service ressource agnostic.
Unless we have a good reason to have those here.
artonge
reviewed
Oct 15, 2026
| * | ||
| * @throws \InvalidArgumentException | ||
| */ | ||
| public function mergeUpdate(array $stored, array $requested): array { |
Collaborator
There was a problem hiding this comment.
It might make it more explicit regarding what the method actually does:
Suggested change
| public function mergeUpdate(array $stored, array $requested): array { | |
| public function mergeScopes(array $scope1, array $scope2): array { |
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First step towards limited app passwords: a token can now carry a list of scopes. This PR only stores them. Apart from files access nothing enforces them yet, and there's no UI.
How scopes work
scopeskey in the existingscopeJSON column, so no migrationfiles:read,files:sharein files,calendar:read,contacts:writeetc. in davfiles:read, andfiles:readneedsfiles:writeuntil read-only files existscopeskey means full access. That's every existing token, unchangedfiles:read, so code reading it keeps workingapp:<appid>)Change description
Next step
Enforcement on routes and DAV, then the access picker in Settings.
Checklist
3. to review, feature component)stable32)AI (if applicable)