Skip to content

Fix domain-wide Retry-After - #9390

Merged
Alkarex merged 3 commits into
FreshRSS:edgefrom
shcheglovnd:fix-retry-after-domain
Oct 3, 2026
Merged

Alkarex merged 3 commits into
FreshRSS:edgefrom
shcheglovnd:fix-retry-after-domain

Conversation

@shcheglovnd

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Fix the domain-wide HTTP Retry-After for public servers, which has not applied since Exclude local networks for domain-wide Retry-After #8195 (FreshRSS 1.28.0).
    • getRetryAfterFile() passed the bare host name to Minz_Request::serverIsPublic(). That function expects a URL, so it always returned false.
    • So a 429 or 503 paused only the URL that got it, despite the log saying "For that domain, will first retry after …", and FreshRSS went on requesting the other feeds of that server. With several Reddit feeds, for instance, each one got its own 429 in turn.
    • serverIsPublic() now gets the URL. Its answer is kept per host for the rest of the request, because it resolves the host name (dns_get_record()), and a refresh may load many feeds of the same host.
  • Fix the per-URL Retry-After of servers on a local network (Exclude local networks for domain-wide Retry-After #8195), which never applied to feeds whose URL, as stored, differs from the URL as requested.
    • Stored URLs are HTML-encoded, e.g. & in an RSS-Bridge URL, and may end with #force_feed.
    • FreshRSS_Feed::load() checked the stored URL, while the pause is stored for the URL as requested. It now checks the requested URL, as loadJson() and loadHtmlXpath() already do.

How to test the feature manually:

  1. Add a feed for https://httpbin.org/status/429, which always answers HTTP 429 without Retry-After. FreshRSS stores a 25-minute pause in data/Retry-After/. Before the change, the file is named httpbin.org_<sha256 of the URL>.txt; after, httpbin.org.txt.
  2. Then add a feed for https://httpbin.org/xml. Before, it is requested, and the add fails with "A feed could not be found". After, it is not requested, and the add fails with "For that domain, will first retry after …".

Tested with the 1.30.0 Docker image (PHP 8.4.24), running 1.30.0 and running this branch.
The new unit tests fail without the change and pass with it: domain-wide pause of a public server, and pause of a stored HTML-encoded or #force_feed URL on a local network.
The whole test suite, PHPStan and PHPCS pass.

Pull request checklist:

  • clear commit messages
  • code manually tested
  • unit tests written (optional if too hard)
  • documentation updated

Additional information can be found in the documentation.

Since FreshRSS#8195, getRetryAfterFile() gave Minz_Request::serverIsPublic() the
bare host name, while it expects a URL, so it always answered false.
An HTTP 429 or 503 thus paused only the URL that got it, never its
server, and the other feeds of that server kept being requested.
Give it the URL, and keep its answer per host, as it resolves the host
name.

Also, for servers on a local network, which are paused URL by URL,
FreshRSS_Feed::load() checked the feed URL as stored, which may be
HTML-encoded (e.g. `&amp;`) or end with `#force_feed`, while the pause
is stored for the URL as requested. So it never applied to such feeds.
@Alkarex Alkarex added this to the 1.30.1 milestone Oct 2, 2026
@Alkarex Alkarex added the Bug (unconfirmed) issues that could not be reproduced yet label Oct 2, 2026
@shcheglovnd
shcheglovnd marked this pull request as ready for review October 2, 2026 22:57
@Alkarex
Alkarex merged commit f65d276 into FreshRSS:edge Oct 3, 2026
3 checks passed
@Alkarex

Alkarex commented Oct 3, 2026

Copy link
Copy Markdown
Member

Thanks!

doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Oct 6, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [freshrss/freshrss](https://freshrss.org/) ([source](https://github.com/FreshRSS/FreshRSS)) | patch | `1.30.0-alpine` → `1.30.1-alpine` |

---

### Release Notes

<details>
<summary>FreshRSS/FreshRSS (freshrss/freshrss)</summary>

### [`v1.30.1`](https://github.com/FreshRSS/FreshRSS/blob/HEAD/CHANGELOG.md#2026-10-05-FreshRSS-1301)

[Compare Source](FreshRSS/FreshRSS@1.30.0...1.30.1)

- Deployment
  - Reword recommendations and explanations for *edge* (rolling release) vs. *latest* (versioned release) channels [#&#8203;9270](FreshRSS/FreshRSS#9270)
- Security
  - Config + increase default values for search max length and depth [#&#8203;9280](FreshRSS/FreshRSS#9280)
  - Accept a trusted proxy address given without a subnet [#&#8203;9301](FreshRSS/FreshRSS#9301)
  - Warn during session regenerate fail [#&#8203;9311](FreshRSS/FreshRSS#9311), [#&#8203;9376](FreshRSS/FreshRSS#9376)
  - CI/CD add zizmor workflow for action security checks [#&#8203;9228](FreshRSS/FreshRSS#9228), [#&#8203;9331](FreshRSS/FreshRSS#9331)
  - Use PHP `#[\SensitiveParameter]` [#&#8203;9322](FreshRSS/FreshRSS#9322)
  - Reject token access (RSS/OPML export, feed refresh) for disabled accounts [#&#8203;9336](FreshRSS/FreshRSS#9336)
  - Require POST+CSRF for self-update mutations [#&#8203;9335](FreshRSS/FreshRSS#9335)
  - Make the login challenge nonce one-time [#&#8203;9334](FreshRSS/FreshRSS#9334)
  - Bound ZIP import against decompression bombs [#&#8203;9332](FreshRSS/FreshRSS#9332)
  - Rotate session ID on all authenticated transitions [#&#8203;9333](FreshRSS/FreshRSS#9333)
  - Minz: Remove vulnerable and unused code path for displaying errors [#&#8203;9395](FreshRSS/FreshRSS#9395)
  - Fix NAT64 feed fetching on IPv6-only hosts [#&#8203;9372](FreshRSS/FreshRSS#9372)
- Bug fixes
  - Fix domain-wide `Retry-After` [#&#8203;9390](FreshRSS/FreshRSS#9390)
  - Fix muting of feeds gone with HTTP 410 [#&#8203;9391](FreshRSS/FreshRSS#9391)
  - Fix infinite redirect loop due to `SCRIPT_NAME` in `PATH_INFO` [#&#8203;9282](FreshRSS/FreshRSS#9282), [#&#8203;9287](FreshRSS/FreshRSS#9287)
  - Restore the automatic reading view after marking articles as read, while preserving explicit filters [#&#8203;9288](FreshRSS/FreshRSS#9288)
  - Fix adaptive reading state after marking articles read [#&#8203;9290](FreshRSS/FreshRSS#9290)
  - Fix regression sharing links [#&#8203;9303](FreshRSS/FreshRSS#9303)
  - Don’t disable anonymous refresh when anonymous feed access is disabled [#&#8203;9354](FreshRSS/FreshRSS#9354)
  - Fix regression with HTTPS proxies due to wrong TLS SNI resolution [#&#8203;9341](FreshRSS/FreshRSS#9341)
  - Better enforce limits for feeds and categories [#&#8203;9357](FreshRSS/FreshRSS#9357)
  - Fix JavaScript error when opening a label menu in sidebar [#&#8203;9377](FreshRSS/FreshRSS#9377)
  - Fix custom favicon with GReader API [#&#8203;9409](FreshRSS/FreshRSS#9409)
- CLI
  - Add optional feed argument to `actualize-user.php` [#&#8203;9319](FreshRSS/FreshRSS#9319)
- UI
  - Various UI and style improvements [#&#8203;9298](FreshRSS/FreshRSS#9298), [#&#8203;9369](FreshRSS/FreshRSS#9369),
    [#&#8203;9388](FreshRSS/FreshRSS#9388)
- Extensions
  - Call `check_url_before_add` hook when previewing a feed [#&#8203;9343](FreshRSS/FreshRSS#9343)
- I18n
  - Add Belarusian [#&#8203;9351](FreshRSS/FreshRSS#9351)
  - Improve German [#&#8203;9370](FreshRSS/FreshRSS#9370), [#&#8203;9385](FreshRSS/FreshRSS#9385)
  - Improve Italian [#&#8203;9370](FreshRSS/FreshRSS#9370)
  - Improve Japanese [#&#8203;9398](FreshRSS/FreshRSS#9398)
  - Improve Turkish [#&#8203;9349](FreshRSS/FreshRSS#9349)
- Misc.
  - Check SVG optimization in the tests CI workflow with SVGO [#&#8203;9361](FreshRSS/FreshRSS#9361)
  - Move PHPUnit flags to a config file and use strictest failure mode [#&#8203;9374](FreshRSS/FreshRSS#9374)
  - Avoid writing to log files during unit tests [#&#8203;9373](FreshRSS/FreshRSS#9373)
  - Bump Ruby gems automatically with Dependabot for docs [#&#8203;9401](FreshRSS/FreshRSS#9401)
  - Update dev dependencies [#&#8203;9323](FreshRSS/FreshRSS#9323), [#&#8203;9324](FreshRSS/FreshRSS#9324),
    [#&#8203;9325](FreshRSS/FreshRSS#9325), [#&#8203;9326](FreshRSS/FreshRSS#9326), [#&#8203;9327](FreshRSS/FreshRSS#9327),
    [#&#8203;9328](FreshRSS/FreshRSS#9328), [#&#8203;9368](FreshRSS/FreshRSS#9368), [#&#8203;9378](FreshRSS/FreshRSS#9378),
    [#&#8203;9379](FreshRSS/FreshRSS#9379), [#&#8203;9380](FreshRSS/FreshRSS#9380), [#&#8203;9381](FreshRSS/FreshRSS#9381),
    [#&#8203;9402](FreshRSS/FreshRSS#9402), [#&#8203;9403](FreshRSS/FreshRSS#9403), [#&#8203;9404](FreshRSS/FreshRSS#9404),
    [#&#8203;9405](FreshRSS/FreshRSS#9405), [#&#8203;9406](FreshRSS/FreshRSS#9406), [#&#8203;9407](FreshRSS/FreshRSS#9407)

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/todd/home-ops/pulls/358
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
serverIsPublic() resolves the hostname via dns_get_record() to decide
whether a server is public. Since FreshRSS#9390, getRetryAfterFile() passes the
full URL, so this resolution now always happens — including for feeds that
use a proxy, leaking every target hostname to the local resolver and
defeating proxies meant to resolve DNS remotely (socks5h/socks4a).

Add an $allowDnsResolve flag to serverIsPublic() (default true, preserving
existing behaviour) and have getRetryAfterFile() disable it when a proxy is
configured, so no local DNS lookup is performed for proxied feeds.

fix(proxy): stop leaking target hostnames locally for socks4a/socks5h

Follow-up to the `serverIsPublic()` DNS-resolve guard. Two remaining code
paths still resolved the target hostname with the local resolver (or
anchored it with CURLOPT_RESOLVE), defeating remote DNS resolution when a
socks4a/socks5h proxy is configured.

1. Minz_Request::serverIsPublic()

   The recursive call on the resolved address did not forward
   $allowDnsResolve, so it fell back to the default `true` and resolved
   the address again. Forward the flag so the guard actually holds for the
   whole recursion.

2. SimplePie\File::__construct() (vendored SimplePie)

   The proxy branch always called get_curl_resolve_info($proxy_url) and,
   if it returned anything, set CURLOPT_RESOLVE. For socks4a/socks5h this
   is wrong: those proxy types already resolve the hostname at the proxy
   side. Pre-resolving locally leaks the target hostname to the local
   resolver and forces cURL to switch from "send hostname" to "send IP"
   during the SOCKS handshake, effectively degrading socks5h to socks5.

   Skip get_curl_resolve_info() and CURLOPT_RESOLVE for CURLPROXY_SOCKS4A
   and CURLPROXY_SOCKS5_HOSTNAME. Behaviour for the other proxy types
   (http/https/socks4/socks5), which resolve DNS locally, is unchanged, so
   the SSRF/DNS-rebinding protection from FreshRSS#8950 is preserved.
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
serverIsPublic() resolves the hostname via dns_get_record() to decide
whether a server is public. Since FreshRSS#9390, getRetryAfterFile() passes the
full URL, so this resolution now always happens — including for feeds that
use a proxy, leaking every target hostname to the local resolver and
defeating proxies meant to resolve DNS remotely (socks5h/socks4a).

Add an $allowDnsResolve flag to serverIsPublic() (default true, preserving
existing behaviour) and have getRetryAfterFile() disable it when a proxy is
configured, so no local DNS lookup is performed for proxied feeds.

fix(proxy): stop leaking target hostnames locally for socks4a/socks5h

Follow-up to the `serverIsPublic()` DNS-resolve guard. Two remaining code
paths still resolved the target hostname with the local resolver (or
anchored it with CURLOPT_RESOLVE), defeating remote DNS resolution when a
socks4a/socks5h proxy is configured.

1. Minz_Request::serverIsPublic()

   The recursive call on the resolved address did not forward
   $allowDnsResolve, so it fell back to the default `true` and resolved
   the address again. Forward the flag so the guard actually holds for the
   whole recursion.

2. SimplePie\File::__construct() (vendored SimplePie)

   The proxy branch always called get_curl_resolve_info($proxy_url) and,
   if it returned anything, set CURLOPT_RESOLVE. For socks4a/socks5h this
   is wrong: those proxy types already resolve the hostname at the proxy
   side. Pre-resolving locally leaks the target hostname to the local
   resolver and forces cURL to switch from "send hostname" to "send IP"
   during the SOCKS handshake, effectively degrading socks5h to socks5.

   Skip get_curl_resolve_info() and CURLOPT_RESOLVE for CURLPROXY_SOCKS4A
   and CURLPROXY_SOCKS5_HOSTNAME. Behaviour for the other proxy types
   (http/https/socks4/socks5), which resolve DNS locally, is unchanged, so
   the SSRF/DNS-rebinding protection from FreshRSS#8950 is preserved.
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
serverIsPublic() resolves the hostname via dns_get_record() to decide
whether a server is public. Since FreshRSS#9390, getRetryAfterFile() passes the
full URL, so this resolution now always happens — including for feeds that
use a proxy, leaking every target hostname to the local resolver and
defeating proxies meant to resolve DNS remotely (socks5h/socks4a).

Add an $allowDnsResolve flag to serverIsPublic() (default true, preserving
existing behaviour) and have getRetryAfterFile() disable it when a proxy is
configured, so no local DNS lookup is performed for proxied feeds.

fix(proxy): stop leaking target hostnames locally for socks4a/socks5h

Follow-up to the `serverIsPublic()` DNS-resolve guard. Two remaining code
paths still resolved the target hostname with the local resolver (or
anchored it with CURLOPT_RESOLVE), defeating remote DNS resolution when a
socks4a/socks5h proxy is configured.

1. Minz_Request::serverIsPublic()

   The recursive call on the resolved address did not forward
   $allowDnsResolve, so it fell back to the default `true` and resolved
   the address again. Forward the flag so the guard actually holds for the
   whole recursion.

2. SimplePie\File::__construct() (vendored SimplePie)

   The proxy branch always called get_curl_resolve_info($proxy_url) and,
   if it returned anything, set CURLOPT_RESOLVE. For socks4a/socks5h this
   is wrong: those proxy types already resolve the hostname at the proxy
   side. Pre-resolving locally leaks the target hostname to the local
   resolver and forces cURL to switch from "send hostname" to "send IP"
   during the SOCKS handshake, effectively degrading socks5h to socks5.

   Skip get_curl_resolve_info() and CURLOPT_RESOLVE for CURLPROXY_SOCKS4A
   and CURLPROXY_SOCKS5_HOSTNAME. Behaviour for the other proxy types
   (http/https/socks4/socks5), which resolve DNS locally, is unchanged, so
   the SSRF/DNS-rebinding protection from FreshRSS#8950 is preserved.
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
serverIsPublic() resolves the hostname via dns_get_record() to decide
whether a server is public. Since FreshRSS#9390, getRetryAfterFile() passes the
full URL, so this resolution now always happens — including for feeds that
use a proxy, leaking every target hostname to the local resolver and
defeating proxies meant to resolve DNS remotely (socks5h/socks4a).

Add an $allowDnsResolve flag to serverIsPublic() (default true, preserving
existing behaviour) and have getRetryAfterFile() disable it when a proxy is
configured, so no local DNS lookup is performed for proxied feeds.

fix(proxy): stop leaking target hostnames locally for socks4a/socks5h

Follow-up to the `serverIsPublic()` DNS-resolve guard. Two remaining code
paths still resolved the target hostname with the local resolver (or
anchored it with CURLOPT_RESOLVE), defeating remote DNS resolution when a
socks4a/socks5h proxy is configured.

1. Minz_Request::serverIsPublic()

   The recursive call on the resolved address did not forward
   $allowDnsResolve, so it fell back to the default `true` and resolved
   the address again. Forward the flag so the guard actually holds for the
   whole recursion.

2. SimplePie\File::__construct() (vendored SimplePie)

   The proxy branch always called get_curl_resolve_info($proxy_url) and,
   if it returned anything, set CURLOPT_RESOLVE. For socks4a/socks5h this
   is wrong: those proxy types already resolve the hostname at the proxy
   side. Pre-resolving locally leaks the target hostname to the local
   resolver and forces cURL to switch from "send hostname" to "send IP"
   during the SOCKS handshake, effectively degrading socks5h to socks5.

   Skip get_curl_resolve_info() and CURLOPT_RESOLVE for CURLPROXY_SOCKS4A
   and CURLPROXY_SOCKS5_HOSTNAME. Behaviour for the other proxy types
   (http/https/socks4/socks5), which resolve DNS locally, is unchanged, so
   the SSRF/DNS-rebinding protection from FreshRSS#8950 is preserved.
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
Follow-up to FreshRSS#9390: `getRetryAfterFile()` passed the full URL to
`Minz_Request::serverIsPublic()`, which then resolved the target hostname
with the local resolver (`dns_get_record()`), even when a proxy was
configured. With a socks5h/socks4a proxy this leaks the target hostname
to the local DNS and defeats remote name resolution.

- `Minz_Request::serverIsPublic()`: add an `$allowDnsResolve` parameter,
  and forward it to the recursive call so the guard holds for the whole
  recursion.
- `FreshRSS_http_Util::getRetryAfterFile()`: do not resolve the host name
  when a proxy is configured (`$proxy === ''`), since the proxy is
  responsible for DNS.

Also, `SimplePie\File`: for socks4a / socks5h, skip
`get_curl_resolve_info()` and `CURLOPT_RESOLVE`, as those proxy types
already resolve the host name at the proxy side. Pre-resolving locally
would degrade socks5h to socks5, and leak the target hostname. Other proxy
types keep the FreshRSS#8950 SSRF / DNS-rebinding protection.
tomac4t added a commit to tomac4t/FreshRSS that referenced this pull request Oct 16, 2026
Follow-up to FreshRSS#9390: `getRetryAfterFile()` passed the full URL to
`Minz_Request::serverIsPublic()`, which then resolved the target hostname
with the local resolver (`dns_get_record()`), even when a proxy was
configured. With a socks5h/socks4a proxy this leaks the target hostname
to the local DNS and defeats remote name resolution.

- `Minz_Request::serverIsPublic()`: add an `$allowDnsResolve` parameter,
  and forward it to the recursive call so the guard holds for the whole
  recursion.
- `FreshRSS_http_Util::getRetryAfterFile()`: do not resolve the host name
  when a proxy is configured (`$proxy === ''`), since the proxy is
  responsible for DNS.

Also, `SimplePie\File`: for socks4a / socks5h, skip
`get_curl_resolve_info()` and `CURLOPT_RESOLVE`, as those proxy types
already resolve the host name at the proxy side. Pre-resolving locally
would degrade socks5h to socks5, and leak the target hostname. Other proxy
types keep the FreshRSS#8950 SSRF / DNS-rebinding protection.
Alkarex pushed a commit that referenced this pull request Oct 17, 2026
* Fix local DNS leak when fetching feeds through a proxy

Follow-up to #9390: `getRetryAfterFile()` passed the full URL to
`Minz_Request::serverIsPublic()`, which then resolved the target hostname
with the local resolver (`dns_get_record()`), even when a proxy was
configured. With a socks5h/socks4a proxy this leaks the target hostname
to the local DNS and defeats remote name resolution.

- `Minz_Request::serverIsPublic()`: add an `$allowDnsResolve` parameter,
  and forward it to the recursive call so the guard holds for the whole
  recursion.
- `FreshRSS_http_Util::getRetryAfterFile()`: do not resolve the host name
  when a proxy is configured (`$proxy === ''`), since the proxy is
  responsible for DNS.

---------

Co-authored-by: Inverle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug (unconfirmed) issues that could not be reproduced yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants