Commit graph

10 commits

Author SHA1 Message Date
daniel
5182ccbf8e Be explicit about not needing a real token.
REST handlers that delegate to action API modules need to supply a
known-good token when the REST endpoint has been accessed in a way that
is safe against CSRF. This was done by returning null from getToken(),
which seems surprising and brittle. Having a method called needsToken()
makes the code easier to understand.

Follow-Up-To: If41749722b28c8c0e9898b3d3e7937167653fb10
Change-Id: I04148a7e000c3c73241bc20fe1582880b16b0056
2023-11-21 18:23:33 +00:00
Amir Sarabadani
15a278189f Reorg: Move MWTimestamp to MediaWiki\Utils
Bug: T321882
Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
2023-08-19 05:53:40 +02:00
Daimona Eaytoy
3b81a1ef27 Add TokenAwareHandlerTrait for handlers supporting CSRF-unsafe providers
Returning a known-good token is not part of the trait method because I
think handlers other than the ones based on the action API wouldn't even
need a token if the session is safe against CSRF.

Bug: T305043
Change-Id: If41749722b28c8c0e9898b3d3e7937167653fb10
2022-05-25 02:07:36 +00:00
Umherirrender
a9aa1e7346 Fix type of value directly passed to php internal functions
Found by phan strict checks

Change-Id: Icc44cd143f2e98fa3ca188e625a3289441de0f73
2022-03-07 20:41:55 +01:00
daniel
91dc627c85 UpdateHandler: fix response for null edits
The response from a null-edit should contain the current revision's
revision ID and timestamp, not the info from the edit's base revision.

Bug: T277601
Change-Id: I9d353cdc4cb9e3c1435c93ffe63ef4fef173ec4d
2021-03-26 16:53:43 +00:00
daniel
b38e0e8e32 REST edit: handle null edits correctly
For null-edits, the new revision is the same as the old revision.

Bug: T277601
Change-Id: I73f902f7ef890470ff6ee3e4500095adbb00938a
2021-03-19 14:10:25 +01:00
Petr Pchelko
3a2e8883b4 Rest: use Authority in all core handlers
Bug: T239753
Change-Id: Idf2229255f49514dd8b68bf63573c5b619b4f2f1
2021-01-21 18:22:33 -06:00
daniel
65342f8353 Define POST handler for /page/: create page
NOTE: once this is merged, also merge Ie7b47e6868cc on the OAuth repo,
to fix unit tests after a breaking change to Router's constructor
signature.

Bug: T230842
Change-Id: I8f5b92918a58e44a4f2d8c78d234d9f64c2d06bf
2020-03-25 20:49:20 +01:00
daniel
81a47eaad3 page/update: return diffs on conflict
This adds diffs for use in an interactive merge when detecting an edit
conflict.

Bug: T230843
Change-Id: I6345361fce98524027ad778749d4fbf54169ccb6
2020-03-23 15:59:47 +00:00
daniel
58e5332991 page/update endpoint
Bug: T230843
Change-Id: I95289eddfc9ab2e0cef11b9363a5e239cdb2258e
2020-03-23 16:59:21 +01:00