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

CSP 'script-src' on Riot/Web #13855

Closed
matrix-git1 opened this issue May 29, 2020 · 3 comments
Closed

CSP 'script-src' on Riot/Web #13855

matrix-git1 opened this issue May 29, 2020 · 3 comments

Comments

@matrix-git1
Copy link

I logged in to my account on my Matrix homeserver (Nginx + Synapse) using Riot Web (Browser) (https://riot.im/app/#/login).
I wanted to execute an eval script in the browser bar (Google Chrome 83) like this:

javascript:eval("s=document.createElement('script');s.src='https://yastatic.net/jquery/2.1.4/jquery.min.js';document.getElementsByTagName('head')[0].appendChild(s)")

But I was disappointed. I received the following message:

Скриншот 29-05-2020 030058

I checked my Nginx (/etc/nginx/nginx.conf and /etc/nginx/sites-available/[_homeserver_]), but no CSP policy is set there.

I want eval() to work no matter what.
Could Riot Web have prevented me from doing this?

P.C. eval script works on google.com in the same browser.

@t3chguy
Copy link
Member

t3chguy commented May 29, 2020

Yes, riot-web includes a CSP policy: https://github.com/vector-im/riot-web/blob/develop/src/vector/index.html#L26-L40

eval does work, the thing that isn't working is yastatic.net is not whitelisted in the CSP.

Adding arbitrary origins would be a security disaster.

google.com gets a shoddy Mozilla Observatory score of D-: https://observatory.mozilla.org/analyze/google.com
compared to Riot which gets an A https://observatory.mozilla.org/analyze/riot.im

@matrix-git1
Copy link
Author

@t3chguy Thank you!

But why if I use the Disable Content-Security-Policy plugin (https://chrome.google.com/webstore/detail/disable-content-security/ieelmcmcagommplceebfedjlakkhpden) or similar plugins my eval-script is not running?

@t3chguy
Copy link
Member

t3chguy commented May 29, 2020

You would have to ask the support of that plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants