server icon indicating copy to clipboard operation
server copied to clipboard

CSP blocks resources

Open sebastiansterk opened this issue 7 years ago • 52 comments

Steps to reproduce

  1. Fresh Install of Nextcloud Docker (nextcloud:17, nextcloud:16, nextcloud:latest)
  2. Access the Nextcloud instance
  3. Check webconsole in browser

Expected behaviour

Resources should not be blocked by CSP.

Actual behaviour

Resources are blocked by CSP.

Server configuration

Operating system: Debian 10 Buster (from Nextcloud Docker Image) Web server: Apache through Nextcloud Docker Image (nextcloud:17, nextcloud:16, nextcloud:latest) Database: mariadb PHP version: 7.3 (from Nextcloud Docker Image) Nextcloud version: (see Nextcloud admin page)

Updated from an older Nextcloud/ownCloud or fresh install: fresh install Where did you install Nextcloud from: Official Nextcloud Docker Image (nextcloud:17, nextcloud:16, nextcloud:latest)

Prod Instance: Screenshot from 2019-11-02 10-06-55

Local nonprod instance: Screenshot from 2019-11-02 10-15-38

Maybe this issue is also related to https://github.com/nextcloud/server/issues/17781 Signing status:

Signing status

Client configuration

Browser: latest Firefox and latest Chrome Operating system: Ubuntu

sebastiansterk avatar Nov 02 '19 09:11 sebastiansterk

Info for anyone who is still seeing requests blocked by CSP in Firefox (even without any extensions) - this appears to be a bug in Firefox.

Details are here https://bugzilla.mozilla.org/show_bug.cgi?id=1591807

https://github.com/nextcloud/server/issues/12724#issuecomment-548361148

Are you able to reproduce the same with chromium browsers?

kesselb avatar Nov 02 '19 15:11 kesselb

I am having the same issue. Pages are taking over a minute to load.

Browsers Attempted: Chrome (Desktop and Mobile), Firefox (Desktop and Mobile), Edge (Desktop), Safari (Desktop and Mobile) Screenshot: Imgur

The NextCloud mobile apps (NextCloud, Bookmarks, Notes, etc) all work fine, WebDav is working fine. Seems to just be an issue with the content policy for browsers.

gnikyt avatar Nov 07 '19 18:11 gnikyt

I wanted to chime in and say I think I solved the issue, turns out it may not be related to browser bug.

  • I turned on loglevel => 0 in config.
  • Reloaded my page.
  • Watched the log via SSH.
  • I seen complaints of attempting to compile server.scss but file was locked, being spammed many time.

Solution:

  • I had file locking turned on in my config
  • I disabled file locking in config
  • I disabled memcache in config
  • I disabled "theming" app via CLI
  • Rebooted the server
  • Went to my nextcloud URL
  • Success, no errors

Maybe just my case but thats what solved it for me...

EDIT: Reenabled "themeing" app after I had a successful page load. No issues reenabling. Going to attempt to turn back on caching.

gnikyt avatar Nov 08 '19 00:11 gnikyt

@ohmybrew could you share the exact message for the locked server.scss?

cc @juliushaertl

kesselb avatar Nov 08 '19 08:11 kesselb

@kesselb Two messages:

  1. Failed to compile and/or save /var/www/nextcloud/core/css/server.scss spammed in
  2. Could not find resource css/server.css to load on page load

Disabling the memcache/filelocking solved the issue for the moment, NextCloud was able to rebuild the missing assets (not sure why they disappeared).

I re-enabled it, and all was fine.

I really think the CSP error (for me anyways) came from the fact NextCloud was trying to build those assets, because anything going to /core is directed to PHP/NextCloud, while the page was loading. Due to the locking/memcache it was unable to build the assets, timed out, and caused the CSP error.

gnikyt avatar Nov 08 '19 14:11 gnikyt

Can confirm this bug exists in NC 17.0.2 It was introduced in the upgrade from NC 16

brandonkal avatar Nov 23 '19 05:11 brandonkal

I'm seeing this error as well.

Screen Shot 2019-12-01 at 2 35 09 PM

paulcalabro avatar Dec 01 '19 21:12 paulcalabro

Not a nextcloud issue:

Info for anyone who is still seeing requests blocked by CSP in Firefox (even without any extensions) - this appears to be a bug in Firefox.

Details are here bugzilla.mozilla.org/show_bug.cgi?id=1591807

juliusknorr avatar Dec 02 '19 13:12 juliusknorr

@juliushaertl please do not close a valid issue. This is not unique to Firefox. As stated above this is seen in all browsers. This has also been my experience since upgrading to nextcloid 17.

brandonkal avatar Dec 02 '19 13:12 brandonkal

If you can reproduce with Chrome please share the network tab from chrome as well as the console log.

juliusknorr avatar Dec 02 '19 13:12 juliusknorr

@brandonkal Please also try to provide a more detailed description of which issue you encounter.

juliusknorr avatar Dec 02 '19 13:12 juliusknorr

The first report is clearly the firefox issue. Somehow people hijacked the issue with their problem. We don't have a valid issue template except the firefox one so I'm closing this again. Feel free to report a new issue with the initial template so someone can have a proper look.

kesselb avatar Dec 02 '19 13:12 kesselb

Still getting this error image The screenshot is from v18.0.2

I also just installed a clean install of NextCloud (18.0.2) and the same issue is present.

aljaxus avatar Mar 16 '20 16:03 aljaxus

Compare curl -I https://cloud.aljaxus.eu with curl -I https://demo2.nextcloud.com and figure out the difference. I would try to disable cloudflare in the first place and check if that might be the issue. Please ask the friendly people at https://help.nextcloud.com/ for advice. GitHub is for bugs not for configuration issues.

kesselb avatar Mar 16 '20 16:03 kesselb

Compare curl -I https://cloud.aljaxus.eu with curl -I https://demo2.nextcloud.com and figure out the difference. I would try to disable cloudflare in the first place and check if that might be the issue. Please ask the friendly people at https://help.nextcloud.com/ for advice. GitHub is for bugs not for configuration issues.

Fair.

  • CloudFlare is not the problem. I also, as mentioned, tested a clean install on another box, on another domain and the same problem was present.
  • I will turn to NextCloud forums.

Thank you for such fast reply.

aljaxus avatar Mar 16 '20 16:03 aljaxus

No cloudflare here and same error.

n3storm avatar Mar 31 '20 17:03 n3storm

Same problem here. Fresh installed Nextcloud...

foorschtbar avatar Apr 11 '20 22:04 foorschtbar

Same problem, Nextcloud 18 image

SupRavII avatar Apr 25 '20 13:04 SupRavII

@kesselb as you can see many people are facing this issue. Could you please check if it makes sense to reopen this issue? Thanks

sebastiansterk avatar Apr 27 '20 19:04 sebastiansterk

What issue are you facing exactly? Is there something broken or just the blocked resources in networks?

juliushaertl posted a link to mozilla's bug tracker about 5 months ago. That issue is open.

If you see those blocked csp requests in Firefox but not with Chrome (or any other chromium based browser) and your instance works fine there is nothing to worry.

kesselb avatar Apr 27 '20 19:04 kesselb