Background
Currently all logged in users run gadgets and user scripts by default. There is an existing safe mode feature that disables all wiki-based scripts but this can easily be toggled off via JavaScript (without 2FA step) and does not completely protect the user. I've been using that on my staff account given I don't need site scripts in this account. Often site wide styles are essential for viewing the page, so disabling everything can have other negative consequences for this to be useful and I find myself disabling safe mode to troubleshoot issues with articles that require MediaWiki:Common.css. This would also incentivize good practices such as not adding user scripts to gadgets. Based on conversations with @Catrope and @EMill-WMF I have created this ticket.
User story
As a user with privileged wiki rights, safe mode and 2FA enabled I want better protections from on-wiki scripts.
Requirements
- Changing the Safe mode preference should require 2FA when enabled.
- Safe mode should be more flexible and support disabling by type (user script, site script, site style, site script)
- If I have safe mode enabled, calling functions such as importScript('User:Jdlrobson/rlExtra.js') should not work
Benefits
- Improved privacy - We can disable data collection for users who have explicitly enabled user scripts (which might lead to them being more identifiable in anonymized data) e.g. webclienterror
- Improved performance for readers - readers not using watchlist do not need many of the watchlist gadgets that are enabled by default
- Improved security - power users can limit vectors of attack on their account either temporarily or permenantly .
BDD
- For QA engineer to fill out
Test Steps
- For QA engineer to fill out
Design
Acceptance criteria
- Add acceptance criteria
Communication criteria - does this need an announcement or discussion?
- Add communication criteria
Rollback plan
- What is the rollback plan in production for this task if something goes wrong?
This task was created by Version 1.2.0 of the Web team task template using phabulous


