Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid calling eval when there is no script embedded in the toolbar#27584

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.1fromstof:fix_csp_eval
Jun 13, 2018

Conversation

@stof
Copy link
Member

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#27583
LicenseMIT
Doc PRn/a

#27189 changed the way embedded scripts were eval'd for the toolbar. But it also refactored the code in a way triggeringeval all the time, even when there is no embedded script, which was reported several times as an issue with CSP.

While the debug panel (showing dumps) still requires havingunsafe-eval in the CSP header (due to embedding scripts that we eval), this PR reverts back to the behavior of Symfony 4.0 and older, where only toolbars actually embedding scripts have this CSP compat issue.

Jonathanlight and rpkamp reacted with thumbs up emoji
returnscript.firstChild.nodeValue;
}).join(';\n')));
var i, scripts= [].slice.call(el.querySelectorAll('script'));
for (i=0; i<scripts.length;++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not definei inside the loop?for (var i..., that way you can be sure you won't get any scope bleeding.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Because this variable is not only used by this loop but also by next ones. Putting it inside the loop might make us remove the variable declaration by mistake in a refactoring, which would make us use a global variable here.

that way you can be sure you won't get any scope bleeding.

That's wrong. It would be true when usinglet, but not forvar (which is scoped only by functions, not by loops)

Copy link
Contributor

Choose a reason for hiding this comment

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

I was confusing it withlet indeed. In case ofvar this is indeed better 👍

@fabpot
Copy link
Member

Thank you@stof.

@fabpotfabpot merged commita0f78a5 intosymfony:4.1Jun 13, 2018
fabpot added a commit that referenced this pull requestJun 13, 2018
… toolbar (stof)This PR was merged into the 4.1 branch.Discussion----------Avoid calling eval when there is no script embedded in the toolbar| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#27583| License       | MIT| Doc PR        | n/a#27189 changed the way embedded scripts were eval'd for the toolbar. But it also refactored the code in a way triggering `eval` all the time, even when there is no embedded script, which was reported several times as an issue with CSP.While the debug panel (showing dumps) still requires having `unsafe-eval` in the CSP header (due to embedding scripts that we eval), this PR reverts back to the behavior of Symfony 4.0 and older, where only toolbars actually embedding scripts have this CSP compat issue.Commits-------a0f78a5 Avoid calling eval when there is no script embedded in the toolbar
@ogizanagi
Copy link
Contributor

I'm late but thank you taking care of this@stof 👍

@fabpotfabpot mentioned this pull requestJun 25, 2018
@stofstof deleted the fix_csp_eval branchJuly 24, 2018 07:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@rpkamprpkamprpkamp left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@stof@fabpot@ogizanagi@rpkamp@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp