Extension:SourceProtection

Category:Extensions without an imageCategory:GPL licensed extensions
MediaWiki extensions manual
SourceProtection
Release status: stableCategory:Stable extensions
Implementation User rights Category:User rights extensions
Description Removes the ability to view the source code of a page if a user does not have edit rights.
Author(s) Sen-Saitalk
Latest version 1.1.3 (2023-06-09)
Compatibility policy For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension.Category:Extensions with long-term support release branches compatibility policy
MediaWiki 1.35.+;1.39+Category:Extensions with manual MediaWiki version
PHP 5.4+ - 8.1
Database changes No
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
Category:All extensions

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 source code 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 source code of page can be viewed and edited.

Installation

  • 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 file:
    wfLoadExtension( 'SourceProtection' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Version history

Version 1.1.3 (2023-06-09)

MW 1.39+ support

Version 1.1.2 (2021-05-13)

Checked compatibility with 1.35+. No major changes, just typos or comments added

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 Page Forms 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

Category:Extensions by Wikibase Solutions
Category:All extensions Category:EditPage::showReadOnlyForm:initial extensions Category:Extensions by Wikibase Solutions Category:Extensions in GitHub version control Category:Extensions with long-term support release branches compatibility policy Category:Extensions with manual MediaWiki version Category:Extensions without an image Category:GPL licensed extensions Category:GetUserPermissionsErrors extensions Category:Page specific user rights extensions Category:SkinTemplateNavigation::Universal extensions Category:Stable extensions Category:User rights extensions