Page MenuHomePhabricator

non consistent X-Frame-Options
Closed, InvalidPublic

Description

The X-Frame-Options header delivered by Mediawiki (at least in Wikimedia servers) for same-origin request isn't consistent: sometimes allowing frames and sometimes deny, in unpredicted pattern.

I couldn't reproduce it in enwiki, but in hewiki I did, but only as a registered user (as anonymous user it isn't reproducible). As far as I tested it may be related to users right (my wgUserGroup is [bureaucrat,sysop,user, autoconfirmed] in hewiki, and [user, autoconfirmed] in enwiki).

How do I test it:

  1. get to some hewiki page (we don't want to do cross origin requests)
  2. peek some of diff from recent changes (it should be latest edit [that can be rolled back] or diff that hasn't been patrolled yet)
  3. add iframe to it $('ul:first').append($('<iframe src="DIFF" width="50" height="50"></iframe>')) - it fails (X-Frame-Options DENY)
  4. peek some non latest diff [that isn't possible to rollback]
  5. do the same - it successes (no X-Frame deny)

(Step3 always fails as registered, but success as anonymous)
I think it should be possible to reproduce the bug under different wikis if you have sufficient rights.

Specific example for DIFFs:

  1. non latest edit - http://he.wikipedia.org/w/index.php?title=%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%91%D7%A7%D7%A9%D7%95%D7%AA_%D7%9E%D7%9E%D7%A4%D7%A2%D7%99%D7%9C%D7%99%D7%9D&diff=13937468&oldid=13937455
  2. latest edit - http://he.wikipedia.org/w/index.php?title=%D7%A8%D7%A4%D7%90%D7%9C_%D7%93%D7%9C_%D7%A8%D7%99%D7%92%D7%95&diff=13938631&oldid=13731530

I don't see a reason why same origin requests don't allow frames, but if there is some reason to do so - it should be consistent.


Version: 1.21.x
Severity: normal

Details

Reference
bz46560

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:19 AM
bzimport set Reference to bz46560.
bzimport added a subscriber: Unknown Object (MLST).
eranroz created this task.Mar 26 2013, 11:04 AM
Nikki added a subscriber: Nikki.Sep 26 2015, 6:31 PM

I've been seeing something similar on enwiki while using https://tools.wmflabs.org/wikidata-todo/duplicity.php
The tool displays a Wikipedia article in an iframe on the left. Most of the time it works fine, but every so often, the iframe is blank. When the iframe is blank, there is an error in the browser's error console: Refused to display '(url here)' in a frame because it set 'X-Frame-Options' to 'DENY'.
It doesn't seem to happen if I'm not logged in.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 26 2015, 6:31 PM

Its related to whether a page is "click-jackable". For ordinary articles, usually that means if there is a "patrol" link on the page.

Bawolff closed this task as Invalid.Nov 8 2018, 8:44 AM

I don't think this is a bug. This behaviour is configurable in LocalSettings.php by setting $wgBreakFrames = true;

Some might argue we should change the config either in wikimedia, or the default for mediawiki, but that should be a separate bug I think.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptNov 8 2018, 8:44 AM