Ensure GetFolderEncryptStatusJob gets all the folders
authorKevin Ottens <kevin.ottens@nextcloud.com>
Thu, 18 Jun 2020 11:34:47 +0000 (13:34 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 30 Jun 2020 09:29:08 +0000 (11:29 +0200)
We ensure the PROPFIND Depth is infinity by explicitly specifying the
header (turns out our implementation just doesn't assume infinity
otherwise). This way we have a clear picture about *all* the folders of
the user, otherwise ClientSideEncryption couldn't be a trustable oracle
on the encryption state for any folder not on the root and all the
encryption code assumes it has a full picture of encryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/clientsideencryptionjobs.cpp

index 5c887620613953a79ba9f4dd81d2f166201149ab..7076124137908d21ee7200f727f107a604a8637b 100644 (file)
@@ -35,6 +35,7 @@ void GetFolderEncryptStatusJob::start()
        req.setPriority(QNetworkRequest::HighPriority);
        req.setRawHeader("OCS-APIREQUEST", "true");
     req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml"));
+    req.setRawHeader("Depth", "infinity");
 
        QByteArray xml = R"(<d:propfind xmlns:d="DAV:"> <d:prop xmlns:nc="http://nextcloud.org/ns"> <nc:is-encrypted/> </d:prop> </d:propfind>)";
        auto *buf = new QBuffer(this);