-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Limit the number of filters #16699
base: master
Are you sure you want to change the base?
Limit the number of filters #16699
Conversation
a67b304
to
5f697d1
Compare
I'm in favor of this idea, as this would make some bugs less likely to be exploitable. I agree that legitimate use-cases requiring many filters seem unlikely, but it may be worth it to run a survey of open source code to validate that. As the technique relies on injecting arbitrary strings in an application, that are then interpreted as URLs, would it be enough to limit the number of filters in string representations of As a side note, I'm starting to think that accepting URLs in stream functions was a bad idea. We have |
5f697d1
to
cf74884
Compare
Good point, I updated the PR to use this approach instead. |
Chaining filters is becoming an increasingly popular primitive to exploit PHP applications. Limiting the usage of only a few of them at the time should, if not close entirely, make it significantly less attractive. This should close php#10453
cf74884
to
6f618a9
Compare
Looked at usages of
So the proposed change will not break any of the code indexed by sourcegraph and is unlikely to break any code if this is representative of private code bases, even with a limit of 3. The idea and the change look good to me, but I think that you need to write to the mailing list. If there are objections this may require an RFC. |
There is a lot of mailing lists, which one shall I send a message to? |
The Internals one ([email protected]) |
I'm not sure I like it in the current form. I think this needs to be for sure at least INI and it should be done through the deprecation path as this is a clear BC break. We cannot judge impact based on source graph as majority of applications are in private code bases. Also there are internal filters added in some cases (e.g. transfer-encoding in http wrapper) so there can be some hidden filters as well even though there are not many. I think ideally it should be included in 8.5 deprecation RFC. |
Also throwing exception is inconsistent with current stream error handling so it might require discussion on it's own. It should be probably just warning. We could possibly just add warning and keep it working till next major but not sure if it's ideal. Maybe just separate RFC for this would be best as others would probably prefere exception but we should do some checking how it fits to the current error handling and if some changes there should be done too. |
Thank you @bukka. If we go the deprecation route, it may be worth it to investigate a larger deprecation scope in my opinion. Do you have an opinion about the last part of #16699 (comment) ? Specifically, we could deprecate
The change only limits the number of filters in |
Suggested test cases:
|
Chaining filters is becoming an increasingly popular primitive to exploit PHP applications. Limiting the usage of only a few of them at the time should, if not close entirely, make it significantly less attractive.
I hardcoded the number of filters to
5
for now, but this can be changed to an ini preference if wanted/needed, albeit I fail to see a valid usecase for anything requiring chaining 5 filters or more. I'd love to keep it hardcoded, and to lower the number to 3.This should close #10453
/cc @arnaud-lb @cfreal