Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
filter.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2015 at 18:37 UTC
Updated:
27 Aug 2015 at 14:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
harjotsingh commentedComment #3
wim leersI think this is what you wanted to do? :)
Comment #4
wim leersCan you reupload the patch please?
Comment #5
harjotsingh commentedYes indeed, thanks for help.
Patch re-uploaded.
Comment #7
harjotsingh commentedComment #8
sdstyles commented#5 Re-roll
Comment #9
harjotsingh commentedThe method doesn't work without SafeMarkup::set() call, have to look for a alternative.
Comment #12
sdstyles commentedComment #13
stefan.r commentedC14N()
Otherwise this looks to be OK, this also already has test coverage through FilterUnitTest
Comment #14
sdstyles commentedFixed typo in #12, thanks.
Comment #15
harjotsingh commentedShouldn't we remove the line
use Drupal\Component\Utility\SafeMarkup;
Comment #16
wim leers#15: yes, thanks :)
Comment #18
wim leers#15: ehm, no, there are other things still using methods on
SafeMarkup.Re-uploading #14 and RTBC'ing it.
Comment #20
alexpottSo SafeString::create() has some of the same issues that SafeMarkup::set() has since it can easily introduce XSS if used incorrectly. However it is way better because it does not have side effects. I think we should tackle #2544684: Expand @internal documentation on SafeString and SafeStringInterface and introduce ViewsRenderPipelineSafeString first. And document the beejeebus out of when and where to use it because I can't see another way of doing this sanely.
Comment #21
stefan.r commentedLet's postpone on that issue and add a comment explaining why we have to use the unsanitized canonicalized node here?
Comment #22
wim leersWhy: because this is a text format filter, and after filtering, we always assume the output is safe. We have to. See #2273925: Ensure #markup is XSS escaped in Renderer::doRender(), which added this to
\Drupal\filter\Element\ProcessedText::preRenderText():This is simply part of that.
Comment #23
stefan.r commentedHeh, I meant a code comment :)
I misread "document the beejeebus out of when and where to use it" as "document the beejeebus out of whenever and wherever we use it", but actually the latter is not a bad idea either...
Comment #24
stefan.r commentedper #2544684: Expand @internal documentation on SafeString and SafeStringInterface and introduce ViewsRenderPipelineSafeString
Comment #25
wim leersI think it'd be a good idea to also change
to
in
\Drupal\filter\Element\ProcessedText::preRenderText().Other than that, I have no remarks :)
Comment #26
stefan.r commentedI was about to open another issue for that but may as well add that in here :)
Comment #27
stefan.r commentedComment #28
wim leersComment #29
stefan.r commentedoops
Comment #30
stefan.r commentedComment #33
wim leers#29: heh, indeed. I also missed it.
Looks like we need one more string cast or equality instead of identicalness assertion.
Comment #34
stefan.r commentedActually the problem is with Views. When we go to
test/serialize/node-field?_format=json, inDrupal\views\Plugin\views\field\FieldPluginBase::advancedRender()we call ::renderText(), where we append an empty string to $value SafeString so it becomes unsafe again and gets escaped later on.Comment #35
stefan.r commentedMaybe just this workaround to make tests pass and we address the bug in a followup?
Comment #36
stefan.r commentedComment #37
alexpottI think the problem you're running into will be fixed by #2501931: Remove SafeMarkup::set in twig_render_template() and ThemeManager and FieldPluginBase:advancedRender
Comment #38
stefan.r commented@alexpott #30 works when using the patch in that issue so let's postpone this on that issue being committed.
We could then re-RTBC #30 if it's green on re-testing.
Comment #41
stefan.r commentedComment #43
wim leersComment #46
wim leersComment #47
stefan.r commentedNo it's fine, I queued the wrong patch -- it's #30 (which is green now) we want to commit , not #36.
Comment #48
wim leersOh, okay. Could you reupload #30 then, to avoid confusion?
Comment #49
sdstyles commentedRe-uploaded #30
Comment #50
alexpottThis will need a retest.
Comment #52
wim leersSo… #2501931: Remove SafeMarkup::set in twig_render_template() and ThemeManager and FieldPluginBase:advancedRender didn't fix it after all?
Comment #54
stefan.r commentedI think it did, because 30 is green
Comment #55
alexpottSo we had a timing issue with reverting #2501931: Remove SafeMarkup::set in twig_render_template() and ThemeManager and FieldPluginBase:advancedRender I think we're good to here.
Comment #56
wim leersThen we're good to go here :)
Comment #57
alexpottAnother one bites the dust. Committed 531d0a4 and pushed to 8.0.x. Thanks!