Closed (fixed)
Project:
Devel
Version:
8.x-1.x-dev
Component:
kint
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jun 2015 at 08:50 UTC
Updated:
29 Jun 2015 at 19:04 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
joshi.rohit100Its working fine for me.
Comment #2
fgmJust pulled core and devel again, reinstalled, and got the same result. Look at screen captures: one shows the result, the other one shows the faulty markup.
Notice how the kint code starts straight within a Seven block
div, without a<script>to wrap it.More info, just in case : this is PHP 5.6 on Ubuntu 12.04.2 LTS, running in mod_apache, which is probably a configuration a bit exotic. Tried with and without APCu, just in case.
Comment #3
willzyx commentedI can reproduce this issue on a drupal and devel HEAD version. It was introduced by #2273925: Ensure #markup is XSS escaped in Renderer::doRender(). I am studying how to fix it but for the moment the use of SafeMarkup::set() seems-the only way :(
Comment #4
joelpittet@willzyx you need to tell the template that the markup is safe. Ideally you'd filter out anything harmful first if at all possible.
I think SafeMarkup::set() is what you have to use here. The only other approach you can take is using Twig_Markup object from Twig, which does the same thing if you are worried about making that safeStrings array any bigger.
Please document the hell out of using that variable though. Saying why it's safe and where the markup comes from.
If the JS can be #attached as a library that would be ideal for caching and other niceties.
But things like this are a bit inevitable in third party:
Comment #5
willzyx commented@joelpittet thanks for suggestions!
sure, but the owner of these assets is the thirdy part lib so there is not to much we can do
I tried SafeMarkup:set() approach and it solves the issue. It would be interesting to see how this approach impacts on memory usage
Comment #6
joelpittetYeah I understand, they have embedded the script tags in the output, not much you can do there.
They are set as array keys but keep tabs on @pwolanin's work on that memory, it's getting traded for cpu with a hash and once we fix the 1 failure we can performance test it.
#2503445: Modify SafeMarkup to use hashed strings from marked strings to minimize memory usage
Comment #7
fgmOn the other hand, these pages are quite specifically not performance targets since they are used for debugging only, not in production.
Comment #8
pwolanin commentedCan you wrap the output in a Twig_Markup object? That will bypass the auto escape, and seems like it might be viable for a big bloc of html that doesn't need more processing and is known safe.
Comment #9
pwolanin commentedSo - the patch here doesn't work for me with a minimal install - is something else happening in the theme?
Comment #10
willzyx commentedThe patch in #5 seems to work for me even with minimal profile, the output is not processed and kint output is shown correctly.
Trying to wrap the output in a \Twig_Markup object (directly or with inline_template) the output is still processed and stripped and the result is the same of that shown in the IS
Comment #11
pwolanin commentedCan you provide more steps to show what you tried? Are you using the latest 8.0.x from git?
Comment #12
willzyx commentedsure, commit 77e9bbe983acecd227c4a470f94629f113ae090e
This is what I tried:
1)
<script>tags are stripped2)
<script>tags are strippedIn DevelController ::entityRender and ::entityLoad kdevel_print_object is used in this way
probably I'm doing something wrong, I'm not very familiar with twig
Comment #13
pwolanin commentedah, I didn't have kint module enabled, now I see it.
I guess at least add a @todo to come back to this
Comment #14
xjmAdding the tag we use in core so I can find this again.
Comment #15
pwolanin commentedsee: #2273925: Ensure #markup is XSS escaped in Renderer::doRender() for possibly why it's getting escaped now
Comment #16
willzyx commentedcorrect me if I'm wrong:
'#markup' => new \Twig_Markup(...)doesn't work since there isn't a special handling for Twig_Markup in Renderer::doRender()The only solution is use SafeMarkup::set(), right?
Comment #17
willzyx commentedSince a lot of functionalities of devel are broken by this issue I'm commit patch in #5.
If you find a better and less memory hungry solution, you can open a followup
Thanks to everyone