There is a possibility that the retrieved action (by name) will not match the passed in right, we should ensure that the retrieved action matches.
Also, rename $action to $actionObj
There is a possibility that the retrieved action (by name) will not match the passed in right, we should ensure that the retrieved action matches.
Also, rename $action to $actionObj
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Resolved | dbarratt | T213220 Title::checkUserBlock() should ensure the retrieved action matches the passed in restriction | |||
| Resolved | dbarratt | T208862 Title::checkUserBlock should call User::isBlockedFrom for every action that requires unblock |
Change 482901 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/core@master] Title::checkUserBlock() should ensure the retrieved action matches the passed in restriction.
Can you describe what the effect of this would be (before and after your change) if the actions didn't match?
Action 1
Action 2
Action 3
Result (input: test)
Result (input: tester)
Result (input: sampler) (See T213738)
Excellent. Thanks.
This shows me what I couldn't quite work out from the code. In some instances, the name collision would cause a reversal of the effective block?
I think that makes this more important to fix. Initially, it read like something more along the lines of cleaning up code smell but it appears now as a decent vector for bugs.
Potentially, yes. The example I gave is an extreme example. No such mis-match exists (that I'm aware of), but it is certainly possible. Also, and somewhat unrelated, an Action is not required to have a restriction at all. For instance the purge restriction matches the purge action. Current this results in the user not being blocked from purge (which is correct), after this change, the user is blocked from purge (since the action has no restriction to match it against). To resolve this conflict (before T213738 is resolved) I've added purge to the whitelist of actions that are not prevented by a block (like read). If there are other actions like this, the worse case scenario is that they are blocked where they previously where not (on partial blocks).
Change 482901 merged by jenkins-bot:
[mediawiki/core@master] Ensure action object matches passed in right in Title::checkUserBlock()
Hmm... I actually don't think there is a way to test this since the problem is theoretical.
Could you possibly fudge some fixture data that causes the problem?
Thanks for the explanation by the way. It's helped me understand the issue.
Oooo..... maybe we are talking about two different things. I was thinking testing as in "QA testing", but I suppose I could write a test with mock actions (we already have those). Should I do that?
We were talking about two different things. In fact, in this case, a unit test is likely the better of the two options because I agree that QA on this with real data is probably impossible (or too much work to be reasonable).
Change 491675 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/core@master] Add tests to ensure that retrieved actions match passed in restrictions.
Change 491675 merged by jenkins-bot:
[mediawiki/core@master] Add tests to ensure that retrieved actions match passed in restrictions