Skip to content

Content-security-policy bug #560

Description

@blukis

Bug Report

Child iframe in remotely-hosted iframe within cordova app doesn't load, despite appropriate Content-Security-Policy http header in child iframe.
Bug reproduction repository here: https://github.com/blukis/bugdemo-cordova-android-issue-560/

Problem

Child iframe in remotely-hosted iframe within cordova app doesn't load, despite Content-Security-Policy http header in child iframe.

What is expected to happen?

Inner-iframe (iframe border colored blue) is expected to load.

What does actually happen?

Inner-iframe (iframe border colored blue) doesn't load, and appears blank.

Information

Chrome debug console reports...

Refused to display 'http://201x.plurib.us/test/2018/content-security-inner.php' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors *"

Command or Code

Build the app (I'm using PhoneGap build, because cordova-proper is beyond my expertise). Bug manifests on initial state of the app when it's run.

Environment, Platform, Device

Android

Version information

Phonegap build, using cli-9.0.0

Checklist

  • I searched for existing GitHub issues
  • [?] I updated all Cordova tooling to most recent version
  • I included all the necessary information above

--------

Original post...

I believe I found an issue with content-security-policy in cordova environment...

I have an app that includes this page in an iframe: "http://201x.plurib.us/test/2018/content-security-outer.html", which in turn includes this page in another iframe "http://201x.plurib.us/test/2018/content-security-inner.php". (Note: these are very short pages created to debug this issue. The original page causing the issue was a shopify checkout page, found in the comments of "...outer.html".)

"...inner.php" includes this http header:
Content-Security-Policy: frame-ancestors *

"...outer.html" (and its inner iframe) loads OK in Chrome on Android, but when included the url in a cordova app, "...inner.php" iframe does not load. (Note: app has "cordova-plugin-whitelist" plugin and <access origin="*" />).

When I enable android debugging and check the remote device console in Chrome, I see this error in the Chrome console:

Refused to display 'http://201x.plurib.us/test/2018/content-security-inner.php' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors *".

Maybe I'm missing something, but I'm not sure how anything could fail to pass "frame-ancestors *". Is it a cordova issue? Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions