Add SSRF mitigations using filter_var and CURLOPT_RESOLVE#8400
Add SSRF mitigations using filter_var and CURLOPT_RESOLVE#8400Inverle wants to merge 60 commits intoFreshRSS:edgefrom
filter_var and CURLOPT_RESOLVE#8400Conversation
|
Since this will be a breaking change, let's target 1.29.0 |
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
|
Related: simplepie/simplepie#968 |
|
Another implementation worth looking at: https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php |
Still WIP and needs testing etc.
|
never mind, my test script was broken it works fine already |
|
and also POST needs to change to GET on redirect |
| <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.Indent"/> | ||
| <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine"/> | ||
| <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/> | ||
| <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/> |
There was a problem hiding this comment.
That does not seem needed, is it?
There was a problem hiding this comment.
Not anymore, but I would prefer to keep it
Is this not covered already by adding |
Fine if providing a list of DNS/hostnames works. I mostly checked the IP parts, and I did not realise it was already there |
|
I have added the environment variable support and documentation. |
|
I have made a Docker image of this PR: |
|
Testing in Docker (Debian image) on an Ubuntu server: I observe a few feeds apparently failing to follow 302 redirects, which seems to be reproducible: I also see several DNS resolution bugs when refreshing by cron (seems better manually, but would need more tests): All those domains are working fine when reverting to |
|
The CNAME points to another domain. Maybe that's related? Though it doesn't seem to be an immediate problem. Except for blogs.windows.com, which does its own special thing: |
|
@Inverle Are you able to reproduce the issues on your side? |
The idea is to prevent FreshRSS from sending any HTTP requests to internal services, except for the ones that are explicitly allowed in the config.
Based on https://github.com/moodle/moodle/blob/6e82b46a480826d1a85394d9e5087f7d82d1dd52/lib/filelib.php#L3818 and https://github.com/symfony/symfony/blob/8.1/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php