[GH-ISSUE #153] XBEL sync not working with owncloud (Origin header=null) #142

Closed
opened 2026-02-25 22:36:16 +03:00 by kerem · 6 comments
Owner

Originally created by @minj on GitHub (Aug 25, 2018).
Original GitHub issue: https://github.com/floccusaddon/floccus/issues/153

Software versions

  • Browser: Chrome 69.0.3497.42 beta (64-bit)
  • Owncloud: 10.0.9 @ my.domain.tld/my_prefix
  • Floccus: 3.0.2

Sync settings

WebDAV URL: https://my.domain.tld/my_prefix/remote.php/webdav/
Bookmarks file path: bookmarks.xbel

Steps to reproduce

  1. installed
  2. setup
  3. tried syncing

Expected outcome

bookmarks.xbel should have been saved

Actual outcome

bookmarks.xbel was not saved

Initially I created an empty bookmarks.xbel on my server and the sync would halt due to Account.js:171 Syncing failed with Cannot read property 'childNodes' of undefined. This indicates read access is working with my settings, only the file was invalid.

Then I removed it, and I now see log messages for bookmark parsing (COMPARE, CREATE etc)

However, the process fails at PUT/DELETE requests for bookmarks.xbel and bookmarks.xbel.lock with HTTP500.

Example log from my owncloud instance:

{
    "reqId":"W4EWHcKHVXsAAD7no0AAAAAG",
    "level":3,
    "time":"2018-08-25T08:41:01+00:00",
    "remoteAddr":"<censored>",
    "user":"--",
    "app":"remote",
    "method":"PUT",
    "url":"\/my_prefix\/remote.php\/webdav\/bookmarks.xbel.lock",
    "message":"Exception: {\"Exception\":\"InvalidArgumentException\",
        \"Message\":\"Invalid url "null"\",\"Code\":0,
        \"Trace\":\"#0 /lib/public/Util.php(809):
        OCP\Util::getFullDomain('null')
        #1 /apps/dav/lib/Connector/Sabre/CorsPlugin.php(98): OCP\Util::isSameDomain('null', 'https://my.domain....')
        #2 /lib/composer/sabre/dav/lib/DAV/Server.php(407): OCA\DAV\Connector\Sabre\CorsPlugin->initialize(Object(OCA\DAV\Connector\Sabre\Server))
        #3 /apps/dav/lib/Connector/Sabre/ServerFactory.php(105): Sabre\DAV\Server->addPlugin(Object(OCA\DAV\Connector\Sabre\CorsPlugin))
        #4 /apps/dav/appinfo/v1/webdav.php(57): OCA\DAV\Connector\Sabre\ServerFactory->createServer('/my_prefix/remote...', '/my_prefix/remote...', Object(OCA\DAV\Connector\Sabre\Auth), Object(Closure))
        #5 /remote.php(165): require_once('...')
        #6 {main}\",\"File\":\"/lib/public/Util.php\",\"Line\":775}"
}

Looking at this @ the source: github.com/owncloud/core@d5836485ac/apps/dav/lib/Connector/Sabre/CorsPlugin.php (L98)

It seems owncloud expects the Origin header to be missing or parsable, but null isn't.

AFAIK, it is impossible to set with fetch since it's CORS-related :(

Can this be solved on your end or do I need to file this on their repo?

Originally created by @minj on GitHub (Aug 25, 2018). Original GitHub issue: https://github.com/floccusaddon/floccus/issues/153 ### Software versions * Browser: Chrome 69.0.3497.42 beta (64-bit) * Owncloud: 10.0.9 @ my.domain.tld/my_prefix * Floccus: 3.0.2 ### Sync settings WebDAV URL: https://my.domain.tld/my_prefix/remote.php/webdav/ Bookmarks file path: bookmarks.xbel ### Steps to reproduce 1. installed 2. setup 3. tried syncing ### Expected outcome bookmarks.xbel should have been saved ### Actual outcome bookmarks.xbel was not saved Initially I created an empty bookmarks.xbel on my server and the sync would halt due to `Account.js:171 Syncing failed with Cannot read property 'childNodes' of undefined`. This indicates read access is working with my settings, only the file was invalid. Then I removed it, and I now see log messages for bookmark parsing (COMPARE, CREATE etc) However, the process fails at PUT/DELETE requests for bookmarks.xbel and bookmarks.xbel.lock with HTTP500. ![](https://i.imgur.com/xaGM1TA.png) Example log from my owncloud instance: ``` { "reqId":"W4EWHcKHVXsAAD7no0AAAAAG", "level":3, "time":"2018-08-25T08:41:01+00:00", "remoteAddr":"<censored>", "user":"--", "app":"remote", "method":"PUT", "url":"\/my_prefix\/remote.php\/webdav\/bookmarks.xbel.lock", "message":"Exception: {\"Exception\":\"InvalidArgumentException\", \"Message\":\"Invalid url "null"\",\"Code\":0, \"Trace\":\"#0 /lib/public/Util.php(809): OCP\Util::getFullDomain('null') #1 /apps/dav/lib/Connector/Sabre/CorsPlugin.php(98): OCP\Util::isSameDomain('null', 'https://my.domain....') #2 /lib/composer/sabre/dav/lib/DAV/Server.php(407): OCA\DAV\Connector\Sabre\CorsPlugin->initialize(Object(OCA\DAV\Connector\Sabre\Server)) #3 /apps/dav/lib/Connector/Sabre/ServerFactory.php(105): Sabre\DAV\Server->addPlugin(Object(OCA\DAV\Connector\Sabre\CorsPlugin)) #4 /apps/dav/appinfo/v1/webdav.php(57): OCA\DAV\Connector\Sabre\ServerFactory->createServer('/my_prefix/remote...', '/my_prefix/remote...', Object(OCA\DAV\Connector\Sabre\Auth), Object(Closure)) #5 /remote.php(165): require_once('...') #6 {main}\",\"File\":\"/lib/public/Util.php\",\"Line\":775}" } ``` Looking at this @ the source: https://github.com/owncloud/core/blob/d5836485ac9802db343b6c9eed986a24b50eb072/apps/dav/lib/Connector/Sabre/CorsPlugin.php#L98 It seems owncloud expects the Origin header to be missing or parsable, but `null` isn't. AFAIK, it is impossible to set with fetch since it's CORS-related :( Can this be solved on your end or do I need to file this on their repo?
kerem closed this issue 2026-02-25 22:36:16 +03:00
Author
Owner

@jlbprof commented on GitHub (Aug 25, 2018):

Hmm, I have never seen that. I am interested to see if the problem is
Owncloud specific or not. You have the latest Owncloud as far as I can
tell. I do not experience the problem with the latest Nextcloud.
Nextcloud is a fork of Owncloud, but they both use SabreDAV under the
hood for WebDAV support, so I would expect that they would perform the same.

I just ran across this document:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

It seems related. I do not see anything that specifies the "Origin"
header, but it does seem like it might be controlled by this directive. I
do not know if the app sets these directives or it is set in the browser or
what.

Julian

On Sat, Aug 25, 2018 at 4:51 AM LA-MJ notifications@github.com wrote:

Software versions

  • Browser: Chrome 69.0.3497.42 beta (64-bit)
  • Owncloud: 10.0.9 @ my.domain.ltd/my_prefix
  • Floccus: 3.0.2

Sync settings

WebDAV URL: https://my.domain.ltd/my_prefix/remote.php/webdav/
Bookmarks file path: bookmarks.xbel
Steps to reproduce

  1. installed
  2. setup
  3. tried syncing

Expected outcome

bookmarks.xbel should have been saved
Actual outcome

bookmarks.xbel was not saved

Initially I created an empty bookmarks.xbel on my server and the sync
would halt due to Account.js:171 Syncing failed with Cannot read property
'childNodes' of undefined. This indicates read access is working with my
settings, only the file was invalid.

Then I removed it, and I now see log messages for bookmark parsing
(COMPARE, CREATE etc)

However, the process fails at PUT/DELETE requests for bookmarks.xbel and
bookmarks.xbel.lock with HTTP500.

https://camo.githubusercontent.com/5622a2ab06763ba556752205c070855ff154276d/68747470733a2f2f692e696d6775722e636f6d2f7861474d3154412e706e67

Example log from my owncloud instance:

{
"reqId":"W4EWHcKHVXsAAD7no0AAAAAG",
"level":3,
"time":"2018-08-25T08:41:01+00:00",
"remoteAddr":"",
"user":"--",
"app":"remote",
"method":"PUT",
"url":"/my_prefix/remote.php/webdav/bookmarks.xbel.lock",
"message":"Exception: {"Exception":"InvalidArgumentException",
"Message":"Invalid url "null"","Code":0,
"Trace":"#0 /lib/public/Util.php(809):
OCP\Util::getFullDomain('null')
#1 /apps/dav/lib/Connector/Sabre/CorsPlugin.php(98): OCP\Util::isSameDomain('null', 'https://my.domain....')
#2 /lib/composer/sabre/dav/lib/DAV/Server.php(407): OCA\DAV\Connector\Sabre\CorsPlugin->initialize(Object(OCA\DAV\Connector\Sabre\Server))
#3 /apps/dav/lib/Connector/Sabre/ServerFactory.php(105): Sabre\DAV\Server->addPlugin(Object(OCA\DAV\Connector\Sabre\CorsPlugin))
#4 /apps/dav/appinfo/v1/webdav.php(57): OCA\DAV\Connector\Sabre\ServerFactory->createServer('/my_prefix/remote...', '/my_prefix/remote...', Object(OCA\DAV\Connector\Sabre\Auth), Object(Closure))
#5 /remote.php(165): require_once('...')
#6 {main}","File":"/lib/public/Util.php","Line":775}"
}

Looking at this @ the source:
github.com/owncloud/core@d5836485ac/apps/dav/lib/Connector/Sabre/CorsPlugin.php (L98)

It seems owncloud expects the Origin header to be missing or parsable,
which null is.

AFAIK, it is impossible to set with fetch since it's CORS-related :(

Can this be solved on your end or do I need to file this on their repo?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/marcelklehr/floccus/issues/153, or mute the thread
https://github.com/notifications/unsubscribe-auth/AJS39bJ7NljdWx4lfZaWh_OL0pqq91hXks5uUR4dgaJpZM4WMU1y
.

<!-- gh-comment-id:415968412 --> @jlbprof commented on GitHub (Aug 25, 2018): Hmm, I have never seen that. I am interested to see if the problem is Owncloud specific or not. You have the latest Owncloud as far as I can tell. I do not experience the problem with the latest Nextcloud. Nextcloud is a fork of Owncloud, but they both use SabreDAV under the hood for WebDAV support, so I would expect that they would perform the same. I just ran across this document: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy It seems related. I do not see anything that specifies the "Origin" header, but it does seem like it might be controlled by this directive. I do not know if the app sets these directives or it is set in the browser or what. Julian On Sat, Aug 25, 2018 at 4:51 AM LA-MJ <notifications@github.com> wrote: > Software versions > > - Browser: Chrome 69.0.3497.42 beta (64-bit) > - Owncloud: 10.0.9 @ my.domain.ltd/my_prefix > - Floccus: 3.0.2 > > Sync settings > > WebDAV URL: https://my.domain.ltd/my_prefix/remote.php/webdav/ > Bookmarks file path: bookmarks.xbel > Steps to reproduce > > 1. installed > 2. setup > 3. tried syncing > > Expected outcome > > bookmarks.xbel should have been saved > Actual outcome > > bookmarks.xbel was not saved > > Initially I created an empty bookmarks.xbel on my server and the sync > would halt due to Account.js:171 Syncing failed with Cannot read property > 'childNodes' of undefined. This indicates read access is working with my > settings, only the file was invalid. > > Then I removed it, and I now see log messages for bookmark parsing > (COMPARE, CREATE etc) > > However, the process fails at PUT/DELETE requests for bookmarks.xbel and > bookmarks.xbel.lock with HTTP500. > > > <https://camo.githubusercontent.com/5622a2ab06763ba556752205c070855ff154276d/68747470733a2f2f692e696d6775722e636f6d2f7861474d3154412e706e67> > > Example log from my owncloud instance: > > { > "reqId":"W4EWHcKHVXsAAD7no0AAAAAG", > "level":3, > "time":"2018-08-25T08:41:01+00:00", > "remoteAddr":"<censored>", > "user":"--", > "app":"remote", > "method":"PUT", > "url":"\/my_prefix\/remote.php\/webdav\/bookmarks.xbel.lock", > "message":"Exception: {\"Exception\":\"InvalidArgumentException\", > \"Message\":\"Invalid url "null"\",\"Code\":0, > \"Trace\":\"#0 /lib/public/Util.php(809): > OCP\Util::getFullDomain('null') > #1 /apps/dav/lib/Connector/Sabre/CorsPlugin.php(98): OCP\Util::isSameDomain('null', 'https://my.domain....') > #2 /lib/composer/sabre/dav/lib/DAV/Server.php(407): OCA\DAV\Connector\Sabre\CorsPlugin->initialize(Object(OCA\DAV\Connector\Sabre\Server)) > #3 /apps/dav/lib/Connector/Sabre/ServerFactory.php(105): Sabre\DAV\Server->addPlugin(Object(OCA\DAV\Connector\Sabre\CorsPlugin)) > #4 /apps/dav/appinfo/v1/webdav.php(57): OCA\DAV\Connector\Sabre\ServerFactory->createServer('/my_prefix/remote...', '/my_prefix/remote...', Object(OCA\DAV\Connector\Sabre\Auth), Object(Closure)) > #5 /remote.php(165): require_once('...') > #6 {main}\",\"File\":\"/lib/public/Util.php\",\"Line\":775}" > } > > Looking at this @ the source: > https://github.com/owncloud/core/blob/d5836485ac9802db343b6c9eed986a24b50eb072/apps/dav/lib/Connector/Sabre/CorsPlugin.php#L98 > > It seems owncloud expects the Origin header to be missing or parsable, > which null is. > > AFAIK, it is impossible to set with fetch since it's CORS-related :( > > Can this be solved on your end or do I need to file this on their repo? > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/marcelklehr/floccus/issues/153>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AJS39bJ7NljdWx4lfZaWh_OL0pqq91hXks5uUR4dgaJpZM4WMU1y> > . >
Author
Owner

@minj commented on GitHub (Aug 25, 2018):

Re:headers, see https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name
I am not sure, how much of this applies in extensions.

If you take a look at https://github.com/nextcloud/server/tree/master/apps/dav/lib/Connector/Sabre
there is CorsPlugin is nextcloud at all.

I'll try adding credentials=include or mode=no-cors|same-origin for all fetch requests in floccus as a test. I have no other ideas at this point

<!-- gh-comment-id:415970115 --> @minj commented on GitHub (Aug 25, 2018): Re:headers, see https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name I am not sure, how much of this applies in extensions. If you take a look at https://github.com/nextcloud/server/tree/master/apps/dav/lib/Connector/Sabre there is CorsPlugin is nextcloud at all. I'll try adding `credentials=include` or `mode=no-cors|same-origin` for all fetch requests in floccus as a test. I have no other ideas at this point
Author
Owner

@marcelklehr commented on GitHub (Aug 25, 2018):

mode=no-cors|same-origin for all fetch requests in floccus

I thought the same thing. Still might not work. Could you test in firefox as well to see if this is a bug in chrome?

<!-- gh-comment-id:415970915 --> @marcelklehr commented on GitHub (Aug 25, 2018): > mode=no-cors|same-origin for all fetch requests in floccus I thought the same thing. Still might not work. Could you test in firefox as well to see if this is a bug in chrome?
Author
Owner

@minj commented on GitHub (Aug 25, 2018):

I was not able to remove Origin header in chrome.

Firefox is sending moz-extension://fe404075-445f-4b57-8f4b-0a96fe99639c as origin

This fails as well with "Only http based URLs supported".

I will file a bug report @ owncloud

<!-- gh-comment-id:415973406 --> @minj commented on GitHub (Aug 25, 2018): I was not able to remove Origin header in chrome. Firefox is sending `moz-extension://fe404075-445f-4b57-8f4b-0a96fe99639c` as origin This fails as well with "Only http based URLs supported". I will file a bug report @ owncloud
Author
Owner

@minj commented on GitHub (Aug 25, 2018):

nevermind, it's already fixed @ owncloud/core#32120 😄

<!-- gh-comment-id:415974147 --> @minj commented on GitHub (Aug 25, 2018): nevermind, it's already fixed @ owncloud/core#32120 :smile:
Author
Owner

@github-actions[bot] commented on GitHub (Mar 21, 2023):

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

<!-- gh-comment-id:1477739350 --> @github-actions[bot] commented on GitHub (Mar 21, 2023): This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/floccus#142
No description provided.