jenkins-bot has submitted this change and it was merged.
Change subject: use ValueError when hardcoded config is insecure
......................................................................
use ValueError when hardcoded config is insecure
The library exception UserActionRefuse is used by the library for
action against a target user that are not possible, such as when
attempting to send an email to a user that has email disabled.
The script_wui constructor is using UserActionRefuse when its hardcoded
config values include a page title which does not end in .js or .css,
which is one way to have a semi-protected wiki page. The compat version
subster.py does not use this exception.
As this exception is raised only when there is a problem with the
hard-coded config value defined in the same module, and backwards
compatibility would require complicating the library exceptions for the
benefit of only one script which is not in widespread use, and any
working script which monkey-patches script_wui.bot_config needs must
already have a valid config in order to bypass this exception and it
extremely unlikely that any working script will be handling this
exception appropriately, the exception raised is simply changed to
ValueError.
Change-Id: Ic3674c3a82484f7d263bae337db9ed6948c8d228
---
M scripts/script_wui.py
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/script_wui.py b/scripts/script_wui.py
index 65d7148..12dea61 100755
--- a/scripts/script_wui.py
+++ b/scripts/script_wui.py
@@ -147,7 +147,11 @@
for item in self.refs:
# security; first check if page is protected, reject any data if
not
if os.path.splitext(self.refs[item].title().lower())[1] not in
['.css', '.js']:
- raise pywikibot.UserActionRefuse(u'Page %s is not secure, e.g.
semi-protected!' % self.refs[item])
+ raise ValueError(u'%s config %s = %s is not a secure page; '
+ u'it should be a css or js userpage which are
'
+ u'automatically semi-protected.'
+ % (self.__class__.__name__, item,
+ self.refs[item]))
self.refs[item].get(force=True) # load all page contents
# init background timer
--
To view, visit https://gerrit.wikimedia.org/r/180705
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3674c3a82484f7d263bae337db9ed6948c8d228
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits