Skip to content

[WebProfilerExtension] Fixes escaping for a safe output with multiple roles #21385

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

Closed
wants to merge 1 commit into from
Closed

[WebProfilerExtension] Fixes escaping for a safe output with multiple roles #21385

wants to merge 1 commit into from

Conversation

linaori
Copy link
Contributor

@linaori linaori commented Jan 24, 2017

Q A
Branch? 3.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #21384
License MIT
Doc PR ~

This fixes the issue reported about escaping the the roles if multiple are shown. I don't think this should be filtered by twig as this was not present in the old version in 3.1. /cc @wouterj

@@ -66,7 +66,7 @@ public function leave(\Twig_Profiler_Profile $profile)
public function getFunctions()
{
$profilerDump = function (\Twig_Environment $env, $value, $maxDepth = 0) {
return $value instanceof Data ? $this->dumpData($env, $value, $maxDepth) : twig_escape_filter($env, $this->dumpValue($value));
return $value instanceof Data ? $this->dumpData($env, $value, $maxDepth) : $this->dumpValue($value);
Copy link
Member

Choose a reason for hiding this comment

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

this is wrong. The ValueExporter does not provide safe output (it does not handle escaping)

@stof
Copy link
Member

stof commented Jan 24, 2017

Btw, dumpValue is deprecated. So if the security panel really uses this code path, we should upgrade it.

@linaori
Copy link
Contributor Author

linaori commented Jan 24, 2017

Well, this was the old behavior and that worked (regardless of safe), which broke in 3.2. I indeed noticed the deprecation. Is the Data what's supposed to be fed to the profiler_dump function in twig via the Collectors?

I don't see any concrete implementations of this yet, can you point me at one or do you have an idea how this should be fixed in a generic way? To me it looks like all the DataCollectors have to be updated.

@stof
Copy link
Member

stof commented Jan 24, 2017

Well, we need to figure out where the double-escaping takes place exactly. But removing this one looks wrong to me. The ValueExporter is not escaping, meaning that this escaping cannot be removed (otherwise the output of the function is not safe anymore, thus lying to Twig and potentially opening XSS holes)

@stof
Copy link
Member

stof commented Jan 24, 2017

I just identifier the real source of the bug, so I'm closing this PR and will open one with the real fix

@stof stof closed this Jan 24, 2017
@linaori linaori deleted the fix/role-wdt branch January 24, 2017 09:19
@stof
Copy link
Member

stof commented Jan 24, 2017

see #21387 for the real fix (and the explanation of the bug)

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

Successfully merging this pull request may close these issues.

3 participants