File tree 6 files changed +56
-0
lines changed
packages/typo3-docs-theme
tests/Integration/tests/raw-forbidden 6 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 15
15
use phpDocumentor \Guides \RestructuredText \Parser \Productions \DirectiveContentRule ;
16
16
use Symfony \Component \DependencyInjection \Loader \Configurator \ContainerConfigurator ;
17
17
18
+ use T3Docs \Typo3DocsTheme \Directives \RawDirective ;
18
19
use T3Docs \Typo3DocsTheme \EventListeners \AddThemeSettingsToProjectNode ;
19
20
use T3Docs \Typo3DocsTheme \EventListeners \CopyResources ;
20
21
use T3Docs \Typo3DocsTheme \Directives \GroupTabDirective ;
59
60
->public ()
60
61
61
62
->set (GroupTabDirective::class)
63
+ ->set (RawDirective::class)
62
64
->set (T3FieldListTableDirective::class)
63
65
->set (YoutubeDirective::class)
64
66
->set (CodeHighlight::class)
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of phpDocumentor.
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ * @link https://phpdoc.org
12
+ */
13
+
14
+ namespace T3Docs \Typo3DocsTheme \Directives ;
15
+
16
+ use phpDocumentor \Guides \RestructuredText \Directives \ActionDirective ;
17
+ use phpDocumentor \Guides \RestructuredText \Parser \BlockContext ;
18
+ use phpDocumentor \Guides \RestructuredText \Parser \Directive ;
19
+ use Psr \Log \LoggerInterface ;
20
+
21
+ final class RawDirective extends ActionDirective
22
+ {
23
+ public function __construct (
24
+ private readonly LoggerInterface $ logger
25
+ ) {}
26
+
27
+ public function getName (): string
28
+ {
29
+ return 'raw ' ;
30
+ }
31
+
32
+ public function processAction (BlockContext $ blockContext , Directive $ directive ): void
33
+ {
34
+ $ this ->logger ->error ('The raw directive is not supported for security reasons. ' , $ blockContext ->getLoggerInformation ());
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ <!-- content start -->
2
+ < section class ="section " id ="raw-directive-must-not-work ">
3
+ < h1 > Raw directive must not work< a class ="headerlink " href ="#raw-directive-must-not-work " data-bs-toggle ="modal " data-bs-target ="#linkReferenceModal " title ="Reference this headline "> ¶</ a > </ h1 >
4
+
5
+ </ section >
6
+
7
+ <!-- content end -->
Original file line number Diff line number Diff line change
1
+ app.ERROR: The raw directive is not supported for security reasons.
Original file line number Diff line number Diff line change
1
+ app.ERROR: The raw directive is not supported for security reasons.
Original file line number Diff line number Diff line change
1
+ ===========================
2
+ Raw directive must not work
3
+ ===========================
4
+
5
+ .. raw :: html
6
+
7
+ <div style =" background-color : red ; color : black ;" >This HTML must not show!!</div >
8
+
9
+ <script >alert (' Some very bad JavaScript works!!!' ) </script >
You can’t perform that action at this time.
0 commit comments