question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NWJS Security and Cross-Origin Iframes

See original GitHub issue

NWJS Version: 31.2 (Latest) Operating System: Windows 10 , April Update

Expected behavior

According to NWJS security http://docs.nwjs.io/en/latest/For Users/Advanced/Security in NW.js/#security-in-nwjs

Node frames should bypass all ‘security restrictions’

Node frames have following extra capabilities than normal frames:

Bypass all security restrictions, such as sandboxing, same origin policy etc. For example, you can make cross origin XHR to any remote sites, or access to <iframe> element whose src points to remote sites in node frames.

Chrome (latest) disables permissions by default in iframes, making permissions explicit. Another small issue is there is no way to allow all permissions e.g. allow=“all”

This deprecation is expected to ship in Chrome M64 (around January 2018). At that time, if a cross-origin iframe attempts to use permission without the feature being explicitly allowed, a console warning will be logged and the feature will fail in a similar way as it would if a user had denied a permission prompt.

It’s proposed that by default the following permissions cannot be requested or used by content contained in cross-origin iframes:

https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes

I’m currently unsure if a node frames scope includes to disable cross origin permissions, I would think it should unless someone corrects me.

Actual behavior

Node frames cannot bypass the new Iframe security features (Cross-Origin).

How to reproduce

  1. App loads local index.html file that has an Iframe to a cross origin address. (Ensure it is a Node frame)
  2. All things are node frames, package.json "node-remote": [ "*://*/*" ],

Using this does not work <iframe src="https://webrtc.github.io/samples/src/content/devices/input-output/"></iframe>

Permissions have to be explicit despite it being a node frame <iframe src="https://webrtc.github.io/samples/src/content/devices/input-output/" allow="camera;microphone;"></iframe>

Edit:

The --disable-web-security flag does not work.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rogerwangcommented, Jun 17, 2018

You are right that the node iframe should have all the permissions by default, even it’s cross-origin. The security model in NW should override Chromium’s regarding this case. Will look to fix it.

0reactions
rogerwangcommented, Nov 10, 2018

This is fixed in git and will be available in the next nightly build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Security in NW.js - Read the Docs
For example, you can make cross origin XHR to any remote sites, or access to <iframe> element whose src points to remote sites...
Read more >
cross domain origin security in NWJS - Stack Overflow
It's not CORS. Basically, you can't get cookies from another domain by using XHR. With NWJS, you can simply use http.request/http.get to get ......
Read more >
nwjs/nw.js - Gitter
I would like to use iframe and have access to node functionality from ... and I get cross-origin security exception when i'm trying...
Read more >
NW.js v0.35.2 Released with Chromium Security Update
NW.js 0.35.2 is released with Chromium security update. It also fixed a cross origin access issue in privileged frames.
Read more >
Iframe cross-origin issue - Javascript SDK - Construct 3
And I'm also wondering how the Chromium browser of NWJS is doing it, does it have its web security tag disabled ? Thanks....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found