Check_url marks URIs as safe although in the current code base this is never actually necessary as the output is being using directly in a template or in SafeMarkup::format or t(). Therefore we can just use UrlHelper::stripDangerousProtocols() and let the auto escape magic work.

Also this helps with remove one of the use cases for !raw support in SafeMarkup::format().

This is a bug because strings ending up in the SafeMarkup safe list unnecessarily is wrong.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug, because we are doing a SafeMarkup::checkPlain(), which ideally should not be there. This is not output level code.
Issue priority Normal, because this just removes one ::checkPlain() call
Disruption No disruption. The URLs are still escaped, so no security problem. For code which passes check_url() results onto template it will be double escaped, but we have a CR for that
CommentFileSizeAuthor
#2 2545906.2.patch5.3 KBalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
StatusFileSize
new5.3 KB

The patch seems quite simple.

dawehner’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Looks perfect for me.

Added a beta evaluation and a change record.

alexpott’s picture

Status: Reviewed & tested by the community » Postponed

Postponing on #2545972: Remove all code usages SafeMarkup::checkPlain() and rely more on Twig autoescaping as that is adding Html::encodeEntities() that would be used here.

alexpott’s picture

mgifford’s picture

Status: Postponed » Needs review

mgifford queued 2: 2545906.2.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 2: 2545906.2.patch, failed testing.

joelpittet’s picture

Status: Needs work » Closed (duplicate)

This got superseded by the colon url placeholder in part and the other the Html::escape() changes.