diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aca616..77aa2f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ master ------ * Added rule to ban shell execution via backticks +* Added rule to ban print statements v1.0.0 ------ diff --git a/README.md b/README.md index 13060c4..03642a6 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,11 @@ parameters: - system - var_dump + # enable detection of print statements + - + type: Expr_Print + functions: null + # enable detection of shell execution by backticks - type: Expr_ShellExec diff --git a/extension.neon b/extension.neon index 9bdad7b..1ebe93b 100644 --- a/extension.neon +++ b/extension.neon @@ -41,6 +41,11 @@ parameters: - system - var_dump + # enable detection of print statements + - + type: Expr_Print + functions: null + # enable detection of shell execution by backticks - type: Expr_ShellExec diff --git a/snippets/print.php b/snippets/print.php new file mode 100644 index 0000000..813bc16 --- /dev/null +++ b/snippets/print.php @@ -0,0 +1,3 @@ + 'Expr_Eval'], ['type' => 'Expr_Exit'], ['type' => 'Expr_FuncCall', 'functions' => ['debug_backtrace', 'dump']], + ['type' => 'Expr_Print'], ['type' => 'Expr_ShellExec'], ]); $this->scope = $this->createMock(Scope::class); @@ -136,6 +138,7 @@ public function getHandledNodes(): \Generator { yield [new Eval_($this->createMock(Expr::class))]; yield [new Exit_()]; + yield [new Print_($this->createMock(Expr::class))]; yield [new ShellExec([''])]; } }