-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSP blocked loading resource at inline script-src error in Firefox. #12724
Comments
Dear bot, this does look like the first of the 2 errors shown in #10489 but that bug was closed off for an earlier version. I'm seeing the error in latest stable 14.0.4. I'm running nextcloud in a directory https://example.com/nextcloud/ (if that makes a difference). I'm not concerned about the warnings, but the error suggests, well, an error! |
What specific resource was blocked? Is it possible this is one of your extensions that tries to inject a script? I'm pretty sure this is the case because I see that too occasionally (e.g. with the Vue dev tools). |
@ChristophWurst Hmmm, I don't know, I posted all the info there was from the console log. I have been through my apps, disabling them one by one and reloading the main page after disabling to check for the error. The error persisted throughout. Here's the full list of apps I disabled:
|
Okay, sorry for not being more specific. With extension I don't mean Nextcloud apps but browser extensions. Could you try with a fresh profile on Firefox or another browser like Chrome? |
Dang, you're right! With a fresh profile it doesn't happen. OK, this is clearly a local issue, sorry for taking up your time and many thanks for your work and support. |
No worries ✌️ |
For the sake of other googlers, it was the Privacy Badger extension that was generating the errors I saw. |
I think this is still a bug. While the behavior is correct (JavaScript gets blocked by the addon), the error message is incorrect. |
For the sake of other googlers, I oberved the same behavior with uMatrix addon. |
I am still getting this error in the console, when trying to login to my gmail account |
I discovered that problem with all the v15.0.7 and v15.0.11 instances of NC I recently updated. Some resources are blocked by CSP in FF, but only in recent versions. That was not a cache problem, not an add-on in FF, it was linked to the CSP policy returned by Nextcloud.
Edit: I was wrong with my solution. Check next post |
It seems I was wrong with my solution. The problematic header comes from the 'useJsNonce' feature. With it, the "script-src 'nonce-....' header is blocked by the CSP control in FF. By commenting the block in lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php (line 413 -> 421)
and forcing the 'unsafe-inline' property of script-src by commeting the test on line 425
now it works. |
You're right. |
@quenenni , did you find a working solution to this issue? I am getting the same problem on Firefox 69 (script blocked by CSP). Wonder why this issue is closed despite problem not being resolved. |
Because it's not a problem of Nextcloud. The extension tries to modify the page in a way that is against the page's security rules. |
I'm getting hit with this even without any addons. I started a fresh firefox profile and even got CSP errors on the login page I'm using nginx and a configuration nearly identical to the recommended config from the docs. Nextcloud is version 17 and Firefox version 70. |
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 |
@ovk, did you try my solution ? (modifying the file lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php ) If it's a plugin that generates that error, I don't know which one. Having so few times at the moment, I didn't check more to see what's causing it. |
Nice catch. Hopefully this will be fixed soon. |
I have the same issue in Firefox and Chrome. I'm using the Nextcloud Docker Image (latest one and already tried it with v16, same issue) |
@sebastiansterk this is surprising, as I only observed this bug in the Firefox. I'd suggest you to try the minimal example that I posted in the bug description with FF and Chrome (with no addons), and see if there is any difference. |
@quenenni Tried your solution, although the CSP errors are gone from console, the JS and CSS is not applied to the site at all and page still takes over a minute to load, was that the case for you? |
@ohmybrew Sorry but no. I didn't have a slow loading problem. What you can do, as the cache system in FF (and other browsers) are becoming a real pain in the a** and when testing something and it often makes impossible to know if the test was really done, is to try your NC without the cache. |
@quenenni I actually ended up solving my issue. I turned loglevel to 0 in config and noticed during the slow page reload, it was spamming the NextCloud log saying server.scss was locked. I had file locking on. So I disabled file locking and memcache in config, refreshed the page and all was normal. I re-enabled memcache (kept file locking off for now), refreshed, and all still good. It appears the compiled css and js files got removed somehow, nextcloud tried to remake them but due to the filelock it ran into issues. I can see in the core directory now that all files are there for styling and js. |
Steps to reproduce
Load the main nextcloud page. (i.e. All Files)
Expected behaviour
Page to load without errors in console.
Actual behaviour
Get this error in Firefox's web console: (Firefox 64 https://whatismybrowser.com/w/DSQGWHK)
Nb. this does not happen in Chromium.
Server configuration detail
Operating system: Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64
Webserver: Apache/2.4.25 (Debian) (apache2handler)
Database: mysql 10.1.26
PHP version:
7.0.30-0+deb9u1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, apache2handler, mysqlnd, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, json, exif, mcrypt, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache, xdebug
Nextcloud version: 14.0.4 - 14.0.4.2
Updated from an older Nextcloud/ownCloud or fresh install:
Where did you install Nextcloud from: unknown
Signing status
Array
(
)
List of activated apps
Configuration (config/config.php)
Are you using external storage, if yes which one: local/smb/sftp/...
Are you using encryption:
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
Client configuration
Browser: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Operating system: Ubuntu 18.04
Logs
Browser log
Nextcloud log
Browser log
Content Security Policy: Directive ‘child-src’ has been deprecated. Please use directive ‘worker-src’ to control workers, or directive ‘frame-src’ to control frames respectively.
Content Security Policy: The page's settings blocked the loading of a resource at inline ("script-src").
files:1:1
JQMIGRATE: Migrate is installed, version 1.4.0 core.js:7:542
window.controllers/Controllers is deprecated. Do not use it for UA detection. merged.js:2176
The text was updated successfully, but these errors were encountered: