reverted: --- b/core/lib/Drupal/Component/Utility/PlaceholderTrait.php +++ a/core/lib/Drupal/Component/Utility/PlaceholderTrait.php @@ -56,14 +56,6 @@ $args[$key] = Html::escape(UrlHelper::stripDangerousProtocols($value)); break; - case ':': - // URL attributes must be escaped unconditionally (even if they were - // already marked safe) since content that has been filtered for XSS - // can still contain characters that are unsafe for use in attributes. - // @todo decide what to do about non-URL attribute values (#2570431) - $args[$key] = Html::escape(UrlHelper::stripDangerousProtocols($value)); - break; - case '!': // Pass-through. if (!SafeMarkup::isSafe($value)) { reverted: --- b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php +++ a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php @@ -118,7 +118,7 @@ ); $image_style_mapping = $responsive_image_style->getImageStyleMapping($breakpoint_id, $multiplier); if (\Drupal::moduleHandler()->moduleExists('help')) { + $description = $this->t('See the Responsive Image help page for information on the sizes attribute.', array('!responsive_image_help' => (\Drupal::url('help.page', array('name' => 'responsive_image'))))); - $description = $this->t('See the Responsive Image help page for information on the sizes attribute.', array(':responsive_image_help' => (\Drupal::url('help.page', array('name' => 'responsive_image'))))); } else { $description = $this->t('Enable the Help module for more information on the sizes attribute.'); reverted: --- b/core/modules/system/src/Form/CronForm.php +++ a/core/modules/system/src/Form/CronForm.php @@ -107,7 +107,7 @@ ); $form['cron_url'] = array( + '#markup' => '

' . t('To run cron from outside the site, go to !cron', array('!cron' => $this->url('system.cron', array('key' => $this->state->get('system.cron_key')), array('absolute' => TRUE)))) . '

', - '#markup' => '

' . t('To run cron from outside the site, go to :cron', array(':cron' => $this->url('system.cron', array('key' => $this->state->get('system.cron_key')), array('absolute' => TRUE)))) . '

', ); $form['cron'] = array( reverted: --- b/core/modules/system/src/Form/PerformanceForm.php +++ a/core/modules/system/src/Form/PerformanceForm.php @@ -141,7 +141,7 @@ $disabled = !$is_writable; $disabled_message = ''; if (!$is_writable) { + $disabled_message = ' ' . t('Set up the public files directory to make these optimizations available.', array('!file-system' => $this->url('system.file_system_settings'))); - $disabled_message = ' ' . t('Set up the public files directory to make these optimizations available.', array(':file-system' => $this->url('system.file_system_settings'))); } $form['bandwidth_optimization'] = array( reverted: --- b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php +++ a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php @@ -32,16 +32,6 @@ /** - * {@inheritdoc} - */ - protected function tearDown() { - parent::tearDown(); - - UrlHelper::setAllowedProtocols(['http', 'https']); - } - - - /** * Helper function to add a string to the safe list for testing. * * @param string $string @@ -258,20 +248,6 @@ $tests['non-url-with-colon'] = ['Hey giraffe MUUUH', [':url' => "llamas: they are not URLs"], 'Hey giraffe MUUUH', '', TRUE]; $tests['non-url-with-html'] = ['Hey giraffe MUUUH', [':url' => "not a url"], 'Hey giraffe MUUUH', '', TRUE]; - $tests['javascript-protocol-url'] = ['Simple text giraffe', [':url' => 'javascript://example.com?foo&bar'], 'Simple text giraffe', 'Support for filtering bad protocols', TRUE]; - $tests['external-url'] = ['Simple text giraffe', [':url' => 'http://example.com?foo&bar'], 'Simple text giraffe', 'Support for filtering bad protocols', TRUE]; - $tests['relative-url'] = ['Simple text giraffe', [':url' => '/node/1?foo&bar'], 'Simple text giraffe', 'Support for filtering bad protocols', TRUE]; - $tests['fragment-with-special-chars'] = ['Simple text giraffe', [':url' => 'http://example.com/#<'], 'Simple text giraffe', 'Support for filtering bad protocols', TRUE]; - $tests['mailto-protocol'] = ['Hey giraffe MUUUH', [':url' => 'mailto:test@example.com'], 'Hey giraffe MUUUH', '', TRUE]; - $tests['js-with-fromCharCode'] = ['Hey giraffe MUUUH', [':url' => "javascript:alert(String.fromCharCode(88,83,83))"], 'Hey giraffe MUUUH', '', TRUE]; - - // Test some "URL" values that are not RFC 3986 compliant URLs. The result - // of SafeMarkup::format() should still be valid HTML (other than the - // value of the "href" attribute not being a valid URL), and not - // vulnerable to XSS. - $tests['non-url-with-colon'] = ['Hey giraffe MUUUH', [':url' => "llamas: they are not URLs"], 'Hey giraffe MUUUH', '', TRUE]; - $tests['non-url-with-html'] = ['Hey giraffe MUUUH', [':url' => "not a url"], 'Hey giraffe MUUUH', '', TRUE]; - return $tests; }