Skip to content

Encryption makes files inaccessible for app APIs #8830

Closed

Description

@phedlund

As described in owncloud/notes#48 encryption prevents an API from accessing files, in this particular case the Notes app. Users are met with a 401 Unauthorized even though credentials are correct.

Activity

  1. PVince81 commented on Jun 3, 2014

    @PVince81
    Contributor

    Maybe the notes app is not using the right API calls to access files. It should use the View class.
    If it does, please provide the logs ideally using the issue template: https://raw.github.com/owncloud/core/master/issue_template.md

    CC @schiesbn @Raydiation

  2. BernhardPosselt commented on Jun 3, 2014

    @BernhardPosselt
    Contributor

    Notes APP uses the view class

  3. phedlund commented on Jun 3, 2014

    @phedlund
    Author

    Steps to reproduce

    1. Install and enable Notes app
    2. Enable ownCloud encryption
    3. curl -k -u user:pass https://example.com/owncloud/index.php/apps/notes/api/v0.2/notes

    Expected behaviour

    json with all your notes should be returned

    Actual behaviour

    401 Unauthorized is returned

    Server configuration

    CentOS:

    Web server: Apache

    Database: MySQL

    PHP version: 5.3

    ownCloud version: 6.0.3 (see ownCloud admin page)

    Updated from an older ownCloud or fresh install: Updated

    List of activated apps: Stock + News and Notes

    The content of config/config.php:

    <?php
    $CONFIG = array (
      'datadirectory' => 'top_secret',
      'dbtype' => 'mysql',
      'version' => '6.0.3.1',
      'dbname' => 'phedlund_oc',
      'dbhost' => 'localhost',
      'dbtableprefix' => 'oc_',
      'dbuser' => 'top_secret',
      'dbpassword' => 'top_secret',
      'installed' => true,
      'maxZipInputSize' => '838860800',
      'allowZipDownload' => true,
      'instanceid' => '5076f3f070a5f',
      'maintenance' => false,
      'theme' => '',
      'trusted_domains' => 
      array (
        0 => 'secure3120.hostgator.com',
      ),
    );
    
    

    Are you using external storage, if yes which one: No local/smb/sftp/...

    Are you using encryption: Yes

  4. PVince81 commented on Jun 20, 2014

    @PVince81
    Contributor

    I don't think the 401 Unauthorized is raised by the encryption app.
    Could be something else.

  5. added this to the milestone on Jun 24, 2014
  6. karlitschek commented on Jun 24, 2014

    @karlitschek
    Contributor

    @Raydiation So have you tested the notes app with encryption or do you know if someone else who used it successfully?

  7. BernhardPosselt commented on Jun 24, 2014

    @BernhardPosselt
    Contributor

    Ive tested it locally right now, works perfectly fine.

  8. phedlund commented on Jun 24, 2014

    @phedlund
    Author

    Ive tested it locally right now, works perfectly fine.

    Locally as in the web interface? This issue is about the api accessed by https.

  9. BernhardPosselt commented on Jun 24, 2014

    @BernhardPosselt
    Contributor

    yes, via the API using postman chrome app

  10. phedlund commented on Jun 25, 2014

    @phedlund
    Author

    OK, I have to decrypt the data myself. Is seems the blowfish algorithm is used, correct? How do I get the key for decryption, or what else do I need?

  11. BernhardPosselt commented on Jun 25, 2014

    @BernhardPosselt
    Contributor

    Decrypt? Should be done for you when accessing the api

  12. phedlund commented on Jun 26, 2014

    @phedlund
    Author

    You are right, it's not decryption that is needed. For some reason using my iOS code I actually get a 404 with the GET api calls when encryption is turned on. It works fine without ownCloud encryption. PUT for updating a note sort of works. The server gets the new data correctly but there is no json returned. Is something altered in the routes? Is there a specific header needed? I would think not since it works for me also using a REST client app in Firefox.

  13. modified the milestone: on Jun 27, 2014
  14. urenzel commented on Jul 7, 2014

    @urenzel

    Developers: I have successfully used curl to login and receive the encrypted notes from my owncloud by calling:

    curl --data "user=[USERNAME]&password=[PASSWORD]" -c- https://[OWNCLOUD-URL]/index.php -g https://[OWNCLOUD-URL]/index.php/apps/notes/api/v0.2/notes

    It seems that there is a redirection happening after posting the login data (no basic or digest auth used here!). The second request will use a HTTP GET to fetch the data using the contents of that cookie (use -c cookie.txt instead of -c- to store it in a file). I believe, that MyOwnNotes does not do it that way, probably not following that redirection. Also note, that owncloud has an option in it's config.php, which might automatically lead to an unexpected redirection which is 'forcessl' => true

  15. phedlund commented on Jul 7, 2014

    @phedlund
    Author

    For me, your curl command results in a POST that creates a new note. If I add a note id at the end
    curl --data "user=[USERNAME]&password=[PASSWORD]" -c- https://[OWNCLOUD-URL]/index.php -g https://[OWNCLOUD-URL]/index.php/apps/notes/api/v0.2/notes/[NOTE_ID]
    I get the note back, but ONLY if encryption is disabled.

  16. locked as resolved and limited conversation to collaborators on Aug 17, 2019
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions