[upstream] [TASK] Implement and apply custom PHPStan rule to harden unserialize#8
Open
github-actions[bot] wants to merge 1 commit into
Open
[upstream] [TASK] Implement and apply custom PHPStan rule to harden unserialize#8github-actions[bot] wants to merge 1 commit into
unserialize#8github-actions[bot] wants to merge 1 commit into
Conversation
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> (cherry picked from commit aaf921cac61974529fd5ac8c4936e6de4ffb6dc9)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automatisch vorgeschlagener Cherry-pick aus TYPO3-CMS/form @ 14.3.
Upstream-Commit
aaf921cac61974529fd5ac8c4936e6de4ffb6dc9Commit-Message
Upstream-Commit-Message anzeigen
Erzeugt von
.github/workflows/upstream-sync.yml.Um diesen Commit künftig nicht erneut vorzuschlagen, schließe die PR ohne Merge — der Marker unten bleibt erhalten.