Commit Graph
50 Commits
Author SHA1 Message Date
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
Inverle 05bfbb9f33 Move PHPUnit flags to a config file and use strictest failure mode (#9374)
See:
* https://docs.phpunit.de/en/12.5/xml-configuration-file.html#the-failonallissues-attribute
* https://docs.phpunit.de/en/12.5/xml-configuration-file.html#the-displaydetailsonallissues-attribute
2026-09-30 21:36:38 +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
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
Alexandre Alapetite 8e007af39d Fiix cookies with some browsers (#8867)
Fix https://github.com/FreshRSS/FreshRSS/issues/8850
Fix login with e.g. SeaMonkey
Regression due to https://github.com/FreshRSS/FreshRSS/pull/8778
2026-05-19 23:03:51 +02:00
Alexandre AlapetiteandCopilot bbb28b5eda Fix reauth with legacy cookie (#8778)
Fix https://github.com/FreshRSS/FreshRSS/issues/8486
Fix https://github.com/FreshRSS/FreshRSS/issues/8532
Restore some legacy code from https://github.com/FreshRSS/FreshRSS/pull/8447

How to test:
* Start with FreshRSS 1.28.1
* Update to edge
* Access user management

Co-authored-by: Copilot <copilot@github.com>
2026-05-08 09:05:32 +02:00
Alexandre Alapetite 0df3a3c51c Rewrite setcookie using new syntax (#8447)
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/2630 now that we have PHP 7.3+ (even PHP 8.1+).
* The new syntax natively supports `samesite`, and also avoids the need of re-setting all parameters.
* Use automatic path instead of own function `getCookieDir()`.

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8446
* Sanitize lifetime of session cookies from PHP ini to avoid likely invalid/misunderstood values
2026-01-28 08:21:25 +01:00
Alexandre Alapetiteandrioky 63379a6fc2 Fix custom session.cookie-lifetime (#8446)
fix https://github.com/FreshRSS/FreshRSS/issues/8430
Fix case when `session.cookie-lifetime` is not using the default value of 0 in PHP ini.

Co-authored-by: rioky <rioky@users.noreply.github.com>
2026-01-18 20:41:39 +01:00
Alexandre Alapetite 00cd5df294 Use native PHP #[Deprecated] (#8325)
https://php.watch/versions/8.4/Deprecated
And enfore it with PHPUnit + PHPStan.
Especially useful for extensions.
2025-12-17 10:11:18 +01:00
Inverle 200eafb352 Regenerate session ID on login (#7829)
Follow-up to #7762

* Regenerate session ID on login
* Send only one cookie
* Improvements
* Delete old session file
* Simplify
* Make function consistent with others
2025-08-30 21:40:00 +02:00
Alexandre Alapetite b1d24fbdb7 PHPStan 2.0 (#7131)
* PHPStan 2.0
fix https://github.com/FreshRSS/FreshRSS/issues/6989
https://github.com/phpstan/phpstan/releases/tag/2.0.0
https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md

* More

* More

* Done

* fix i18n CLI

* Restore a PHPStan Next test
For work towards PHPStan Level 10

* 4 more on Level 10

* fix getTagsForEntry

* API at Level 10

* More Level 10

* Finish Minz at Level 10

* Finish CLI at Level 10

* Finish Controllers at Level 10

* More Level 10

* More

* Pass bleedingEdge

* Clean PHPStan options and add TODOs

* Level 10 for main config

* More

* Consitency array vs. list

* Sanitize themes get_infos

* Simplify TagDAO->getTagsForEntries()

* Finish reportAnyTypeWideningInVarTag

* Prepare checkBenevolentUnionTypes and checkImplicitMixed

* Fixes

* Refix

* Another fix

* Casing of __METHOD__ constant
2024-12-27 12:12:49 +01:00
15745d42b7 Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code

Upgrade code to php 8.1

* fix remarques

* code review

* code review

* code review

* Apply suggestions from code review

* code review

* Fixes

* Many remainging updates of array syntax

* Lost case 'reading-list'

* Uneeded PHPDoc

---------

Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-11-28 17:11:04 +01:00
Alexandre Alapetite a81656c3ed Upgrade to PHP 8.1 (#6711)
* Upgrade to PHP 8.1
As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474

https://www.php.net/releases/8.0/en.php
https://www.php.net/releases/8.1/en.php

Upgrade to available native type declarations
https://php.net/language.types.declarations

Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore)

Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22.

* Include 6736
https://github.com/FreshRSS/FreshRSS/pull/6736
2024-09-06 09:06:46 +02:00
Alexandre Alapetite a80a5f48a1 Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels

* Revert wrong replace in comment

* Fix PHPStan level 8

* Update PHPStan and other dev dependencies

* Remove obsolete comment

* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge

* More bleedingEdge

* A bit more PHPStan level 9

* More PHPStan level 9

* Prepare for booleansInConditions
Ignore int and null

* Revert wrong line

* More fixes

* Fix keep_max_n_unread

* Stricter attribute functions

* Stricter callHooks and more PHPStan level 9

* More typing

* A tiny more
2023-12-18 17:59:16 +01:00
Alexandre Alapetite e70e5542e4 Fix Minz_Session::param visibility (#5889)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
2023-11-17 13:47:13 +01:00
30c7a61a9b Use strict_types (#5830)
* Little's optimisations and booleans in conditions

* Apply strict type

* Apply strict type

* Apply strict type

* Fix multiple bugs with PHP 8.2 and 8.3

* Many declares missing, more errors fixed

* Apply strict type

* Another approach

* Stronger typing for Minz_Session

* Fix case of SQLite

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-16 22:43:00 +01:00
Alexandre Alapetite 06d0099504 Require PHP 7.4+ (#5720)
* Require PHP 7.4+
https://github.com/FreshRSS/FreshRSS/discussions/5474

* Update Docker oldest
Alpine 3.13 with PHP 7.4.26

* Add missing packets to Docker oldest

* Update to typed properties
https://php.net/migration74.new-features#migration74.new-features.core.typed-properties

* More types
2023-10-30 20:47:27 +01:00
maThandAlexandre Alapetite 54c8de86c7 docs: language table added (#5375)
* docs: language table added

* Update 05_Configuration.md

* Update 05_Configuration.md

* french docs

* Unicode quote and a few fixes
(Same search&replace aslo applied to a few other files)

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-05-07 21:35:08 +02:00
03129a2ee7 PHPStan for Minz_Session class (#5282)
* PHPstan level 8 for Session.php

* PHPstan level 8 for Session.php

* PHPstan level 8 for Session.php

* Update lib/Minz/Session.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-10 22:35:40 +02:00
0317683155 Add test and type hinting (#5087)
* - Add test and type hinting
- pass PhpStan Level 9

* fix dump

* fix style

* fix visibility

* fix style

* add test

* add test

* add test

* add test

* add test

* Simplify

* cleaning after test

* remove space

* fix style

* use specific log file for test

* Remarque's from Alkarex

* A few more details

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-03-27 00:36:21 +02:00
Alexandre Alapetite 47e242aa77 Fix ctype_alnum (#4182)
* Fix ctype_alnum
#fix https://github.com/FreshRSS/FreshRSS/issues/4180
Ensure `ctype_alnum()` gets a string

* Changelog
2022-01-30 15:53:17 +01:00
Alexandre Alapetite 4e2dff4591 Add spell checking with typos (#4138)
* Add spell checking with typos
Implement https://github.com/FreshRSS/FreshRSS/pull/4134#issuecomment-1008027558

* GitHub Actions attempt

* Quiet wget

* Makefile
2022-01-09 18:21:40 +01:00
Alexandre Alapetite 3f6aa42b81 Fix most PHPDocs errors (#4107)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types
2022-01-01 11:26:56 +01:00
Alexandre Alapetite 607f7e7254 Fix several comments syntaxes (#3615)
Mainly wrong `@return` types in comments
2021-05-08 10:27:18 +02:00
Alexandre Alapetite 98b82842d5 Session compatibility PHP 7.1 and older (#3273)
#fix https://github.com/FreshRSS/FreshRSS/issues/3239
Reason: https://php.net/session-write-close used to return void and not
boolean before PHP 7.2
2020-12-12 15:59:37 +01:00
Alexandre Alapetite 0319cc9d23 Minz allow parallel sessions (#3096)
* Minz allow parallel sessions

#fix https://github.com/FreshRSS/FreshRSS/issues/3093

* Array optimisation

* Array optimisation missing

* Reduce direct access to $_SESSION except in install process

* Fix session start headers warning

* Use cookie only the first time the session is started:
`PHP Warning:  session_start(): Cannot start session when headers
already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39`

* New concept of volatile session for API calls

Optimisation: do not use cookies or local storage at all for API calls
without a Web session
Fix warning:

```
PHP Warning:  session_destroy(): Trying to destroy uninitialized session
in Unknown on line 0
```

* Only call Minz_Session::init once in our index

It was called twice (once indirectly via FreshRSS->init())

* Whitespace

* Mutex for notifications

Implement mutex for notifications
https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809

* Typo

* Install script is not ready for using Minz_Session
2020-10-06 23:19:45 +02:00
Alexandre Alapetite e9d50f48eb HTTP_X_FORWARDED_PREFIX for cookie path (#2201)
Forgotten. Follow-up of https://github.com/FreshRSS/FreshRSS/pull/2191
2018-12-27 22:57:30 +01:00
Alexandre Alapetite ba9f4461d8 Secure cookie HTTPS 2016-03-08 19:00:04 +01:00
Alexandre Alapetite e4a459a6ed CSP no inline javascript draft
https://github.com/FreshRSS/FreshRSS/issues/1075
2016-02-16 23:53:39 +01:00
Alexandre Alapetite 189e790f32 Minz cookie session httpOnly
https://github.com/FreshRSS/FreshRSS/issues/924
https://github.com/FreshRSS/FreshRSS/pull/936/files#r35948311
2015-07-31 11:26:57 +02:00
Alexandre Alapetite 760ec5f223 Whitespace 2015-07-31 00:17:32 +02:00
Alexandre Alapetite 59daed3d4e Minz slight change in session cookie path
https://github.com/FreshRSS/FreshRSS/issues/924#issuecomment-126499403
2015-07-31 00:12:55 +02:00
Alexandre Alapetite f7190c34e1 Minz session cookie path bug
https://github.com/FreshRSS/FreshRSS/issues/924#issuecomment-126499403
2015-07-30 23:42:28 +02:00
Marien Fressinaud 22d7e0d638 Simplify code for cookie dir
See https://github.com/FreshRSS/FreshRSS/issues/700
See https://github.com/FreshRSS/FreshRSS/commit/eec95ffb6a414f00f0ddd6cb1f81ac7ee55d4f6b
2015-01-21 16:28:29 +01:00
Marien Fressinaud eec95ffb6a Fix bug related to cookie path
Fix https://github.com/FreshRSS/FreshRSS/issues/700
2015-01-21 15:43:25 +01:00
Marien Fressinaud addcea9cd4 Fix i18n loading and availableLanguages calls
- Change the way to init i18n
- Add a availableLanguages() method to Minz_Translate

See https://github.com/FreshRSS/FreshRSS/issues/730
2015-01-06 21:10:51 +01:00
Alexandre Alapetite ee1b8f6f72 Long term cookie to keep session open
Token system
https://github.com/marienfressinaud/FreshRSS/issues/465
2014-08-13 00:09:48 +02:00
Marien Fressinaud 08a9009c19 Fix a Minz_Session TODO
Not use additional variable to manipulate session variables
Fix coding style
2014-08-12 21:10:10 +02:00
Marien Fressinaud ed7d8aa44f Use REQUEST_URI instead of SCRIPT_NAME for cookies
See https://github.com/marienfressinaud/FreshRSS/commit/eceb7756cfcf117c2a18984291181a84697ed3cd#commitcomment-7345438
2014-08-12 21:04:39 +02:00
Marien Fressinaud bc71a577fe Revert "Set session.gc_maxlifetime"
This reverts commit df47217839.

See https://github.com/marienfressinaud/FreshRSS/issues/465
2014-08-11 18:39:22 +02:00
Marien Fressinaud df47217839 Set session.gc_maxlifetime
Take the maxvalue between 1440 (24m) and cookie lifetime when calling
Minz_Session::keepCookie()

See https://github.com/marienfressinaud/FreshRSS/issues/465
2014-08-10 23:41:36 +02:00
Marien Fressinaud eceb7756cf Add possibility to keep logged in with form
Add an option to keep logged in.
Change lifetime of session cookie to 1 year.

See https://github.com/marienfressinaud/FreshRSS/issues/465
2014-08-10 20:29:43 +02:00
Alexandre Alapetite 0fa3353081 Cookie IE suite
Typo. Correction de
https://github.com/marienfressinaud/FreshRSS/commit/79d88a2d5b30aeadc71f7c98a4a860cd97e97562
2014-01-05 01:21:23 +01:00
Alexandre Alapetite 79d88a2d5b Corrige problème cookie avec IE en utilisant un chemin absolu
Corrige https://github.com/marienfressinaud/FreshRSS/issues/345
@marienfressinaud Il faudrait peut-être le ré-écrire un peu mieux en
utilisant base_url de la configuration de FreshRSS, mais je n'ai pas
trop suivi comment était généré et utilisée cette variable. Qu'en dis-tu
?
2014-01-05 01:14:01 +01:00
Alexandre Alapetite b4c477ca41 actualize_script compatible multi-utilisateur
* Messages plus verbeux dans actualize_script
* Ajout d'un message syslog lorsque SimplePie fait une requête HTTP
* Minz_Session ne fermait pas les sessions complètement.
* Nouvelle option dans Minz_Dispatcher et Minz_FrontController  pour ne
pas utiliser ob_gzhandler.
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
2014-01-02 01:47:03 +01:00
Alexandre Alapetite bd5d7a7bcb Cache HTTP compatible multi-utilisateur
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
2013-12-30 15:00:41 +01:00
Alexandre Alapetite 96bdbafcea Refactorisation FreshRSS_Configuration
Implémente https://github.com/marienfressinaud/FreshRSS/issues/260
(évite les comparaisons de chaînes au profit des vrais booléens et
entiers)
Grosse simplification et réduction du code relatif à la configuration.
Supprime ConfigurationDAO.
Permet de simplifier considérablement configureController.
Évite de multiples copies des mêmes données en mémoire.
Évite de garder plusieurs versions de la configuration en mémoire
(auparavant : dans un tableau au niveau de ModelArray + au niveau de
FreshRSS_Configuration + en Session + des copies temporaires comme
ConfigurationDAO).
Ne stocke plus 'conf' en Session (n'était presque pas utilisé).
Évite de recharger plusieurs fois Translate inutilement.
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/303
2013-12-28 23:09:39 +01:00
Alexandre Alapetite 58300c36ad Cookie : sous-répertoire pour index (changements de répertoires !)
Implémente https://github.com/marienfressinaud/FreshRSS/issues/333
/public/ est renommé /p/
/public/index.php est déplacé dans /p/i/index.php
Le cookie de session est limité à /p/i/
2013-12-26 01:56:58 +01:00
Alexandre Alapetite d24b1e963e Lancer automatiquement le raffraîchissement des flux après une mise à jour de FreshRSS
https://github.com/marienfressinaud/FreshRSS/issues/330
2013-12-25 21:46:24 +01:00
Alexandre Alapetite 4ee4f16ffe Problème de casse renommage répertoire 2013-12-15 11:24:14 +01:00