server icon indicating copy to clipboard operation
server copied to clipboard

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' 'nonce-

Open ColdSunERA opened this issue 9 years ago • 6 comments

Steps to reproduce

  1. Fresh Install of NextCloud 11.0.3
  2. Navigate to profile / personal section
  3. Unable to edit email or other settings

Expected behaviour

Settings should be saved

Actual behaviour

Nothing happens. Data is not saved as evident of its absence on reload

Server configuration

Operating system: Ubuntu 16.04

Web server: NGinx

Database: MariaDB 10x

PHP version: 7 - FPM

Nextcloud version: (see Nextcloud admin page) 11.0.3.2

Updated from an older Nextcloud/ownCloud or fresh install: Fresh install

Where did you install Nextcloud from: Official Website

Signing status:

Signing status No errors have been found.

List of activated apps:

App list
  • activity: 2.4.1
  • comments: 1.1.0
  • dav: 1.1.1
  • federatedfilesharing: 1.1.1
  • files: 1.6.1
  • files_pdfviewer: 1.0.1
  • files_sharing: 1.1.1
  • files_texteditor: 2.2
  • files_trashbin: 1.1.0
  • files_versions: 1.4.0
  • files_videoplayer: 1.0.0
  • gallery: 16.0.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.0
  • notifications: 1.0.1
  • provisioning_api: 1.1.0
  • serverinfo: 1.1.1
  • sharebymail: 1.0.1
  • theming: 1.1.1
  • twofactor_backupcodes: 1.0.0
  • updatenotification: 1.1.1
  • workflowengine: 1.1.1

Nextcloud configuration:

{ "system": { "instanceid": "ocy10jq5o1d1", "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusted_domains": [ "cloud.ego.ninja" ], "datadirectory": "/srv/www/nextcloud/public_html/data", "overwrite.cli.url": "https://cloud.ego.ninja", "dbtype": "mysql", "version": "11.0.3.2", "dbname": "nextcloud", "dbhost": "localhost", "dbport": "", "dbtableprefix": "oc_", "dbuser": "REMOVED SENSITIVE VALUE", "dbpassword": "REMOVED SENSITIVE VALUE", "logtimezone": "UTC", "installed": true, "mail_smtpmode": "smtp", "mail_smtpauth": 1, "mail_from_address": "NoReply", "mail_domain": "ego.ninja", "mail_smtphost": "smtp.gmail.com", "mail_smtpport": "587", "mail_smtpname": "REMOVED SENSITIVE VALUE", "mail_smtppassword": "REMOVED SENSITIVE VALUE" } }

Are you using external storage, if yes which one: local/smb/sftp/... No

Are you using encryption: yes/no No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... No

Client configuration

Browser: Google Chrome (58.0.3029.96 64-bit)

Operating system: Windows 10

Logs

Nextcloud log (data/nextcloud.log)

Blank

Nextcloud Web log shows: No server logs

Everything is working fine

Browser log

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'nonce-((nounce here))' 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-((more here))'), or a nonce ('nonce-...') is required to enable inline execution.

Error points to line 135 of personal

Looking above, the format should instead be

ColdSunERA avatar May 09 '17 03:05 ColdSunERA

Error is resolved by disabling CloudFlare's google analytics app. Feel free to close this submission.

Hopefully if anyone else comes across this, this will guide them down the right path

ColdSunERA avatar May 09 '17 03:05 ColdSunERA

Glad it is resolved => closing

rullzer avatar May 09 '17 07:05 rullzer

I have the same error but we haven't anything about CloudFlare.

Sound like the same problem: https://github.com/nextcloud/server/issues/5345

xaionaro avatar Nov 27 '17 13:11 xaionaro

Solved.

@xaionaro I fixed modifying lib/public/AppFramework/Http/ContentSecurityPolicy.php:

        protected $inlineScriptAllowed = true;

It will add "unsafe-inline" to "script-src" policy on ./lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php in line 327.

franciscopaniskaseker avatar Sep 23 '19 15:09 franciscopaniskaseker

@franciscopaniskaseker : thanks I don't remember anything about this issue. But I suppose it would be useful to create a PR :)

xaionaro avatar Sep 23 '19 17:09 xaionaro

Locked the issue as resolved because the report for 11.0.3 has been resolved a long time. If you run into a similar problem create a new issue please.

kesselb avatar Sep 23 '19 20:09 kesselb