Repository navigation
Commit de09ba1
[TASK] Implement and apply custom PHPStan rule to harden
This patch integrates a custom PHPStan rule to detect unsecure or
invalid calls to the `unserialize` function. The rule was copied over
from [1] and may get removed again once it is merged into PHPStan core.
As a consequence, remaining potentially insecure `unserialize` calls
are covered by `@phpstan-ignore` annotations. This affects the following
code parts:
* `AuthenticatedMessageDeserializer`: Doing `unserialize` with
`['allowed_classes' => true]` at this point is intended, as the
relevant integrity check already happens via HMAC validation.
* `ActionController`: Same here (HMAC validation)
* `FormRuntime`: Same here (HMAC validation)
* Tests: Doing insecure `unserialize` in tests is currently ignored,
because the effect of having potential security leaks is extreme low.
To allow PHPStan to properly detect the types used for `unserialize` in
`PackageCacheEntry`, this class now receives higher type coverage.
[1]: phpstan/phpstan-src#4754
Resolves: #110120
Releases: main, 14.3, 13.4
Change-Id: I04255241d697703c27ad6c557b8f917f0a70e329
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/94648
Reviewed-by: Garvin Hicking <garvin@hick.ing>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Garvin Hicking <garvin@hick.ing>unserialize
1 parent a879c47 commit de09ba1
4 files changed
Lines changed: 4 additions & 1 deletion
File tree
- Classes/Mvc/Controller
- Tests
- Functional/Persistence
- Unit/Reflection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
| 653 | + | |
653 | 654 | | |
654 | 655 | | |
655 | 656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
0 commit comments