Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
220
Merge Requests
220
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
0f9ebb2a
Commit
0f9ebb2a
authored
Jul 20, 2015
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2512106
by cilefen, droplet, alexpott: Inline templates are XSS filtered incorrectly
parent
484b071d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
core/lib/Drupal/Core/Template/TwigEnvironment.php
core/lib/Drupal/Core/Template/TwigEnvironment.php
+4
-1
core/modules/system/src/Tests/Module/UninstallTest.php
core/modules/system/src/Tests/Module/UninstallTest.php
+4
-0
core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
+2
-2
No files found.
core/lib/Drupal/Core/Template/TwigEnvironment.php
View file @
0f9ebb2a
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\Core\Template
;
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\Core\PhpStorage\PhpStorageFactory
;
/**
...
...
@@ -201,7 +202,9 @@ public function getTemplateClass($name, $index = NULL) {
public
function
renderInline
(
$template_string
,
array
$context
=
array
())
{
// Prefix all inline templates with a special comment.
$template_string
=
'{# inline_template_start #}'
.
$template_string
;
return
$this
->
loadTemplate
(
$template_string
,
NULL
)
->
render
(
$context
);
// @todo replace with object implementating SafeStringInterface in
// https://www.drupal.org/node/2506581.
return
SafeMarkup
::
set
(
$this
->
loadTemplate
(
$template_string
,
NULL
)
->
render
(
$context
));
}
}
core/modules/system/src/Tests/Module/UninstallTest.php
View file @
0f9ebb2a
...
...
@@ -57,6 +57,10 @@ function testUninstallPage() {
$this
->
drupalGet
(
'admin/modules/uninstall'
);
$this
->
assertTitle
(
t
(
'Uninstall'
)
.
' | Drupal'
);
// Be sure labels are rendered properly.
// @see regression https://www.drupal.org/node/2512106
$this
->
assertRaw
(
'<label for="edit-uninstall-node" class="module-name table-filter-text-source">Node</label>'
);
$this
->
assertText
(
\
Drupal
::
translation
()
->
translate
(
'The following reason prevents Node from being uninstalled:'
));
$this
->
assertText
(
\
Drupal
::
translation
()
->
translate
(
'There is content for the entity type: Content'
));
// Delete the node to allow node to be uninstalled.
...
...
core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
View file @
0f9ebb2a
...
...
@@ -41,10 +41,10 @@ public function testInlineTemplate() {
$unsafe_string
=
'<script>alert(\'Danger! High voltage!\');</script>'
;
$element
[
'test'
]
=
array
(
'#type'
=>
'inline_template'
,
'#template'
=>
'test-with-context
{{ unsafe_content }}
'
,
'#template'
=>
'test-with-context
<label>{{ unsafe_content }}</label>
'
,
'#context'
=>
array
(
'unsafe_content'
=>
$unsafe_string
),
);
$this
->
assertEqual
(
$renderer
->
renderRoot
(
$element
),
'test-with-context
'
.
SafeMarkup
::
checkPlain
(
$unsafe_string
)
);
$this
->
assertEqual
(
$renderer
->
renderRoot
(
$element
),
'test-with-context
<label>'
.
SafeMarkup
::
checkPlain
(
$unsafe_string
)
.
'</label>'
);
// Enable twig_auto_reload and twig_debug.
$settings
=
Settings
::
getAll
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment