Skip to content

Allow to restrict app password data access #2866

Open

Description

@j-ed

Expected behavior

If a user creates individual app passwords, it should be possible to restrict to which data the app should have access to and what kind of access should be allowed.

Example:

App         RO  RW  CREATE  DELETE  UPLOAD
----------  --  --  ------  ------  ------
Calendar    X
Contacts        X
Files                                 X          

Current behavior

If a user creates individual app passwords, he couldn't restrict to which data the app should have access.

Steps to reproduce

  1. Login as as a user
  2. Choose Personal -> App passwords

Environment

Server Configuration

OS: Linux 3.2.82
Web server: Apache2 2.4.25
Database: MariaDB 5.5.53
PHP version: 5.6.29
Nextcloud version: 10.0.2

Client Configuration

Browser: Mozilla Firefox 50.1.0
Operating system: Windows 7

EDIT by @jospoortvliet : Please see #30331 for a few more details and use cases.

Activity

  1. MariusBluem commented on Jan 1, 2017

    @MariusBluem
    Member

    See: #719

    What is the current plan/state? @icewind1991

  2. nickvergessen commented on Jan 18, 2017

    @nickvergessen
    Member

    The problem is that this is not really that easy.

    E.g. you wouldn't want your activity reader to do anything right?
    But it needs access to all of those to display the related events, get the contact names for displaying and file access for handling of paths in activities.

    So while it is nice in theory, we need to make this easily checkable and somehow a way to correctly deal with this for other apps.

  3. changed the title [-]Feature request: allow to restrict app password data access[/-] [+]Allow to restrict app password data access[/+] on Apr 5, 2017
  4. benyanke commented on Oct 3, 2017

    @benyanke

    @nickvergessen It would seem that to implement this, a permissions framework would need to be built into the core of NC, at which point apps could register the permissions they have available, which would be namespaced with the app name, etc, etc.

    A framework I'm using on my own projects is https://github.com/spatie/laravel-permission. While it's deeply integrated with laravel, so not very suitable for this, perhaps a similar model could be used: create a list of permissions - as you mentioned, separate out read vs write permissions in each section, and then assign to users.

  5. nickvergessen commented on Oct 4, 2017

    @nickvergessen
    Member

    Yeah something similar to the bruteforce protection we added in 12 (or was it 11?).

    * @BruteForceProtection(action=login)

  6. added
    stale
    on Jun 20, 2018
  7. j-ed commented on Sep 21, 2018

    @j-ed
    ContributorAuthor

    The issue has still not been fixed in Nextcloud v13.0.6.

  8. removed
    stale
    on Sep 21, 2018
  9. added
    1. to develop
    on Jun 17, 2019
  10. szaimen commented on May 26, 2021

    @szaimen
  11. j-ed commented on May 26, 2021

    @j-ed
    Author
  12. riedel commented on Feb 8, 2022

    @riedel

    Actually it makes sense to go even further. IMHO it would make sense to use the sharing functionality to share a file or subdirectory with an "app password". Particularly if one needs to upload or download data for a longer timeframe in a multiuser environment keeping any password on disk or in memory with such wide permissions does not much lessen the attack surface.

    Context: I am currently looking on a good way how to instruct users to include nextcloud files in projects in their HPC project. Registering an extra user for sharing files with yourself seems to be the only good solution.

  13. InRiPa commented on Feb 10, 2022

    @InRiPa

    I'm using Android Apps, which access a specific App from nextcloud (e.g. app for calendar, app for tasks, ..). It would be nice to restrict the access of given "app password account" to the exact purpose.

  14. 15 remaining items

  15. crispyduck00 commented on Jan 25, 2026

    @crispyduck00

    @My1 That would be really great.
    Of course it would not cover all use cases, but it would already make it possible to have one app password per folder. If multiple folders in different locations are needed, it would still be possible to create multiple app passwords.

    I strongly prefer the principle of least privilege, meaning each app/password should only have access to what is actually required.

    I initially thought I could work around this for my backup/sync apps by using public shares and accessing them via /public.php/dav, but I found that using Basic Auth with different apps triggers the bruteforce protection very quickly.

    My current workaround is using separate user accounts. This is not really ideal, but still better than giving an app—which should, for example, only back up to a specific folder—write access to everything the main user can access.

    Implementing to at least set a specific root folder per app password would be a significant improvement.

  16. riedel commented on Jan 27, 2026

    @riedel

    Just to add one comment regarding work arounds: those seem fine for home installations but for large corporate installations (which might even have higher security demands), arbitrary users are not possible. Also weird patterns easily break things or trigger security mechanisms (which result in complicated discussions with the admins about what one is trying to do)

  17. AceDenghar commented on Mar 5, 2026

    @AceDenghar

    Please,

    In this time of large data leaks it's a non-sense that this is not yet implemented.

    Apps password is a good first step but should not be unfinished as it is.

    There are many apps that can connect to Nextcloud and it's a good thing for Nextcloud's popularity and usages.

    It's also a good reflex for users to use apps passwords.

    But we can't be sure of what these applications can do and even if using other login/password that the principal one, they can do almost everything with our datas.

    Adding these options could be a very good point to secure them.

    Sorry for my english and thank you for the fantastic job you've done on Nextcloud ❤️

    Ace

  18. makua104 commented on Apr 11, 2026

    @makua104

    I ran into this today trying to limit the WebDAV access of Keepassium on iOS for access to my password database in Nextcloud. My goal was to avoid giving the app full read/write permission to every folder my Nextcloud user has.

    As mentioned by other commenters it appears that using password protected share links is an OK workaround. I found an old reddit thread discussing how to do it here and it's also kind of documented in the Nextcloud docs here and here

    Summary of the solution for e.g. a scoped folder:

    1. Create the folder
    2. Create a public password protected share for the folder with e.g. https://cloud.example.com/s/yxcFKRWBJqYYzp4 as the share link
    3. Use e.g. https://cloud.example.com/public.php/webdav as the WebDAV connection URL (could probably change in future versions, the two doc links appear to use different URL paths) enter the part of the previous url after /s/ so in our case yxcFKRWBJqYYzp4 as the username and then the share password as the password for the user.
    4. WebDAV client only has access to the inside of the folder
  19. archont00 commented on Apr 11, 2026

    @archont00

    Thanks a lot - let me re-write since I was struggling a bit with understanding of the steps:

    1. NC: Create a folder.
    2. NC: Create an external share of that folder with e-mail and password.
    3. NC: Display the QR code for the share and scan it with phone camera to find out the direct URL with the token. E.g. https://cloud.example.com/s/yxcFKRWBJqYYzp4.
    4. In WebDAV client app (Keepass2Android in my case), set
      • URL: https://cloud.example.com/public.php/webdav
      • Username: yxcFKRWBJqYYzp4
      • Password: the share password
    5. The WebDAV client should display the shared folder content
  20. AceDenghar commented on Apr 14, 2026

    @AceDenghar

    Thank you for this workaround ! It will be usefull 🥰

    But should be centralized in apps password when used by apps...

    We should clearly distinguish apps and users access.

    But it's good to know !

  21. pmilosev commented on Aug 18, 2026

    @pmilosev

    I assume the issue is non-standardised permissions across Nextcloud apps.
    But for start it would be nice to limit which Nextcloud apps the app password grants access to.
    This is already solved in the Guests app:

    Image
  22. sunjam commented on Aug 19, 2026

    @sunjam

    Sorry to be broken record, three years later...

    We should clearly distinguish apps and users access.

    That would be handled through scoped oauth. Currently Nextcloud only grants full access, with zero granularity, to all issued oauth tokens. See the actual Nextcloud documentation, which states:

    Nextcloud OAuth2 implementation currently does not support scoped access. This means that every token has full access to the complete account including read and write permission...

    OAuth Scopes is a mechanism in OAuth 2.0 to limit an application's
    access to a user's account. An application can request one or more scopes,
    this information is then presented to the user in the consent screen, and
    the access token issued to the application will be limited to the scopes
    granted.

    Full details at https://oauth.net/2/scope/

    Example:

    App         RO  RW  CREATE  DELETE  UPLOAD
    ----------  --  --  ------  ------  ------
    Calendar    X
    Contacts        X
    Files                                 X          
    

    This exact example from the original post here is what Oauth scoped access is for. Please do not take my word for it, and do some research. Hope this helps! You could define all of the following within one single oauth token:

    Calendar: read-only
    Contacts: read/write
    Files: upload-only

    And even add more things like:
    list
    download
    edit metadata
    share
    delete
    manage folders
    So instead of one blanket “full access” token, Nextcloud could issue tokens with narrow capabilities for each app and each action, as defined for each specific token.

  23. pringelmann commented on Oct 7, 2026

    @pringelmann
    Contributor

    We are working on scoped app passwords for NC36. First PR is open to introduce scope schema and vocabulary: #65268

  24. jsalatiel commented on Oct 15, 2026

    @jsalatiel

    Thanks a lot - let me re-write since I was struggling a bit with understanding of the steps:

    1. NC: Create a folder.
    
    2. NC: Create an external share of that folder with e-mail and password.
    
    3. NC: Display the QR code for the share and scan it with phone camera to find out the direct URL with the token. E.g. `https://cloud.example.com/s/yxcFKRWBJqYYzp4`.
    
    4. In WebDAV client app (Keepass2Android in my case), set
       
       * URL: `https://cloud.example.com/public.php/webdav`
       * Username: `yxcFKRWBJqYYzp4`
       * Password: the share password
    
    5. The WebDAV client should display the shared folder content
    

    Does this really work?
    I always get "401 Unauthorized" in any webdav client I use when i use that "username" and the share password

  25. alexpdp7 commented on Oct 15, 2026

    @alexpdp7
  26. alexpdp7 commented on Oct 15, 2026

    @alexpdp7

    Got it working using cadaver. The documentation had a slight mistake. See nextcloud/documentation#15781.

  27. susnux commented on Nov 10, 2026

    @susnux
    Contributor

    @pringelmann matching your current work?

  28. pringelmann commented on Nov 10, 2026

    @pringelmann
    Contributor

    @pringelmann matching your current work?

    Yup :) see #2866 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. to developenhancementfeature: authenticationsecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions