Skip to content

Move to stricter CSP - #11028

Merged
rullzer merged 3 commits into
masterfrom
feature/no_eval_csp
Oct 14, 2018
Merged

Move to stricter CSP#11028
rullzer merged 3 commits into
masterfrom
feature/no_eval_csp

Conversation

@rullzer

@rullzerrullzer commented Sep 3, 2018

Copy link
Copy Markdown
Member

Do not allow unsafe eval by default.

🚧

Last merge for https://github.com/orgs/nextcloud/projects/18
This will be rebased several times to validate CSP behavior

TODO:

  • This will kill of OC.AddScript converted by mr @ChristophWurst
    • Need to look into affected apps

@rullzerrullzer added the 2. developing Work in progress label Sep 3, 2018
@rullzerrullzer added this to the Nextcloud 15 milestone Sep 3, 2018
@rullzer

Copy link
Copy Markdown
MemberAuthor

Next one:

@rullzer

Copy link
Copy Markdown
MemberAuthor

So I think this is good to get in.

Other stuff we should fix once we run into it.
But if we merge it we can announce it for 15 so app devs can start preparing as well.

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this

@@ -49,7 +49,7 @@ class ContentSecurityPolicy extends EmptyContentSecurityPolicy {
* TODO: Disallow per default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@ChristophWurst

Copy link
Copy Markdown
Member

This will kill of OC.AddScript

* Need to look into affected apps

https://github.com/search?q=%22OC.AddScript%22&type=Code have fun 🙈

@ChristophWurstChristophWurst added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 9, 2018
@ChristophWurst

Copy link
Copy Markdown
Member

💥
bildschirmfoto von 2018-10-09 08-50-24

@MorrisJobke

Copy link
Copy Markdown
Member
  • Need to look into affected apps

I only have found richdocuments and files_texteditor. 🤷‍♂️

@ChristophWurstChristophWurst added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 9, 2018
@ChristophWurst

Copy link
Copy Markdown
Member

I only have found richdocuments and files_texteditor. man_shrugging

I've pushed my fix that replaces the eval code with $.getScript. Could you please test if this actually works for these apps?

@rullzer

Copy link
Copy Markdown
MemberAuthor

@ChristophWurst richdocuments still works with this! yay!

Comment thread.htaccess Outdated
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 /
ErrorDocument 404 /

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and didn't explode 👍

@MorrisJobkeMorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 10, 2018
@MorrisJobke

Copy link
Copy Markdown
Member

JS unit fails.

PhantomJS 2.1.1 (Linux 0.0.0) OC.L10N tests plurals generates plural for default text when translation does not exist FAILED
Expected spy warn to have been called.
core/js/tests/specs/l10nSpec.js:90:41
PhantomJS 2.1.1 (Linux 0.0.0) OC.L10N tests plurals generates plural with default function when no forms specified FAILED
Expected spy warn to have been called.
core/js/tests/specs/l10nSpec.js:110:41
TypeError: undefined is not an object (evaluating 'locale.length') in core/js/l10n.js (line 9)
_getPlural@core/js/l10n.js:9:5835
translatePlural@core/js/l10n.js:9:4906
[native code]
checkPlurals@core/js/tests/specs/l10nSpec.js:73:6
core/js/tests/specs/l10nSpec.js:111:16
PhantomJS 2.1.1 (Linux 0.0.0) OC.L10N tests plurals generates plural with generated function when forms is specified FAILED
TypeError: undefined is not an object (evaluating 'locale.length') in core/js/l10n.js (line 9)
_getPlural@core/js/l10n.js:9:5835
translatePlural@core/js/l10n.js:9:4906
[native code]
checkPlurals@core/js/tests/specs/l10nSpec.js:73:6
core/js/tests/specs/l10nSpec.js:118:16
PhantomJS 2.1.1 (Linux 0.0.0) OC.L10N tests plurals generates plural with function when forms is specified as function FAILED
TypeError: undefined is not an object (evaluating 'locale.length') in core/js/l10n.js (line 9)
_getPlural@core/js/l10n.js:9:5835
translatePlural@core/js/l10n.js:9:4906
[native code]
checkPlurals@core/js/tests/specs/l10nSpec.js:73:6
core/js/tests/specs/l10nSpec.js:130:16
PhantomJS 2.1.1 (Linux 0.0.0) OC.L10N tests async loading of translations calls callback if translation already available FAILED
Expected spy warn to have been called.
core/js/tests/specs/l10nSpec.js:167:41

@MorrisJobkeMorrisJobke added 2. developing Work in progress and removed 4. to release Ready to be released and/or waiting for tests to finish labels Oct 11, 2018
rullzerand others added 3 commits October 14, 2018 20:45
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
No more weird eval to construct a plural function.
We just use the plural function from symfony.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer
rullzer merged commit 82a5833 into masterOct 14, 2018
@rullzer
rullzer deleted the feature/no_eval_csp branch October 14, 2018 19:17
@rullzerrullzer added 4. to release Ready to be released and/or waiting for tests to finish and removed 2. developing Work in progress labels Oct 14, 2018
@tcitworldtcitworld mentioned this pull request Oct 18, 2018
30 tasks
@MorrisJobke

Copy link
Copy Markdown
Member

@Arvidas mind to open a new ticket and link here?

tcitworld added a commit that referenced this pull request Dec 12, 2020
JS unsafe-eval was removed a long time ago in #11028
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rullzer@ChristophWurst@MorrisJobke