Move from X-Frame-Options to Content-Security-Policy

Bug #1677068 reported by Robert Lyon
This bug report is a duplicate of:  Edit Remove
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
High
Unassigned

Bug Description

Currently one cannot embed Mahara within an iframe on third party site

This is due to:
X-Frame-Options = SAMEORIGIN
(see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options)

And we can't allow specific external sites to embed mahara in an iframe (well at least not for all major browsers)

But good news there is: Content-Security-Policy
(see: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)

Where we can specify which domains are allowed to show which things

But bad news - to get it to work we'd need to do bad things in relation to inline javascript
(see: https://www.html5rocks.com/en/tutorials/security/content-security-policy/)

Also we'd need to detect that we are in an external iframe before the page loads so we can set the headers to allow the correct external site (via init.php)

Currently we set the headers after $session starts and before we enable the $USER object
So we'd need to add something to detect that we are in an iframe on an external site and that site is allowed to do this.

NOTE: some of our pages load in iframes themselves (via pieform submission)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: none → 17.10.0
importance: Undecided → High
Changed in mahara:
status: New → Confirmed
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 18.04.0 → 18.10.0
Changed in mahara:
assignee: nobody → Cecilia Vela Gurovic (ceciliavg)
Changed in mahara:
assignee: Cecilia Vela Gurovic (ceciliavg) → nobody
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

We'll need to map out what we can do since we have user generated content. Mahara already has a site config option to disallow external content. This should probably be wrapped into the CSP.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.
  • Duplicate of a private bug Remove

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.