-
Notifications
You must be signed in to change notification settings - Fork 7.8k
@strict-properties
can be bypassed using unserialization
#9186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@strict-properties
can be bypassed using serialization@strict-properties
can be bypassed using unserialization
The problem is php-src/ext/random/randomizer.c Line 280 in 9e2de4c
That initializes any given property. We likely want to catch cases where undeclared properties are given. |
I assumed as much. But I was not able to determine, whether ext/random should've used a different function (making this a bug in ext/random) or whether the function itself should be fixed (not making this a bug in ext/random). |
Good question! It seems to me that the dynamic properties deprecation missed unserialization and related things. E.g. https://3v4l.org/FUgco/rfc#output behaves unexpected for me. I'm not sure whether we can "fix" this now (in the general case); might be a bit too late in the pre-release cycle. @ramsey, @saundefined, @adoy, thoughts? |
Was a decision made here whether this should be fixed in PHP 8.2? |
We've not discussed it. I need to read up on it and understand it a bit more, and will see if we can make a decision soon. |
As far as I see, this is a bug which should be fixed ASAP. For any case, I created a fix in #9354. It also deals with Tyson's suggestion in #9325 about triggering dynamic property deprecations. (The fix may be yet be exhaustive as I'm not very familiar with the unserialization code, but it is hopefully a good first step into the right direction) |
Co-Authored-By: Tyson Andre <[email protected]>
Co-Authored-By: Tyson Andre <[email protected]>
Co-Authored-By: Tyson Andre <[email protected]>
Co-Authored-By: Tyson Andre <[email protected]>
Co-Authored-By: Tyson Andre <[email protected]>
There was not much discussion..., and I still firmly believe we should ship this fix as soon as possible, so I'll merge my fix in ~2 hours, before branching takes place, unless there is a strong resistance. |
Description
The following code:
Resulted in this output:
But I expected an error instead, because the
->foo
property should not exist in theRandomizer
as per:php-src/ext/random/random.stub.php
Lines 125 to 127 in 7ab22aa
Not sure if this is a bug in the implementation of
Randomizer
or a more general unserialization bug.PHP Version
Current git master
Operating System
No response
The text was updated successfully, but these errors were encountered: