aboutsummaryrefslogtreecommitdiffstats
path: root/includes/session
Commit message (Collapse)AuthorAgeFilesLines
...
* Add explicit casts between scalar typesUmherirrender2022-03-012-2/+2
| | | | | | | | | | | | | | | * Some functions accept only string, cast ints and floats to string * After preg_matches or explode() casts numbers to int to do maths * Cast unix timestamps to int to do maths * Cast return values from timestamp format function to int * Cast bitwise operator to bool when needed as bool * php internal functions like floor/round/ceil documented to return float, most cases the result is used as int, added casts Found by phan strict checks Change-Id: Icb2de32107f43817acc45fe296fb77acf65c1786
* Replace some more usages of Wikimedia\(suppress|restore)Warnings()Reedy2022-02-241-2/+3
| | | | Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
* Apply ReturnTypeWillChange to various implementations of built in interfacesReedy2022-01-251-0/+6
| | | | | Bug: T289879 Change-Id: Ifcac569a1aaa378f21a73357638cd6f734a7640a
* Pass a service container to ObjectFactory in SessionManagerAlexander Vorwerk2022-01-211-2/+7
| | | | | | | | | | ObjectFactory needs a service container from which it can fetch the services to be injected. ObjectFactory::createObject automatically uses the one being injected into ObjectFactory. This now allows easy injection of services into session providers. Change-Id: I8e33e7ff08cef039104b967ce44f29ef106d0a4d
* Explicit cast TS_UNIX to int for arithmetic operations and int argsUmherirrender2022-01-111-2/+2
| | | | | | | | When the called function has a doc of int, it should be cast to be explicit here. Also cast for arithmetic operations to be explicit about the number Change-Id: I905b78dfb66e66443e0e3203488bab5b548db543
* Refactor global variables to use MediaWikiServices insteadTChin2022-01-101-6/+9
| | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* Fix typos in comments (S)Siddharth VP2022-01-091-2/+2
| | | | Change-Id: Id86769ca81ff65707edde520585aa9ea117123e1
* Add entry point name to disabled Session exception if possibleAmmarpad2021-12-081-2/+4
| | | | | Bug: T296898 Change-Id: I9d3f1da8a8b5b88a6972e7926d2dac09704deaac
* Remove or replace usages of "sane"Reedy2021-11-221-1/+1
| | | | | Bug: T254646 Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
* Remove or replace usages of "sanity"Reedy2021-11-192-4/+3
| | | | | Bug: T254646 Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
* Cleanup mixed space/tab line indentUmherirrender2021-09-041-6/+6
| | | | Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
* build: Updating dependencieslibraryupgrader2021-07-224-7/+7
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* Merge "Move CRSF token generation to CsrfTokenSet"jenkins-bot2021-06-214-1/+167
|\
| * Move CRSF token generation to CsrfTokenSetPetr Pchelko2021-06-184-1/+167
| | | | | | | | Change-Id: Idf68f1cc63fb2e01e004ff353fcda026fa4ec10f
* | Remove some more comments that literally repeat the codeThiemo Kreuz2021-06-181-1/+1
|/ | | | | | | | | | | | | … including PHPDoc tags like `@return <type> $variableName`. A return value doesn't have a variable name. I can see that some people do this intentionally, repeating the variable name that was used in the final `return $var;` at the end of a method. This can indeed be helpful. I leave a lot of these untouched and removed them only when it's obviously wrong, or does not provide any additional information in addition to what the code already says. Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
* Merge "Use null coalecing operators everywhere consistenctly."jenkins-bot2021-06-041-1/+1
|\
| * Use null coalecing operators everywhere consistenctly.Petr Pchelko2021-06-031-1/+1
| | | | | | | | | | | | Auto-generated with rector. Change-Id: I4f27e10cf029bb067b7bc57d82f7a64e21ea8d42
* | Edit the documentation of SessionProvider, AbstractAuthenticationProvider::initvladshapik2021-06-021-1/+2
|/ | | | | | | | | | | The documentation of SessionProvider::init says that the method can be used in implementation tests. Now all tests must use SessionProviderTestTrait::initProvider in order to initialize a SessionProvider. So the entire description after @internal was rewritten. Also the similar note was added to the documentation of AbstractAuthenticationProvider::init. Bug: T283931 Change-Id: I1cde6fd12666ef3a7c9b1e33a718592c11cf9e29
* Reapply "Hard Deprecate User ::getCanonicalName, ::isUsableName, ↵Vlad.shapik2021-05-312-2/+4
| | | | | | | | | | ::isCreatableName"" This reverts commit ecf826a2ee9442ee669e8057328a0118c1a5d0f8. Reason for revert: need to edit the patch and then it will be GTG in order to finish hard deprecating of User ::getCanonicalName, ::isUsableName, ::isCreatableName Change-Id: I2f57f56728fcbeada96dc2228f07dc8bcaa5d4f6
* Merge "Remove unused default values from class properties"jenkins-bot2021-05-132-4/+4
|\
| * Remove unused default values from class propertiesThiemo Kreuz2021-05-122-4/+4
| | | | | | | | | | | | | | | | In all these cases the property is unconditionally set in the constructor. The extra initialisation is effectively dead code and an extra source of errors and confusion. Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
* | Hard deprecate the setters of SessionProvider classvladshapik2021-05-121-5/+5
|/ | | | | Bug: T282256 Change-Id: I97244429bb4aa05ffdeda381f89db5dbda182d31
* Revert "Hard Deprecate User ::getCanonicalName, ::isUsableName, ↵Ppchelko2021-05-052-4/+2
| | | | | | | | | | ::isCreatableName" This reverts commit b491279268fe1769a8787cbf30b5309c8aa91363. Reason for revert: caused CentralAuth tests to fail. Change-Id: Icb3ed094578df427622e0da2a7462645adcc3d6f
* Hard Deprecate User ::getCanonicalName, ::isUsableName, ::isCreatableNamevladshapik2021-05-042-2/+4
| | | | | Bug: T275030 Change-Id: I60689ee6519c2dbd6d000afa8ac05c3e6b7895d2
* Create an initialization method in the SessionProvider classvladshapik2021-05-045-34/+121
| | | | | | | | | | | | | init() method was added to SessionProvider. It helps to inject dependecies. Overridable postInitSetup() method was added to SessionProvider. A provider can override this to do any necessary setup. SessionProvider ::setLogger(), ::setManager(), ::setConfig(), ::setHookContainer() were soft deprecated. Now developers must use SessionProvider::init() Bug: T275030 Change-Id: I958797881251572e4ec22e7dd9d13f74f7e216a3
* Use some more neutral languageReedy2021-04-181-1/+1
| | | | | Bug: T277987 Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
* Merge "SessionManager: Document expectations for storage backend"jenkins-bot2021-04-141-0/+29
|\
| * SessionManager: Document expectations for storage backendTimo Tijhof2021-01-081-0/+29
| | | | | | | | | | Bug: T270225 Change-Id: I2dcf0c979d8ad6e41e583bde056d21526b1bce9a
* | Avoid using User::isValidUserName()ZabeMath2021-03-141-1/+3
| | | | | | | | | | | | | | User::isValidUserName is deprecated since 1.35 and should be replaced with the UserNameUtils service Bug: T277398 Change-Id: Iaef995b992e2f38f651453092b23c928479e7d18
* | Merge "Use static closures where safe to use"jenkins-bot2021-02-142-2/+2
|\ \
| * | Use static closures where safe to useUmherirrender2021-02-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* | | Call __toString explicitly when passing an object to the loggerGergő Tisza2021-02-122-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logstash formatter for Monolog 2 doesn't do this automatically anymore, and it wasn't really correct anyway to rely on a formatter when we have no guarantee it's going to be used. Follows up If92d60289fa925d19261ef912e2f2a5d31db31dc. Bug: T269680 Change-Id: Ia7875346cec95fbc30bc4579ec8b7fb60e911d12
* | | Update SessionManager to pass session string representation to loggerCole White2021-01-261-16/+16
|/ / | | | | | | | | | | | | | | | | Sending the object to the logger renders an object in the logging pipeline. This type-conflicts with other uses of this field as it is expected to be a string. Bug: T269680 Change-Id: If92d60289fa925d19261ef912e2f2a5d31db31dc
* / ParserTestRunner: share more code w/ MediaWikiIntegrationTestCaseC. Scott Ananian2021-01-071-1/+1
|/ | | | | | | | | | | | | | | | | | | | Refactor the database setup code to share more code between ParserTestRunner and MediaWikiIntegrationTestCase. Made `::setupAllTestDBs` static so it can be reused from ParserTestRunner. Made ParserTestRunner::addArticle more like MediaWikiIntegrationTestCase::addCoreDBData(). Some additional refactoring work could be done here in the future to share more code. After the refactoring the ParserTestTables hook is no longer necessary and so has been (soft) deprecated. MediaWikiIntegrationTestCase clones all database tables, so ParserTestRunner no longer needs to ask extensions for a list of specific tables it should clone. Cleaning up the handful of extensions which define this hook will be left to a future patch set. Change-Id: I5124789fac333a664b73b4b4a1e801ecc0a618ca
* Improve custom folding and groupingTim Starling2020-12-232-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PHPStorm can use custom folding regions defined in either the VisualStudio style or the NetBeans style. The VisualStudio style is more pleasing to the eye and also works as a vim foldmarker. So get rid of the previous vim foldmarkers, and use region/endregion. region/endregion need to be in a single-line comment which is not a doc comment, and the rest of the comment is used as a region heading (by both PHPStorm and vim). So to retain Doxygen @name tags, it is necessary to repeat the section heading, once in a @name and once in a region. Establish a standard style for this, with a divider and three spaces before the heading, to better set off the heading name in plain text. Besides being the previous vim foldmarker, @{ is also a Doxygen grouping command. However, almost all prior usages of @{ ... @} in this sense were broken for one reason or another. It's necessary for the @{ to be in a doc comment, and DISTRIBUTE_GROUP_DOC doesn't work if any of the individual members in the group are separately documented. @name alone is sufficient to create a Doxygen section when the sections are adjacent, but if there is ungrouped content after the section, it is necessary to use @{ ... @} to avoid having the Doxygen group run on. So I retained, fixed or added @{ ... @} in certain cases. I wasn't able to test the changes to the trait documentation in Doxygen since trait syntax is not recognised and the output is badly broken. Change-Id: I7d819fdb376c861f40bfc01aed74cd3706141b20
* build: Updating mediawiki/mediawiki-phan-config to 0.10.5Umherirrender2020-12-121-3/+0
| | | | Change-Id: I343d2bae626a3903eb1e67c05bf5caef4314b7dd
* UserInfo: use UserFactorydaniel2020-12-011-2/+7
| | | | | | | This allows integration tests to control User instances by setting a fake UserFactory service. Change-Id: I006d18b3bc4e8c7eee5da243bac663b10238ae1c
* Remove documentation that literally repeats the codeThiemo Kreuz2020-10-276-13/+0
| | | | | | | | | | | | | | | For example, documenting the method getUser() with "get the User object" does not add any information that's not already there. But I have to read the text first to understand that it doesn't document anything that's not already obvious from the code. Some of this is from a time when we had a PHPCS sniff that was complaining when a line like `@param User $user` doesn't end with some descriptive text. Some users started adding text like `@param User $user The User` back then. Let's please remove this. Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
* Typehint SessionManager::getGlobalSession and RequestContext::getMainDaimona Eaytoy2020-10-221-1/+1
| | | | | | | | | These methods use a static property to cache the return value, and although they're guaranteed to return an object (as per documentation, current code, and current usage), some static analysis tool may fail to understand this. Change-Id: I4317e1bb11e9793de721356a579a7677137e52cc
* SessionManager: Always log IP/UA in session-ipGergő Tisza2020-10-091-1/+2
| | | | | Bug: T264799 Change-Id: I25257cde897db684a8438923487f80b09abe16c0
* Log IP/device changes within the same sessionGergő Tisza2020-10-081-0/+94
| | | | | | | | | | | | | | | | Store IP and device information in the session and log when it changes. The goal is to detect session leakage when the session is accidentally sent to another user, which is a hypothetical cause of T264370. The log will be noisy since users do change IP addresses for a number of reasons, but we are mainly interested in the ability of correlating user-reported incidents where we have a username to filter by, so that's OK. Based on I27468a3f6d58. Bug: T264799 Change-Id: Ifa14fa637c1b199159ea11e983a25212ae005565
* Deduplicate SessionBackend::logPersistenceChange callsGergő Tisza2020-10-081-4/+27
| | | | | | | | If all goes well, this should cut INFO-level log volume on the session channel to about a third. Bug: T264793 Change-Id: I268b57747a1449456df2c98696807c50b05e7147
* Log when SessionManager is emitting cookiesGergő Tisza2020-10-072-0/+65
| | | | | | | | | | | | | This is very noisy (logs several times in the same request), but I'm not sure much can be done about that. It is a flaw in SessionManager, which does call SessionProvider::persist/unpersist that many times, and relies on cookie deduplication in WebResponse. But it should give some idea of when cookies are emitted, and does not log on normal requests (where no cookies are emitted) so it shouldn't overload the logging backend. Bug: T264793 Change-Id: I93733d73af1dfcf539a94b17cf5e4de76cc59748
* Merge "Document hook names in hook interfaces."jenkins-bot2020-10-023-0/+9
|\
| * Document hook names in hook interfaces.daniel2020-09-273-0/+9
| | | | | | | | | | Bug: T258665 Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
* | Fix typos related to repeated wordsUmherirrender2020-09-272-2/+2
|/ | | | Change-Id: Ibc187d95b003017255bc87adf56afae7a59bd3db
* Merge "Replace "@stable for implementation" with "@stable to implement""jenkins-bot2020-07-132-2/+2
|\
| * Replace "@stable for implementation" with "@stable to implement"daniel2020-07-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
* | Merge "Replace "@stable for subclassing" with "@stable to extend""jenkins-bot2020-07-132-2/+2
|\ \
| * | Replace "@stable for subclassing" with "@stable to extend"daniel2020-07-132-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4