Last modified: 2008-07-08 20:44:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11988 - Identifier needed for MediaWiki generated pages in page source
Identifier needed for MediaWiki generated pages in page source
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-15 00:26 UTC by Cacycle
Modified: 2008-07-08 20:44 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Adds a generator meta tag to the head of all MediaWiki pages (798 bytes, patch)
2008-01-27 16:02 UTC, Robert Leverington
Details

Description Cacycle 2007-11-15 00:26:52 UTC
For writing userscripts (e.g. Greasemonkey scripts) it is essential for a script to detect if a page has been generated by MediaWiki software. 

Currently there is no indicator, neither in the head section nor in the body code which under full control of the many different standard or custom skins.

I ran into this problem when I made the MediaWiki editor wikEd (http://en.wikipedia.org/wiki/User:Cacycle/wikEd) Greasemonkey compatible. Currently the program has to check the DOM for the fingerprints of many different skins. This causes problems with as yet unrecognized custom skins and changes. 

Writing extensions would be much easier with a unique identifier for MediaWiki-served web pages. This identifier could be in the head section and could also include the version of the software.
Comment 1 Brion Vibber 2007-12-05 21:28:20 UTC
What does this request mean?
Comment 2 Roan Kattouw 2007-12-05 21:30:27 UTC
(In reply to comment #1)
> What does this request mean?
From what I gather, the reported wants a meta tag, comment, or some other standardized fingerprint indicating an HTML page was generated by MediaWiki. Basically, we could have OutputPage add

<!-- Generated by MediaWiki version 1.11.0 -->

near the top of the output.
Comment 3 Cacycle 2007-12-05 21:42:19 UTC
Yes, that's about what I was suggesting. 

However, comments are somewhat difficult to access using JavaScript methods as far as I can see. Therfore I would prefer a 'real' element such as meta, div, or span.
Comment 4 Roan Kattouw 2007-12-05 21:43:21 UTC
(In reply to comment #3)
>Therefore I would prefer a 'real' element such as meta, div,
> or span.
<meta> is probably best for this purpose.

Comment 5 Brion Vibber 2007-12-06 16:10:23 UTC
WordPress does a <meta> like this:

<meta name="generator" content="WordPress 2.2.3" /> <!-- leave this for stats -->

Sound about right?


I'm a little leery of including version information, as we deliberately don't want that bulk-searchable as an obfuscation to make it harder for potential worms to find vulnerable versions of the software via search engines.
Comment 6 Cacycle 2007-12-06 17:42:53 UTC
Brion: The version is already available on Special:Version - I have actually used this successfully to google for older installations. If there is an option to disable the version number on Special:Version, then use the same setting to disable it for the meta tag, but keep the "MediaWiki" string.
Comment 7 Brion Vibber 2007-12-06 19:25:46 UTC
Special:Version is explicitly excluded from search by meta tag. That's a whole page, not an individual piece of the page which is aimed specifically at being searchable.
Comment 8 Cacycle 2007-12-07 01:54:33 UTC
I do not think that you can use search engines to find information hidden in meta tags - and worms crawling for vulnerable versions can always access special:version.
Comment 9 Cacycle 2008-01-27 14:58:51 UTC
Please could somebody take care of this. New and custom skins are constantly added to Wikipedia (e.g. Modern) as well as other sites and everytime  scripts have to be manually updated because there is still no simple and reliable Mediawiki identifier on the pages.
Comment 10 Robert Leverington 2008-01-27 16:02:54 UTC
Created attachment 4588 [details]
Adds a generator meta tag to the head of all MediaWiki pages

This adds a meta tag to the head scripts in OutputPage, which should theoretically be included in all skins output. The identifier is in the generator tag and is in the format "MediaWiki <version>" so that it could easily be checked by JavaScript or any other user agent.
Comment 11 Cacycle 2008-02-13 04:45:54 UTC
Please, could this be added as soon as possible. I can barely keep up with maintaining existing and writing new skin detections. If there are still objections about the version number, then please add at least the 'MediaWiki' part.
Comment 12 Daniel Kinzler 2008-02-14 09:36:36 UTC
can't you simple check for a js variable or function that will always be there for mediawiki pages? wgPageName comes to mind. Even wgVersion exists.
Comment 13 OverlordQ 2008-02-14 09:47:36 UTC
And isn't the current skin even given in the variable aptly named skin?
Comment 14 Cacycle 2008-02-15 03:39:32 UTC
JavaScript code on the pages is just on option that has to be enabled explicitly ($wgAllowUserJs). Many wikis do not enable this, e.g. for security reasons. Therefore, checking for JavaScript code is neither a reliable way to test for a MediaWiki generated page nor for identifying the used skin.
Comment 15 OverlordQ 2008-02-15 03:47:11 UTC
No, I'm pretty sure it's there regardless:

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Skin.php

WRT: makeGlobalVariablesScript
Comment 16 Cacycle 2008-02-17 06:17:17 UTC
See here for a MediaWiki 1.11.0 installation that does not generate the JavaScript code: http://wiki-beta.moztw.org/Special:Version. Is it a recent 1.11.1 change or have they disabled it somehow.
Comment 17 Thomas Bleher 2008-03-26 17:29:24 UTC
(In reply to comment #16)
> See here for a MediaWiki 1.11.0 installation that does not generate the
> JavaScript code: http://wiki-beta.moztw.org/Special:Version. Is it a recent
> 1.11.1 change or have they disabled it somehow.

I think they removed the JavaScript code when creating their custom skin.
As there's nothing you can do about that and the suggested methods will work for all "normal" skins, I suggest that this bug be closed.
Comment 18 Chad H. 2008-07-08 20:44:28 UTC
MW version is identifiable by both the wgVersion JS variable and the <meta> generator tag, closing as FIXED.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links