Closed juliusknorr closed 1 year ago
Thanks for reporting this, @juliushaertl.
Is it safe to assume the 403 return means the token in question is expired?
We do not use expired tokens to refresh the lock or upload the document. We interpret 401, 403, and 404 from PutFile to mean the token is expired, and we stop using it from then on.
It seems the issue here is that we never expected/supported getting 401/3/4 from a lock request. If you confirm my assumption, then it's straightforward fix.
Thanks.
Is it safe to assume the 403 return means the token in question is expired?
Currently we return 403 but looking at the WOPI spec it should rather be 401 from https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/refreshlock, so best might be to handle both.
We do not use expired tokens to refresh the lock or upload the document. We interpret 401, 403, and 404 from PutFile to mean the token is expired, and we stop using it from then on.
I would assume it may have happened that on put file the token was still valid but once the RefreshLock request was made the token was then expired.
From Nextclouds perspective the 403/401 could happen on any WOPI request as authentication with the access token is handled globally by a middleware that would just always return those status codes if the token is invalid/expired.
I would assume it may have happened that on put file the token was still valid but once the RefreshLock request was made the token was then expired.
Right, that's my assumption as well.
From Nextclouds perspective the 403/401 could happen on any WOPI request as authentication with the access token is handled globally by a middleware that would just always return those status codes if the token is invalid/expired.
We now handle 401/403/404 to mean 'token expired'.
Thank you.
Thanks as well for the quick fix.
We just had a heavy request spam from our Collabora to the Nextcloud server which seemed to have been caused by attempts to refresh the lock while the WOPI token was no longer valid.
The Nextcloud server responded with a 403 but it seems that Collabora just keeps retrying to refresh the lock.
From a quick look at the
DocumentBroker::refreshLock
it seems that the error there is logged but not further passed, soDocumentBroker::pollThread
would just continue and on the next iteration trigger the lock refresh again.https://github.com/CollaboraOnline/online/blob/1da8d6dd24bf747295c387aa1ca49f1ac18260d4/wsd/DocumentBroker.cpp#L351-L352
https://github.com/CollaboraOnline/online/blob/1da8d6dd24bf747295c387aa1ca49f1ac18260d4/wsd/DocumentBroker.cpp#L1811-L1815
Version in use:
Copyright © 2022, Collabora Productivity Limited.