Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
other
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Sep 2015 at 19:38 UTC
Updated:
30 Mar 2017 at 13:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
stefan.r commentedComment #3
lauriiiLet's see how this fails
Comment #6
plachThis is the final step of #2506427: [meta] !placeholder causes strings to be escaped and makes the sanitization API harder to understand and thus is critical.
Comment #7
plach#2571673: Convert Views t() usage where it is used as an attribute value will actually make this possible
Comment #8
andypostWould be great to use assert() here
Comment #9
dawehnerRemoved a couple of test failures.
Comment #10
plachOn this
Comment #12
xjmComment #13
xjmComment #14
plachRerolled this on top of #2571673: Convert Views t() usage where it is used as an attribute value and fixed more failures and stuff. Let's see how it works.
Comment #15
dawehnerWe should not change the behaviour of the default in this issue.
out of scope changes
Comment #16
plach1: I think we should, the docs say that's the recommended default behavior.
2: Those lines are removing the last parameter.
Comment #18
dawehnerWell, this is the thing. This will lead to another level of discussion, too bad. I'm fine with changing the behaviour now.
A good point.
Comment #19
plachFair enough
Comment #22
plachRerolled
Comment #23
stefan.r commentedDiscussed with @plach and will look at that test failure.
Comment #25
stefan.r commentedComment #26
stefan.r commentedComment #29
stefan.r commentedComment #30
stefan.r commentedComment #34
catchOpened #2575703: Remove default fall-through from PlaceholderTrait::placeholderFormat() for removing the default.
:)
Much better docs than last time I reviewed, and the comparison makes sense as well now.
:)
markup-escaped is the same as markup-markup
And escaped-escaped is the same as escaped-markup.
RTBC for me except for that last point.
Comment #35
dawehnerWorking on it
Comment #36
dawehnerComment #37
dawehnerComment #38
catchComment #39
plachThis depends on #2571673: Convert Views t() usage where it is used as an attribute value. I will reroll it as soon as that goes in.
Comment #40
dawehnerFound a leftover in the documentation.
Comment #41
plachHere's a reroll on top of the latest version of #2571695: Remove !placeholder and unsafe string return from SafeMarkup::format(). The review file includes only the changes performed here.
Setting to needs review for the bot, still postponed on #2571695: Remove !placeholder and unsafe string return from SafeMarkup::format().
Comment #42
plachNot sure what happened but only the last two patches should be taken into account.
Comment #43
plachAnd here it is (ignore the interdiff :)
Comment #44
dawehnerGood bye and thanks for all the fish!
Comment #46
dawehnerDear testbot, we don't have to like you!
Comment #47
alexpottNearly there!
Can remove the use
Comment #48
xjmI don't think we have a CR specifically for removing !placeholder yet, so we'll need that too.
Comment #49
dawehnerIt turned out to be harder than it was.
Comment #52
yesct commentedwhile working on #2570431: Document that certain (non-"href") attribute values in t() and SafeMarkup::format() are not supported and may be insecure I noticed that the third argument in protected static function placeholderFormat($string, array $args, &$safe = TRUE) is not used anywhere in core (and not tested directly). glad to see this issue will be removing the arg. I will keep working on 2570431, and assuming that arg will not be there makes writing the docs for the @param easier *grin*
Comment #53
dawehnerThank you @plach and @borisson_ for the quick help to fix it
Comment #54
dawehnerSomeone in a future will review something.
Comment #55
yesct commentedcross-post since sitting next to daniel and he fixed it fast.
this says it returns a string, but it sometimes returns value which could have been a SafeStringInterface object.
Comment #56
yesct commentedthis could use some inline comments.
Comment #57
dawehnerSome additional docs.
Comment #58
dawehnerLet's not make things harder.
Comment #60
yesct commentedmissing docs for this class.
unrelated change. (maybe an accident, change in indent looks wrong.)
unrelated change.
some more. might be worth looking for more in the file.
(I did not read every line very carefully.)
Comment #61
dawehnerRemoved a couple of unrelated changes.
Comment #62
yesct commentedthanks. those changes look good, adds the docs too.
there is a needs change record tag on the issue, so we either need a new change record, or add this issue to one to reuse (or both), before we can rtbc it.
Comment #63
dawehnerWe have a change record now.
Comment #64
plachLast changes look good!
Comment #65
yesct commentedThanks for adding the change record, adding words we talked about and issues. That along with the other recent improvments look good. rtbc.
Comment #66
jaredsmith commentedRe-rolled the patch from comment 61, removing the now obsoleted patches from ContactPersonalTest and core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, as those were handled separately in #2575599: Remove !placeholder in ContactPersonalTest and Drupal\migrate\Plugin\migrate\id_map\Sql.
Comment #67
dawehnerThanks! This will come back green
Comment #68
alexpottCommitted 3904439 and pushed to 8.0.x. Thanks!
I also credited everyone who worked on the original #2506445: Replace !placeholder with @placeholder in t() and format_string() for non-URLs in tests as that was a 500k patch that tried to do everything.
Comment #70
neclimdulNot sure where to file the follow up, seems this caused many messages in drush to show up like this:
Comment #71
berdirThat's because drush is still using !placeholders and because unknown placeholders fall through to %. #2575703: Remove default fall-through from PlaceholderTrait::placeholderFormat() would remove that and you'd get an error about an invalid placeholder instead, somehow.
Comment #72
anavarreFiled https://github.com/drush-ops/drush/issues/1637
Comment #73
neclimdulThis is a pretty big API break then deep in beta and I don't see signoff in the IS. Contrib will be affected by this as well (which explains why my migrate CI is unreadable this morning).
Comment #74
catch@neclimdul this was discussed in great depth both in the issue queue and on multiple hangouts, official sign-off/decision is mostly documented at #2506427: [meta] !placeholder causes strings to be escaped and makes the sanitization API harder to understand.
The tl;dr version is that we realised that leaving !placeholder in was going to result in a combination of double-escaping bugs and XSS via mis-use of SafeString to bypass the escaping, and the only way towards a consistent sanitization API was to do the hard BC break and remove the placeholder altogether.
However it took about 3 weeks to make that change across core, and the actual removal just landed in this issue.
I'm hoping to roll a new beta asap once #2570431: Document that certain (non-"href") attribute values in t() and SafeMarkup::format() are not supported and may be insecure lands so that there's a marker for contrib modules to upgrade to prior to the release candidate. This will feature prominently in the release notes.
Comment #75
neclimdulI'm not question the commit, just this is the issue that broke things. None of those things you mentioned are covered in the issue which is why I called attention to the IS. I should have tagged the summary for update.
Also, it might also be worth publishing the CR to alleviate some confusion from the disruption. I'm not sure "placeholdering" is a word though...
Comment #76
mpotter commentedIs there a task issue somewhere I cannot find to update the API documentation for t(). There are many places in the docs where it refers to the return of t() as a string value. In talking with various Drupal people, the knowledge of this change hasn't propagated much and is really going to surprise people. I was arguing with somebody who was pointing to the API and various things until I pulled the actual code to show them.
Even this issue was not very easy to find. Was trying to search for stuff like "drupal 8 t() no longer returns a string".
Comment #78
joachim commentedThis removed the Twig filter 'passthrough', but the change record doesn't mention that.
Comment #79
divined commentedcool, passthrough removed.
How to pass variable with html to trans now?
not works now =)