Commit Graph
1055 Commits
Author SHA1 Message Date
fuyoacademy cb522a8dbf Keep the errors filter after removing a feed (#9656)
Fix #9654

When the subscription page shows only the feeds with errors and a feed is removed from its slider, the redirect went back to the full list. The remove button now keeps `error=1`, and `feed/delete` redirects to the subscription page with `error=1` in that case.

Without `error`, the redirect is unchanged.

How this was checked: I ran FreshRSS 1.31 edge with the PHP built-in server and SQLite, with one feed in error. Before the change, `POST feed/delete` from the error-filtered slider redirected to `?c=subscription`. After the change, it redirects to `?c=subscription&error=1`. Without the error filter, it still redirects to `?c=subscription`. I did not add a PHPUnit test because the action ends in a redirect, and I did not run `make test-all`.
2026-11-30 11:06:59 +01:00
Alexandre Alapetite 6320ff8af7 More secure remove access (#9610)
Fix https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-r27w-hr3c-hjr3
2026-11-22 21:54:39 +01:00
Inverle 6a6b23bf82 Fix HTML injection in extension names (#9608)
Fix [GHSA-crc7-3qcq-m9h3](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-crc7-3qcq-m9h3)
2026-11-22 08:54:32 +01:00
Inverle 2f31a2fdf5 Fix HTML injection in view mode error notification (#9605)
Fix [GHSA-wpf6-5v7v-6cvj](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-wpf6-5v7v-6cvj)

Introduced in https://github.com/FreshRSS/FreshRSS/pull/7668
2026-11-20 22:11:25 +01:00
Alexandre Alapetite 8ffddc11f8 More security for extension files: nosniff (#9593)
Global `X-Content-Type-Options: nosniff`
And follow-up of #7753
2026-11-20 13:54:09 +01:00
Alexandre Alapetite 13280a4dfc Safer login (#9592)
Avoid using some functions changing state before full verification.
Related to https://github.com/FreshRSS/FreshRSS/pull/9598
2026-11-20 10:24:29 +01:00
Inverle 2584514db3 Deny formLogin access if already logged in (#9598)
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/9592

There is no reason for logged in users to have access to the login page.
2026-11-20 08:10:27 +01:00
Alexandre Alapetite ae664c8ccd Better sanitize bookmark (#9594) 2026-11-19 23:20:55 +01:00
Alexandre Alapetite ea646d2bde Use PHP 8.4+ \Dom classes and functions (#9567)
Currently, SimplePie uses legacy DOMDocument parsing, which outputs potentially problematic HTML, not correctly sanitised.
This breaks the assumption that one can use something like `<div><!-- some HTML sanitized from SimplePie --></div>`.

```
--- Expected
+++ Actual
@@ @@
 '<ul>
-    <li><div></div></li>
+    <li><div>
     <li>Item</li>
-</ul>'
+</div></li></ul>'
```

When shown in a compliant Web browser, several tags will be wrongly closed, breaking the layout of the client.

This PR patches SimplePie to use the modern parser and code syntax, while maintaining a best-effort polyfill for legacy PHP versions < 8.4.

Depends on:

SimplePie: Upgrade to PHPStan 2
* https://github.com/FreshRSS/simplepie/pull/97
* https://github.com/simplepie/simplepie/pull/939
* https://github.com/simplepie/simplepie/pull/1019

SimplePie: Use PHP 8.4+ \Dom classes and functions
* https://github.com/FreshRSS/simplepie/pull/98
* https://github.com/simplepie/simplepie/issues/1021

SimplePie: Add unit test for HTML5 sanitizing compliance
* https://github.com/simplepie/simplepie/pull/1022

SimplePie: Remove obsolete xml_is_sane and XMLReader fallback
* https://github.com/simplepie/simplepie/pull/1023

CssXPath: Add support for case insensitivity
* https://github.com/phpgt/CssXPath/pull/256

fix https://github.com/FreshRSS/FreshRSS/issues/5201
fix https://github.com/FreshRSS/FreshRSS/issues/6830
fix https://github.com/FreshRSS/FreshRSS/issues/6831

~5% faster for HTML sanitising.
Remove SimpleXML. Remove XMLReader.
2026-11-19 23:17:04 +01:00
Alexandre Alapetite 289a00be00 A few misc. security enhancements (#9591) 2026-11-19 20:09:02 +01:00
Inverle 77e74e81b7 Serve consistent error responses on failed logins (#9568)
Fixes #4095

Follow-up of #9566

Although no separate error message for disabled users yet (will be done in another PR).
2026-11-16 22:38:25 +01:00
Inverle 06c0329de2 Fix wrong status code on failed login (#9566)
Regression from https://github.com/FreshRSS/FreshRSS/pull/9358 (PR not present in current release, stopped sending 403 on failed logins).

This PR fixes the Minz bug mentioned in https://github.com/FreshRSS/FreshRSS/pull/9358#discussion_r4382254359 which occurred with `redirect: false` redirects.

But it also takes a different approach for redirecting, by using HTML instead of the `Location` header (to address one additional issue with a resubmit prompt appearing when refreshing the login page after a failed login).

403 is now returned during failed reauthentication as well.
2026-11-15 23:34:53 +01:00
d1fe6e694d Add option to open articles on their original website (#9554)
* Add option to open articles on their original website

Clicking an article title can now open the original website instead of the article in FreshRSS. The link icon then opens the article in FreshRSS.

fix https://github.com/FreshRSS/FreshRSS/issues/1954

* i18n: fr

---------

Co-authored-by: Eduardo Coronell <eduardo.coronell@aspsols.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-11-14 22:30:32 +01:00
Jay HemnaniandAlexandre Alapetite 2ce6f1125b fix: do not double-encode titles and authors when importing JSON (#9556)
* fix: do not double-encode titles and authors when importing JSON

FreshRSS exports titles and authors HTML-encoded, and the JSON import
encoded them again since #9168, so restoring a ZIP export turned
"Post &amp; more" into "Post &amp;amp; more". Decode before encoding.

* Unit test

* Reduce comments

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-11-12 17:39:51 +01:00
InverleandAlexandre Alapetite 6af8ebcbff Fix current password requirement during password changes (#9550)
* Fix current password requirement during password changes

Regression from #9358 (follow-up, PR not present in a stable/versioned release)

Fix [GHSA-5vxm-62pg-frff](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-5vxm-62pg-frff)

* Remove stale client side bcrypt comment from passwordUtil

* docs: PHP 8.1 is no longer supported

* Minor typographic preference

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-11-10 01:13:52 +01:00
i @manandAlexandre Alapetite 4e8a258b01 Support choosing the sort type when creating or editing a user query (#8954)
* Support choosing the sort type when creating or editing a user query

Changes
- User queries can now store a sort field (sort type), not only the sort
  direction. The create and edit forms expose a single combined dropdown
  (field + direction) that reuses the existing `index.menu.sort.*` options,
  matching the global reading-settings sort UI.
- The "Bookmark current query" action now also remembers the current sort
  field, where it previously kept only the order direction.
- Relabel the query sort control from "Sort by date" to "Sort by"; other
  languages are marked for re-translation (// TODO).
- Add a CHANGELOG entry and credit the contributor in CREDITS.

Implementation
- `FreshRSS_UserQuery`: add an optional `sort` property mirroring `order`
  (constructor parsing, `toArray()`, `getSort()` falling back to the user
  default sort, and a `hasParameters()` check).
- `configureController`: split the combined dropdown value into `sort` and
  `order`, validating the field against the implemented sort types
  (`id`, `c.name`, `date`, `f.name`, `length`, `link`, `title`, `rand`);
  separate `sort`/`order` request parameters are still accepted so the
  "bookmark current query" flow keeps working.
- Views render the combined dropdown and persist `sort` as a hidden field.
- `p/api/query.php`: back-fill `sort` from the saved query when the request
  does not provide one, mirroring the existing `order` handling.
- Add unit tests covering the sort round-trip and `toArray()` inclusion.

Compatibility
- No database or schema change: user queries are stored in the per-user PHP
  config array, which keeps arbitrary keys verbatim, so no migration is
  required.
- Upgrade: existing queries without `sort` fall back to the user default
  sort; behaviour is unchanged until a sort is explicitly chosen.
- Downgrade: older versions ignore the extra `sort` key and keep working;
  re-saving under an old version simply drops the key with no data loss.
- Shared query URLs without a `sort` parameter remain valid.

* Refresh README translation statistics

* i18n: fr

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-11-02 21:43:05 +01:00
2ebfff6e7d Add feeds_after_actualize hook (#9438)
Extensions that process new articles in bulk (summaries, exports,
notifications) have no way to react to the end of a refresh:
freshrss_user_maintenance runs before the feeds are fetched, and new
articles stay in the temporary table until the whole loop is done.

The new FeedsAfterActualize hook runs once the new articles are
committed, with the refreshed feeds whose articles changed and the
number of new articles: after a cron or web refresh (actualizeAction,
including the commit-only request of the web interface) and after
actualizeFeedsAndCommit (CLI, API, WebSub, feed added).

Co-authored-by: ChrisB85 <792899+ChrisB85@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:38:49 +01:00
InverleandAlexandre Alapetite 76e8993579 Replace bcrypt challenge auth with direct password comparison (#9358)
* Replace bcrypt challenge auth with direct password comparison

Closes #2428

Highlights:

* Replaced the bcrypt challenge authentication flow with direct password comparison against the bcrypt hash stored in the user configuration.
  * Removed the `bcrypt.js` dependency, so authentication no longer depends on JavaScript.
  * Removed the nonce and challenge mechanism and the `nonce` endpoint from the `javascript` controller.
  * Removed the JavaScript and HTML code used for the previous authentication flow.
  * Removed the `<noscript>` blocks that were only needed for the previous authentication flow.
* Updated `FreshRSS_FormAuth::checkCredentials()` to accept the username, stored bcrypt hash, and plain-text password directly.
  * The stored password hash must still use the expected bcrypt format.
  * Empty or whitespace-only passwords are rejected even if the hash would otherwise match.
  * The bcrypt 72-byte limit is enforced during normal authentication.
  * Existing bcrypt passwords are handled correctly when the 72-byte limit cuts through a UTF-8 character.
  * Password input is no longer trimmed before authentication or password changes. Leading and trailing whitespace is therefore kept as part of the password.
* Added `FreshRSS_FormAuth::passwordRequirementsMet()` to replace `FreshRSS_password_Util::check()`.
  * New passwords must be between 7 and 72 bytes by default.
  * The minimum length check can be disabled where needed.
  * Password requirements are now checked server-side for all password creation and update paths.
* Added client-side byte-length validation for password fields using `TextEncoder` and `data-max-bytes`.
  * This gives better feedback for UTF-8 passwords.
  * Server-side validation remains authoritative.
* Updated password handling in authentication, re-authentication, self-deletion, user creation, and user update paths so passwords are not trimmed automatically.
* Added `FormAuthTest` to cover:
  * password length limits in bytes
  * UTF-8 passwords around the 72-byte limit
  * bcrypt truncation behavior during authentication
  * malformed and non-bcrypt hashes
  * empty passwords
  * authentication failures and log messages
* Removed `bcrypt.js` from the documented dependencies and updated the authentication documentation.
* Updated the installation and authentication views and JavaScript to match the new password handling.

This simplifies the authentication flow, removes the client-side bcrypt challenge, makes password validation consistent between the client and server, and adds more test coverage while keeping compatibility with existing bcrypt password hashes.

Because the password is now sent directly to the server instead of being processed by `bcrypt.js`, deployments should use HTTPS. Documentation for HTTPS setup can be handled separately.

* Add test case with password truncated down to 71 characters

* Compare log messages too during form auth tests

* Mark the `getLastLog()` method as impure

* Fix: Check password reqs against new password instead of current

* Fix: Add custom JS validator for UTF-8, handle cut-off UTF-8 during login

* Fix: Enforce password requirements everywhere server-side

* Add TODO for updateUser in CLI

* make readme

* Fix extra.js in install.php

* Don't report validity yet if the password is too short or not filled out

* Simplify checking of whether to report validity

* Fix: Do not trim password from user's input

* Also `trim: false` in some userController paths

* Use the proper argument order for PHPUnit's `assertSame()`

* Remove `maxlength` in favor of `data-max-bytes`

But add `pattern` again for some nojs support

* make readme

* composer run-script translations

* Update i18n string for web form admin setting

* i18n: fr

* Minor whitespace

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-10-30 22:21:26 +01:00
Alexandre Alapetite fd3f75b3a2 Require PHP 8.2+ (#9470)
Drop PHP 8.1 (EOL December 2025), drop Ubuntu 22.04 (EOL May 2027, and there is now 24.04 and 26.04 LTS).
PHP 8.1 is already EOL, and Debian, Alpine, Fedora, Red Hat, Synology have dropped PHP 8.1 already.
See https://github.com/FreshRSS/FreshRSS/discussions/5474#discussioncomment-16791937

With PHP 8.6 around the corner and in particular a relevant `FILTER_FLAG_GLOBAL_RANGE` in PHP 8.2+.
* https://www.php.net/releases/8.2
* https://www.php.net/filter.constants.validation#constant.filter-flag-global-range
* https://www.php.net/class.sensitiveparameter
* https://php.watch/versions/8.2/readonly-classes
* https://www.php.net/function.ini-parse-quantity

Allows updating to PHPUnit 11.x instead of 10.x
https://phpunit.de/supported-versions.html

Contributes to https://github.com/FreshRSS/FreshRSS/issues/9475

* Add regression test for FILTER_FLAG_GLOBAL_RANGE
https://github.com/FreshRSS/FreshRSS/pull/9470#discussion_r4371168720
2026-10-26 21:02:32 +01:00
Pythame bc962e9aad fix: escape labels during JSON import and render tag dropdown as text (#9504)
- Normalize label names parsed from Google Reader JSON categories during import, using the same escaping helper as the other imported string fields.
- Decode stored label names before returning them to the dynamic tag dropdown.
- Build dynamic tag dropdown entries with DOM text nodes instead of HTML string concatenation.
2026-10-25 11:48:58 +01:00
Inverle 0addf32b36 Translate non-English code comments and identifiers (#9383)
Note: The changes in this PR are entirely AI-authored but manually reviewed and tested

## Summary

Translate the remaining French prose and French-derived identifiers in the main FreshRSS/Minz codebase to English.

Why: helps to understand the code

## Scope

- Minz comments, PHPDoc, and paginator identifiers
- Application comments and related identifiers
- Installer database identifiers
- Theme metadata descriptions and the identified CSS comments, previous discussion: https://github.com/FreshRSS/FreshRSS/pull/8241#discussion_r2553181653
- Related call sites and view helpers

External libraries and intentional i18n/docs content are excluded.
2026-10-20 09:52:31 +02:00
Inverle b33749fe6c New hook: Minz_HookType::AutofillField for auth views (#9362)
* New hook: `Minz_HookType::AutofillField` for auth views

Currently to be used in the Demo extension, because it overrides both the formLogin and reauth views (for autofilling username/password), it can be broken every time there is a slight change in core.
For example, after https://github.com/FreshRSS/FreshRSS/pull/9358.

In the future the hook can be extended to support more fields.

Demo extension PR: https://github.com/FreshRSS/xExtension-Demo/pull/6

* Suggested alternative without returning HTML code
2026-10-19 23:10:38 +02:00
Inverle ed34f6a21d Fix wrong order of args in extension compatibility check (#9445)
See https://www.php.net/manual/function.version-compare.php

The extension's minimum required FreshRSS version must be compared against the currently running version, not the other way around.

Assuming the running FreshRSS version is `1.30.1`:

| Minimum required version | Expected status | Before this fix | After this fix |
|---|---|---|---|
| `1.27.0` | ✅ Compatible | ❌ Incompatible | ✅ Compatible |
| `1.30.1` | ✅ Compatible | ✅ Compatible | ✅ Compatible |
| `1.31.0` | ❌ Incompatible | ✅ Compatible | ❌ Incompatible |
2026-10-15 19:47:06 +02:00
Alexandre Alapetite f617083328 Mitigate some 404 situations (#9435)
* Mitigate some 404 situations
Fix https://github.com/FreshRSS/FreshRSS/issues/9413 (maybe)
See https://www.php.net/function.session-regenerate-id

* Keep error_code in Session as well

* Ensure login_ok is false
2026-10-15 16:11:21 +02:00
Alexandre Alapetite 7e8ef628d9 Better doc and log proxy cases (#9436)
Fix https://github.com/FreshRSS/FreshRSS/issues/9423
And strip redundant proxy scheme.
And add a few more unit tests.
2026-10-13 19:50:38 +02:00
abp002andAlejandro Borrego 48547b4a6c Reduce memory consumption of export (#9350)
Contributes to #6139 (export part; the import will follow in another PR)

Exporting favourites was collecting the whole file in memory. With many articles, it fails with the default PHP memory limit.

## Changes
- New `Minz_View::helperToFile()`, similar to `helperToString()`, writing the output of a helper into a file by chunks of 64 KiB instead of keeping it in memory.
- `FreshRSS_Export_Service`: the `generate*()` methods now return the path of a temporary file instead of the content, and `zip()` builds the archive from those files (`ZipArchive::addFile()` instead of `addFromString()`). Temporary files are created in `TMP_PATH` (already required to be writable) and deleted at the end of the script.
- The export is sent with `readfile()`: Web UI, `cli/export-zip-for-user.php`, `cli/export-opml-for-user.php` and the OPML export of the Google Reader API.
- Note: this changes what `FreshRSS_Export_Service` returns (a path instead of the content). All callers in the repository are updated, and I could not find any public extension using this service.

## Measurements
Peak PHP memory (`memory_get_peak_usage(true)`), SQLite database with synthetic starred articles:

| Scenario | Before | After |
|---|---|---|
| Web, export your favourites, 10,000 articles (69 MB JSON) | 136 MB (fails with the default `memory_limit` of 128 MB) | 6 MB |
| Web, ZIP (OPML + favourites + labelled articles + 4 feeds), 10,000 articles | 152 MB | 6 MB |
| CLI `export-zip-for-user.php`, 10,000 articles | 189 MB (fails with 128 MB) | 8 MB |
| Web, export your favourites, 30,000 articles (208 MB JSON) | 404 MB | 10 MB |

Co-authored-by: Alejandro Borrego <210245044+abp002@users.noreply.github.com>
2026-10-05 21:47:19 +02:00
Nikolai ShcheglovandAlexandre Alapetite a93bd27b7d Fix muting of feeds gone with HTTP 410 (#9391)
* Fix muting of feeds gone with HTTP 410

A feed answering HTTP 410 Gone is meant to be muted (#3561), but:

* Since #6037, FreshRSS_Feed_Exception extends Minz_Exception, which
  resets any code other than its own error levels to 0, so the check for
  410 never matched. FreshRSS_Feed_Exception now keeps the HTTP status
  code it is given.
* FreshRSS_FeedDAO::mute() mutes by negating the TTL, which leaves a feed
  with the default TTL (0) unmuted. Mute the feed the way the feed
  settings and dynamic OPML categories do instead.

* A bit of cleaning

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-10-03 09:59:51 +02:00
Alexandre Alapetite a8e5e6300b Better enforce feed limits (#9357)
E.g. when added from API
Fix https://github.com/FreshRSS/FreshRSS/issues/8822#issuecomment-5781019651
2026-09-28 10:41:29 +02:00
5a270c02b0 Rotate session ID on all authenticated transitions (CWE-384) (#9333)
* auth: rotate session ID on all authenticated transitions (session fixation)

The PHP session ID was regenerated on explicit form login, reauth, logout and
password change, but NOT when access is (re)established from a remember-me
cookie, via HTTP authentication, or on self-registration auto-login (CWE-384),
so a fixed session ID could become authenticated.

Regenerate the session ID at those transitions too: in FreshRSS_Auth::init
when accessControl() first grants access (covers remember-me restore and HTTP
auth; skipped for auth_type 'none', which has no authentication boundary), and
in the self-registration auto-login path, mirroring the existing form-login
idiom. Also enable session.use_strict_mode before session_start as defence in
depth so an uninitialised, attacker-supplied session ID is not adopted.

* auth: avoid duplicate cookie during session rotation

* Code preferences, shorten some comments

---------

Co-authored-by: Inverle <inverle@proton.me>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-09-28 10:39:21 +02:00
GigiandAlexandre Alapetite cd42dc7509 Bound ZIP import against decompression bombs (CWE-409) (#9332)
* importExport: bound ZIP import against decompression bombs

ZIP import read every archive member into memory via getFromIndex() with no
limit on member count, per-member or total uncompressed size, or compression
ratio, so a small crafted upload could exhaust memory (CWE-409).

Enforce a member-count limit, per-member and aggregate uncompressed-size
limits and a compression-ratio ceiling from the central-directory metadata,
and additionally cap the real decompressed size while streaming each member
(the declared size is attacker-controlled and can under-report). Oversized or
over-compressed members are skipped and the loop stops once the budget is
reached; a realistic export (an OPML plus a few JSON files) stays well within
the limits.

* Fix lookup by name and total calculation

* Fix locateName regression
Duplicate entry name: keep only the first occurrence, but allow full paths

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-09-27 21:25:08 +02:00
Gigi d5ad610c3d Make the login challenge nonce one-time (CWE-294) (#9334)
* auth: make the login challenge nonce one-time

The per-login challenge nonce stored in the session was never consumed or
cleared, so a captured challenge stayed replayable and survived logout
(CWE-294). The client (p/scripts/extra.js) already fetches a fresh nonce for
every attempt, so consuming it does not affect legitimate retries.

Consume the nonce (unset it) as soon as it is read for verification in form
login, reauthentication, password change and account self-deletion, and clear
it in FreshRSS_Auth::removeAccess so logout invalidates any outstanding
challenge.

* auth: don't clear the nonce in removeAccess (breaks login)

removeAccess() runs on every unauthenticated request via FreshRSS_Auth::init()
-- including the login POST itself, before formLoginAction reads the nonce -- so
clearing it there rejected every login with 'Invalid session'. Thanks
@jamalkamaladdin for the measured catch. The one-time guarantee is preserved by
consuming the nonce when it is read for verification (login/reauth/password
change/self-deletion); logout no longer needs a separate clear.
2026-09-27 12:21:17 +02:00
GigiandAlexandre Alapetite a6253486c0 Require POST+CSRF for self-update mutations; guard post-config step (CWE-352) (#9335)
* update: require POST + CSRF for updater mutations; guard post-config step

The self-update check/apply mutations were reachable via GET, which is never
anti-CSRF validated (the token is only checked on POST), and the privileged
post-configuration step (do_post_update()/PostUpdate hook, removal of the
staged update file) was additionally reauth-exempt and GET-reachable (CWE-352).

- checkAction and the apply branch now require POST, so the global anti-CSRF
  token check applies; the update page's Check/Apply controls are POST forms
  carrying the token.
- The post_conf finalisation is bound to a one-time session marker set by the
  successful apply right before its internal redirect, so it only runs as that
  continuation, not via a direct cross-site GET (independent of reauth config).
- Reauth is now required consistently, including for apply/post_conf (was
  exempted); the legitimate post_conf redirect still passes on the reauth done
  moments earlier by the apply request.

Status/index endpoints remain GET and read-only.

* Reduce some comments

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-09-26 17:02:22 +02:00
Ethan Stoner 5fb62464e9 Call check_url_before_add hook when previewing a feed (#9343)
The GET branch of feedController::addAction() built a FreshRSS_Feed
straight from the requested URL and loaded it, without invoking the
Minz_HookType::CheckUrlBeforeAdd hook. Only the POST branch, through
addFeed(), ran the hook.

Extensions that turn a website URL into a feed URL (e.g. RSS-Bridge)
were therefore bypassed on the confirmation page reached from the
bookmarklet: the raw website URL was probed, and since such sites do
not advertise a feed, the preview reported that no feed could be
added. Submitting the very same form then succeeded, because the POST
path did apply the hook.

Run the hook at the start of the GET branch so the preview probes the
URL that would actually be subscribed to, and reuse the existing
"not added" feedback when an extension refuses the URL, matching what
addFeed() does when the hook returns null.

The documented contract is that the hook "will be executed every time
a URL is added", so the preview should not be an exception.

Fixes #9339
2026-09-26 15:24:10 +02:00
Alexandre Alapetiteandkta1kri 64f7f24c6e Improve WebSub security (#9330)
* Improve WebSub security
New keys are now more random

* Refuse to downgrade from HTTPS to HTTP

Co-authored-by: kta1kri <77656895+kta1kri@users.noreply.github.com>
2026-09-20 17:25:43 +02:00
Alexandre Alapetite 8067fd994b Use PHP SensitiveParameter (#9322)
https://www.php.net/class.sensitiveparameter
Active from PHP 8.2+ but parses without effect on PHP 8.1
2026-09-19 19:52:07 +02:00
Alexandre Alapetite ad4723cb1f Warn during session regenerate fail (#9311)
Might provide more logs for e.g. https://github.com/FreshRSS/FreshRSS/discussions/9305
2026-09-19 14:33:25 +02:00
Morax cc45db5ef8 Fix adaptive reading state after marking articles read (#9290)
Closes #9288

Changes proposed in this pull request:

The mark-as-read links contain the resolved state, so the automatic reading preference becomes an explicit `state=2` filter after the redirect. Once the last unread article is marked read, the page stays empty instead of showing all articles.

- Keep the requested state separately from the resolved state used by the action. A redirect state of `0` reapplies the reading preference; explicit filters still survive the redirect as intended by #9007.
- Carry that value through the menu, footer and “Load more” link. This matters with oldest-first pagination, where the last footer supplies the menu button's action.
- Add request-state and rendered-pagination tests, plus a changelog entry.

How to test the feature manually:

1. With both read and unread articles, choose “Show unreads if any, all articles otherwise”. Mark all as read from the footer, then repeat using the top button. The resulting page should show the read articles.
2. Set one article per page and oldest-first sorting. Load the remaining articles before marking all as read; the same fallback should work.
3. Select an explicit unread filter: marking everything read should still leave an empty unread view. Also check a favourite filter with a search term, including “Mark selection unread”; the search and favourite scope should remain intact.

Validation: `make NO_DOCKER=1 fix-all` and `make NO_DOCKER=1 test-all` pass with PHP 8.5.9 (719 PHPUnit tests, 1,378 assertions). Browser checks passed against SQLite in Chromium (desktop and mobile viewport) and Firefox. The original footer fails three of the six new rendered-pagination cases.
2026-09-11 08:18:09 +02:00
Ali GündoğarandAlexandre Alapetite 970b135190 Ignore security-relevant OPML attributes for dynamic OPML sources (#9276)
* Ignore security-relevant OPML attributes for dynamic OPML sources

OPML content can come from an untrusted source (a dynamic OPML category re-fetches its remote content on every refresh cycle). Such content must not be able to configure feed cURL parameters (CURLOPT_COOKIE, CURLOPT_PROXY, CURLOPT_POSTFIELDS, etc.) nor create further dynamic OPML categories. importOpml() therefore defaults to untrusted, and the local file import controller explicitly opts in.

* Review

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-09-09 16:11:38 +02:00
Inverle c4b96b253c Fix auth CSRFs (login and register actions) (#9171)
This is done by getting rid of the CSRF check allowlist, and instead of refreshing the CSRF token on every unauthenticated page load, only refreshing the token when needed (on login, logout, account delete, HTTP auth user change)

In addition, the actualize actions are now correctly protected as well.

The most notable part is that the user create action could potentially be exploited by another website for XSS on a given instance, by submitting the register form with known credentials, and then by the attacker logging into the same account forcibly registered by a malicious website, and setting custom User JS code.
Login action was likely not exploitable in any meaningful way, because of the JS nonce.

It's worth noting one risk of merging this PR, some vulnerabilities discovered in the past had reduced impact due to CSRF token refreshing on every page load: https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-jf4v-f8p2-8xvq#:~:text=It%27s%20important,FreshRSS%5FAuth%3A%3AremoveAccess%28%29%2E
2026-09-08 09:19:01 +02:00
Inverle 5a842b25ee Format unread counter in title on page load (#9263)
For consistency with JS: https://github.com/FreshRSS/FreshRSS/pull/8577#issuecomment-4017150896
2026-09-06 21:36:12 +02:00
András Marczinkó 99ee090236 Fix PHP Warning: Cannot modify header information headers already sent (#9267)
Closes #9229

I restored my accidently deleted patches with @Inverle fixes. This fix is still works perfectly. Sorry. (https://github.com/FreshRSS/FreshRSS/pull/9230)

How to test the feature manually:

With this change:
1. Go to FreshRSS UserCSS extension config
2. Enable the UserCSS and set the CSS code in it.
3. Go to FreshRSS feeds page.
4. Hit the ctrl + F5 button and see no errors in the nginx log.
2026-09-06 21:32:48 +02:00
Alexandre Alapetite f902047204 Offer to add a prefix when resharing user labels (#9236)
* Offer to add a prefix when resharing user labels
Improve https://github.com/FreshRSS/FreshRSS/pull/8112

* make fix-all
2026-08-28 08:51:57 +02:00
Alexandre Alapetite 2701b7dff4 Cleaner limit anonymous mode to default user (#9235)
While waiting for https://github.com/FreshRSS/FreshRSS/issues/1553
2026-08-25 16:17:36 +02:00
Alexandre AlapetiteandFrans de Jonge 2ceb78fefb Dev updates: composer, hadolint, typos... (#9219)
* Dev updates: composer, hadolint, typos...
Composer compatibility PHP 8.6.
Manual updates not supported by Dependabot

* Fix hadolint

* Update lib/Minz/Url.php

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* Add sha256sum for composer

---------

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2026-08-18 09:36:01 +02:00
Alexandre Alapetite ae672979c2 Fix saving user queries (#9190)
Fix https://github.com/FreshRSS/FreshRSS/issues/9188
2026-08-09 22:05:41 +02:00
InverleandAlexandre Alapetite e1ce0b0519 Sanitize all fields during JSON import (#9168)
* Sanitize all fields during JSON import

fix [GHSA-hx52-rwx7-wg87](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-hx52-rwx7-wg87)

* Remove URL crendentials from logs

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-08-05 22:00:10 +02:00
Jam Balaya e39b5898f1 Ignore empty categories when sizing export feed selector (#9154)
Follow-up to #9079.

## Summary

- Ignore empty categories when sizing the export feed selector.
- Keep the selector height aligned with the category headings and feeds that are actually rendered.
- Preserve the grouped export choices and export request format introduced in #9079.

## Root cause

The view skipped categories without feeds when rendering `<optgroup>` elements, but the `size` calculation counted every category returned by the DAO. Empty categories therefore increased the listbox height without adding any visible content.

## Before / After

| Before | After |
| --- | --- |
| <img width="1400" height="1000" alt="9079-followup-before-1400x1000" src="https://github.com/user-attachments/assets/f225d97f-8486-4e7d-87eb-cdafd42b53a5" /> | <img width="1400" height="1000" alt="9079-followup-after-1400x1000" src="https://github.com/user-attachments/assets/aeb254e0-6410-4f6f-a0d8-3051c5dd2c83" /> |
| `size="10"` for two category headings and two feeds, leaving unnecessary empty space. | `size="4"` for the same data, matching the four rendered rows. |
2026-08-01 15:00:41 +02:00
dd2ef8ffa6 Group export feeds by category (#9079)
* Group export feeds by category

## What changed
- Groups feed choices in the import/export page by their existing FreshRSS category.
- Preserves the current export request format and selection behavior.

## Why
The export selector previously mixed feeds from every category, making a category-specific export difficult to assemble.

Closes #5555

* Declare export feed count view data

* Fix select size

---------

Co-authored-by: Gerard Alvear <gerard.alvear@logiqd.me>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-07-29 16:58:54 +02:00
36d973a3bd Filter global view feed list by state and search (#9132)
* Filter global feed list by favorites

Fixes #4564.

The global view now filters its category/feed list when the Favorites filter is active, using the same article state and search criteria used when a feed is opened. Empty categories are omitted rather than showing feeds that would open to no matching articles.

* Fix favorite feed state query typing

* Rework logic, including searches

After reflection, I have revised the logic so that in the global view, the categories and feeds shown are always filtered by the search query (if any) and the states (if consequential):

<img width="2012" height="846" alt="image" src="https://github.com/user-attachments/assets/1fd693fa-9184-4601-85ed-2579e3b7299c" />


This makes the global view more useful and distinct in my opinion (this was otherwise not a view I was using myself, but now it will be).

Note that this behaviour would be challenging to port to the normal view for performance reasons.

* Show the matching counts in the global view UI instead of number of unreads

* Spelling

* Fix case of STATE_ALL

* Minor: more explicit logic

---------

Co-authored-by: Gerard Alvear <gerard.alvear@logiqd.me>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-07-29 16:36:06 +02:00
Jeremy Nguyen a8a4264af2 Add remote IP address to warning on form login (#8942)
Closes #8941
Add remote IP address to warning on form login
2026-07-24 17:47:00 +02:00