Page MenuHomePhabricator

Invalid titles can be saved as sitelinks
Closed, ResolvedPublic

Description

It is possible to save invalid titles as sitelink targets. While saving non-existing but valid titles (like "blablablablabla") causes an errors, the following can be saved, even though the target page does not (and can not!) exist:

"<>", e.g. http://wikidata-test-repo.wikimedia.de/w/index.php?title=Q321&diff=prev&oldid=34182

"[]", e.g. http://wikidata-test-repo.wikimedia.de/w/index.php?title=Q321&diff=next&oldid=34182

Even stranger, trying to save "|" results in an empty string as the target title, but does not remove the sitelink: http://wikidata-test-repo.wikimedia.de/w/index.php?title=Q321&diff=next&oldid=34183

Note that some illegal titles, like "#", did get rejected with an error.

Another strange instance of this behavior appears to be this edit: http://wikidata-test-repo.wikimedia.de/w/index.php?title=Q321&curid=9133&diff=34123&oldid=34101

Here, a fill URL was used as the target page title.


Version: unspecified
Severity: major

Details

Reference
bz40652

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:52 AM
bzimport set Reference to bz40652.
bzimport added a subscriber: Unknown Object (MLST).

Seems like the "missing" key is not checked or is not generated in these cases.

A fix for this should probably be backported to the beta branch.

In addition to "missing" the marker for "invalid" should be checked and also generate a failed lookup.

http://localhost/repo/api.php?action=query&prop=info&redirects=1&converttitles=1&format=jsonfm&titles=badbadbad
{
"query": {

		"normalized": [
			{
				"from": "badbadbad",
				"to": "Badbadbad"
			}
		],
		"pages": {
			"-1": {
				"ns": 0,
				"title": "Badbadbad",
				"missing": ""
			}
		}

},

http://localhost/repo/api.php?action=query&prop=info&redirects=1&converttitles=1&format=jsonfm&titles=%3C%3E
{
"query": {

		"pages": {
			"-1": {
				"title": "<>",
				"invalid": ""
			}
		}

},

Change I86d432e8: Reject invalid titles as sitelinks