diff --git a/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php b/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php deleted file mode 100644 index 0fe792f4..00000000 --- a/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ - public function register() { - return Tokens::$textStringTokens; - } - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param int $stackPtr The position of the current token in the stack passed in $tokens. - * - * @return void - */ - public function process_token( $stackPtr ) { - // Strip any potentially interpolated expressions. - $only_text = $this->tokens[ $stackPtr ]['content']; - if ( $this->tokens[ $stackPtr ]['code'] === T_DOUBLE_QUOTED_STRING - || $this->tokens[ $stackPtr ]['code'] === T_HEREDOC - ) { - $only_text = TextStrings::stripEmbeds( $only_text ); - } - - if ( preg_match( '/autoescape\s+false/', $only_text ) === 1 ) { - // Twig autoescape disabled. - $message = 'Found Twig autoescape disabling notation.'; - $this->phpcsFile->addWarning( $message, $stackPtr, 'AutoescapeFalse' ); - } - - if ( preg_match( '/\|\s*raw/', $only_text ) === 1 ) { - // Twig default unescape filter. - $message = 'Found Twig default unescape filter: "|raw".'; - $this->phpcsFile->addWarning( $message, $stackPtr, 'RawFound' ); - } - } -} diff --git a/WordPressVIPMinimum/Tests/Security/TwigUnitTest.inc b/WordPressVIPMinimum/Tests/Security/TwigUnitTest.inc deleted file mode 100644 index 0e766537..00000000 --- a/WordPressVIPMinimum/Tests/Security/TwigUnitTest.inc +++ /dev/null @@ -1,60 +0,0 @@ - - - - -{% autoescape false %} - Everything will be outputted as is in this block -{% endautoescape %} - -{% autoescape %} - {{ safe_value|raw }} -{% endautoescape %} -'; - -echo " -"; - -echo <<<'EOD' - -EOD; - -echo << -{% autoescape false %} - Everything will be $outputted as is in this {$obj->blocks[SOME_FLAG | raw]->name} -{% endautoescape %} -EOD; -echo <<<"EOD" -{% autoescape %} - {{ safe_value|raw }} -{% endautoescape %} - -EOD; diff --git a/WordPressVIPMinimum/Tests/Security/TwigUnitTest.php b/WordPressVIPMinimum/Tests/Security/TwigUnitTest.php deleted file mode 100644 index 0cea1379..00000000 --- a/WordPressVIPMinimum/Tests/Security/TwigUnitTest.php +++ /dev/null @@ -1,47 +0,0 @@ - Key is the line number, value is the number of expected errors. - */ - public function getErrorList() { - return []; - } - - /** - * Returns the lines where warnings should occur. - * - * @return array Key is the line number, value is the number of expected warnings. - */ - public function getWarningList() { - return [ - 5 => 1, - 10 => 1, - 17 => 1, - 22 => 1, - 27 => 1, - 32 => 1, - 39 => 1, - 44 => 1, - 51 => 1, - 57 => 1, - ]; - } -} diff --git a/WordPressVIPMinimum/ruleset.xml b/WordPressVIPMinimum/ruleset.xml index f5bdb847..2a45818a 100644 --- a/WordPressVIPMinimum/ruleset.xml +++ b/WordPressVIPMinimum/ruleset.xml @@ -27,10 +27,6 @@ - - *\.twig - -