Skip to content
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

Add custom CSP for Win 10 compatibility #17791

Merged
merged 1 commit into from
Sep 10, 2015

Conversation

LukasReschke
Copy link
Member

The default content-security-policy of ownCloud forbids inline
JavaScript for security reasons. Edge starting on Windows 10 will
however also obey the CSP which will break the event source fallback.
As a workaround thus we set a custom policy which allows the execution
of inline JavaScript.

This fixes #14286 and is also required for owncloud/gallery#206

The default content-security-policy of ownCloud forbids inline
JavaScript for security reasons. IE starting on Windows 10 will
however also obey the CSP which will break the event source fallback.
As a workaround thus we set a custom policy which allows the execution
of inline JavaScript.

This fixes #14286
@LukasReschke LukasReschke added this to the 8.2-current milestone Jul 21, 2015
@scrutinizer-notifier
Copy link

A new inspection was created.

@LukasReschke
Copy link
Member Author

@karlitschek Should get backported to the older releases. Win 10 will add CSP support which makes ownCloud pretty much unusable on newer IEs then as the EventSource is used for some other stuff as well such as the update process and also file listing if I'm not completely wrong.

If you agree I will prepare backports for stable7 - stable8.1.

@ghost
Copy link

ghost commented Jul 21, 2015

🚀 Test PASSed.🚀
chuck

@karlitschek
Copy link
Contributor

@LukasReschke Nice. Please backport 👍

@LukasReschke
Copy link
Member Author

So anybody up to review this since Win 10 has been released? 🙊

To test this access http://localhost/master/index.php/apps/files/ajax/scan.php?dir=/&force=true&requesttoken=urUGo9SQ01D4vPn8iWouZdByLYGLFK&fallback=true&=fallback_id=2 (obviously adjust the request token).

Before the CSP header was: Content-Security-Policy:default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src *; font-src 'self' data:; media-src *; connect-src *
With this patch the header is: Content-Security-Policy:default-src 'none'; script-src 'unsafe-inline'

The unsafe-inline allows inline JS for this resource.

@DeepDiver1975
Copy link
Member

@rperezb qa please 🙊 THX a lot

@rperezb
Copy link

rperezb commented Aug 13, 2015

Checking with @bboule for the environment to check this

@LukasReschke
Copy link
Member Author

Ping? 🙊

@LukasReschke
Copy link
Member Author

Pong? 🙉

@SergioBertolinSG
Copy link
Contributor

Using edge in windows 10. After accessing the provided url I am getting same headers as before.
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src *; font-src 'self' data:; media-src *; connect-src *

@LukasReschke
Copy link
Member Author

Are you sure you read the Content-Security-Policy of the EventSource page? This seems to work fine for me:
2015-09-10_13-42-31

@SergioBertolinSG
Copy link
Contributor

I've tried with that /master/ folder in the url and without it, same result in this headers.

content_policy

@LukasReschke
Copy link
Member Author

Are you sure the patch is applied? 52328 which has as per the Web UI 52330 as SSH port hasn't.

2015-09-10_13-55-09

@SergioBertolinSG
Copy link
Contributor

Yes, sorry, I patched the wrong server.

Now it is working fine
Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'

@SergioBertolinSG
Copy link
Contributor

Update is working correctly as well. (without the patch it didn't redirect, not sure if related) 👍

LukasReschke added a commit that referenced this pull request Sep 10, 2015
…ith-win10

Add custom CSP for Win 10 compatibility
@LukasReschke LukasReschke merged commit 89cd929 into master Sep 10, 2015
@LukasReschke LukasReschke deleted the make-eventsource-compatible-with-win10 branch September 10, 2015 13:00
@LukasReschke
Copy link
Member Author

stable8.1: #18957
stable8: #18958

@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EventSource fallback will not work with IE versions that support CSP
7 participants