Repository navigation
Expand file tree
/
Copy pathdisallowed-calls.neon
More file actions
81 lines (80 loc) · 3.03 KB
/
Copy pathdisallowed-calls.neon
File metadata and controls
81 lines (80 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
parameters:
disallowedFunctionCalls:
-
function: 'pcntl_*()'
-
function: 'rand()'
message: 'it is not a cryptographically secure generator, use random_int() instead'
allowIn:
- tests/*.phpt
-
function: 'uniqid()'
message: 'it is not a cryptographically secure generator, use random_bytes() instead'
allowIn:
- tests/*.phpt
-
function: 'setcookie()'
message: 'use methods from MichalSpacekCz\Http\Cookies'
disallowedStaticCalls:
-
method: 'Tester\Environment::skip()'
message: 'use TestCaseRunner::skip() instead, it can ignore skipping with an environment variable'
allowInMethods:
- 'MichalSpacekCz\Test\TestCaseRunner::skip()'
disallowedMethodCalls:
-
method:
- 'Nette\Http\IRequest::getCookie()'
- 'Nette\Http\IResponse::setCookie()'
- 'Nette\Http\Response::deleteCookie()'
message: 'instead use methods from MichalSpacekCz\Http\Cookies'
allowInMethods:
- 'MichalSpacekCz\Http\Cookies\Cookies::getString()'
- 'MichalSpacekCz\Http\Cookies\Cookies::set()'
- 'MichalSpacekCz\Http\Cookies\Cookies::deleteCookie()'
- 'MichalSpacekCz\EasterEgg\CrLfUrlInjections::detectAttempt()' # Bot trolling, not for humans, the cookie is always expired
-
method:
- 'Nette\Application\Request::getPost()'
- 'Nette\Http\IRequest::getPost()'
message: 'instead use methods from MichalSpacekCz\Http\HttpInput with more handy return types'
allowInMethods:
- 'MichalSpacekCz\Http\HttpInput::getPostString()'
- 'MichalSpacekCz\Http\HttpInput::getPostArray()'
-
method: 'DateTimeZone::__construct()'
message: 'use MichalSpacekCz\DateTime\DateTimeZoneFactory::get() instead, throws a more specific exception'
allowInMethods:
- 'MichalSpacekCz\DateTime\DateTimeZoneFactory::get()'
disallowedConstants:
-
constant: 'LIBXML_NOENT'
message: 'libxml_disable_entity_loader() has been deprecated in PHP 8.0, no longer needed to protect against XXE attacks, unless the (still vulnerable) LIBXML_NOENT is used https://www.php.net/migration80.deprecated#migration80.deprecated.libxml'
disallowedSuperglobals:
-
superglobal: '$_SERVER'
message: 'use Application\ServerEnv instead'
allowIn:
- app/Application/ServerEnv.php
- tests/Application/ServerEnvTest.phpt
disallowedClasses:
-
class:
- 'Nette\Application\UI\Form'
- 'Nette\Forms\Form'
message: 'use MichalSpacekCz\Form\UiForm for better type declarations'
allowIn:
- app/Form/UiForm.php
- app/Form/Controls/TrainingControlsFactory.php
-
class:
- 'Spaze\PhpInfo\PhpInfo'
message: 'use MichalSpacekCz\Application\SanitizedPhpInfo with additional sanitization'
allowIn:
- app/Application/SanitizedPhpInfo.php
includes:
- vendor/spaze/phpstan-disallowed-calls/extension.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-insecure-calls.neon
- vendor/spaze/phpstan-disallowed-calls-nette/disallowed-dangerous-calls.neon