Extension:SourceProtection

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
SourceProtection
Release status: stable
Implementation User rights
Description Removes the ability to view the source code of a page if a user does not have edit rights.
Author(s) Sen-Sai
Latest version 1.1.1 (2017-10-10)
MediaWiki 1.24+
PHP 5.4+
Database changes No
License GNU General Public License 3.0 or later
Download Download Git master
Project page
Translate the SourceProtection extension if it is available at translatewiki.net
Check usage and version matrix.

The SourceProtection extension removes the ability to view the source code of a page if a user does not have edit rights through disabling certain actions.

The following actions are disabled which may provide access to the source code:

  • edit
  • move
  • history
  • info
  • raw
  • delete
  • revert
  • revisiondelete
  • rollback
  • markpatrolled


Additionally, the SourceProtection extension removes the following tabs from a page if a user may not edit:

  • View source
  • History
  • Edit with form (if Page Forms is installed)


It makes no sense to install this extension to hide the sourcecode of a page if you do not take various other actions as well. e.g. If you open the API with default edit rights, source content can still be read. Likewise for anonymous users. If they receive edit rights, the sourcecode of page can be viewed, edited.

Installation[edit]

  • Download and place the file(s) in a directory called SourceProtection in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/SourceProtection/SourceProtection.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Version history[edit]

Author: Sen-Sai

  • Version 1.1.1 (2017-10-10) Added more actions for user without edit permissions to protect the source of a page more thoroughly.
  • Version 1.1.0 (2017-08-08) Removes View Source tab and (if pageForms is installed the edit-Form tab) & History tab from menu and disables action=edit function for users with no edit permissions. It will also block the viewing of the readonly form.
  • Version 1.0 - Initial version (prototype)

See also[edit]

Other languages: English