Should we handle { x-frame-options: SAMEORIGIN }
header ?
#606
Replies: 3 comments 2 replies
-
Also we can just change in this.webviewRef.current.addEventListener(
'did-fail-load',
- ({errorCode, errorDescription}) => {
+ ({errorCode, errorDescription, isMainFrame}) => {
- if (errorCode === -3) {
+ if (!isMainFrame || errorCode === -3) {
// Aborted error, can be ignored
return;
}
this.setState({
errorCode,
errorDesc: errorDescription,
});
}
); or even this.webviewRef.current.addEventListener(
'did-fail-load',
- ({errorCode, errorDescription}) => {
+ ({errorCode, errorDescription, isMainFrame}) => {
- if (errorCode === -3) {
+ if (errorCode === -3 || (!isMainFrame && errorCode === -27)) {
// Aborted error, can be ignored
return;
}
this.setState({
errorCode,
errorDesc: errorDescription,
});
}
); |
Beta Was this translation helpful? Give feedback.
-
@jjavierdguezas I think we shouldn't allow this, that will be a real security hole. I think this cannot be compared to Disabling SSL validation puts the accessing user at vulnerability and so if the user voluntarily accepts it then it is fine. I think this is more against the web standards and will open possibilities for phishing-type attacks using Responsively. |
Beta Was this translation helpful? Give feedback.
-
Yeah @jjavierdguezas, your solution in #606 (comment) sounds good. But will be good if it is possible to show some message inside the iframe box. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I found and interesting scenario related to
<iframe/>
tag and the{'x-frame-options', 'SAMEORIGIN'}
header.First, when that header is set, the resource can't be loaded in an
iframe
outside of its domain. So thisiframe
is not able to display cross domain.The easiest way I tested this was using vscode live server and express.js:
index.js
file with express server:and the
index.html
file for Live Serverif we run
node index.js
and openindex.html
file with live server, on chrome we see this:but if we open
index.html
served by Live Server in Responsively we get an errorShould we take this in consideration for responsively?
If so, an easy solution found in electron/electron#426 (comment) that works well is to put the following in
main.dev
:that intercepts requests and remove the
x-frame-options
header. That way the<iframe>
loads just fine.We could also make this a configuration like the
Disable SSL Validation
one and let the user decide this behavior.It would be nice also, if we can display an image like chrome if the
iframe
can't be loaded instead of displaying a top-level error. That way we render the rest of the page and honor the website "wishes", but maybe that is more difficult and unnecessaryWhat do you think @manojVivek
Beta Was this translation helpful? Give feedback.
All reactions