diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php index 7a0f5c0..dd462d5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php @@ -141,4 +141,18 @@ function testDateFormatStorage() { $format = config('locale.config.en.system.date')->get('formats.test_short_en.pattern.php'); $this->assertEqual('dmYHis', $format, 'Localized date format resides in localized config.'); } + + /** + * Test that date formats are sanitized. + */ + function testDateFormatXSS() { + $date_format_info = array( + 'name' => 'XSS format', + 'pattern' => array('php' => '\<\s\c\r\i\p\t\>\a\l\e\r\t\(\'\X\S\S\'\)\;\<\/\s\c\r\i\p\t\>'), + ); + system_date_format_save('xss_short', $date_format_info); + + $this->drupalGet('admin/config/regional/date-time'); + $this->assertNoRaw("", 'The date format was properly sanitized'); + } }