![]() |
#16 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
It was set that way for "safety sake" but the user can disable all javascript if they so desire, so I would not ifdef it at all. Just straight change it to what Qt 5.15 needs and all other versions can live with it.
Thanks! Kevin |
![]() |
![]() |
![]() |
#17 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,587
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I've got a fix/refactor for my darkmode woes RE 5.15 as well, but that can wait a bit. it's cosmetic-only. |
|
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
BTW, this is a bug in Qt 5.15 added when they they adapted their code to a new chromium version. (It is in their adaption to Chromium 78). The original code only disabled access via the file url scheme (file:///) from within a web page but somehow NOW all local urls are now being translated to be equivalent to file: /// url schemes even if they do NOT explicitly use that url scheme.
So their bug fix changed/broke the meaning of the setting we used. So please do make this change permanent to prevent this nonsense. |
![]() |
![]() |
![]() |
#19 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
I used github "blame" on the qwebengine file in question and even though the change that is causing us issues has been in place for over 5 months, it was never included in any of the Qt 5.13.x, or 5.14.x releases.
Why on earth would you wait to release a change like this into a "LTS" release and never put it in any of the earlier dev series releases? It is almost like Qt wants to break things with this type of strategy. Or possibly it wants to hold out on "fixes" to so they are only available to commercial LTS customers first (or not at all!). See https://github.com/qt/qtwebengine/bl...t_qt.cpp#L1147 And then check the 5.13, and 5.14 branches and see that these changes are not in them at all. Last edited by KevinH; 06-05-2020 at 09:55 PM. |
![]() |
![]() |
![]() |
#20 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Just FYI turning that setting off means any book can now exfiltrate any of your user's data, as long as javascript is enabled. The correct way to fix this, is to define a custom URL scheme and use QWebEngineurlSchemeHandler to map it to local files in a secure manner. grep the calibre source code for QWebEngineUrlSchemeHandler for examples.
|
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Thanks for the tip, I will check it out. As you said, that attack mode would require the user to enable javascript which is under the user's control and have a malicious epub as well.
|
![]() |
![]() |
![]() |
#22 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Just checked it out. If I am following it correctly.
For a xhtml file locally loaded (no network access at all) to open its own co-located resources (images, css, etc) (again no network access) we would now have to now create our own fake scheme "sigl" and remap those local requests to our fake url scheme just to get them to be allowed, but only for Qt 5.15 and just to screen out file:/// url schemes. Basically we are recreating our own webengine setting that prevented this in the first place because they broke something yet again. That is absurd. |
![]() |
![]() |
![]() |
#23 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Perhaps, it would be easier to set it to its default of true and then screen out any local file access in AcceptNavigationRequest that is outside the target epub.
I really do not want to have to register my own url schemes just to filter out file:/// scheme urls from within a evil epub. I will see if that is a workable approach. If not, we will have to go with our own custom Scheme handler as calibre does. Last edited by KevinH; 06-06-2020 at 10:20 AM. |
![]() |
![]() |
![]() |
#24 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The idea is you dont laod any files locally. Even the base HTML file you load via the custom scheme. Then all resources in the file are automatically also loaded via the custom scheme. And JS running from the custom scheme is not allowed access to local files anyway, without even needing the setting. All in all, its about a 100 lines of code. Remember to register your scheme as "trusted" with Qt so that it has the smae semantics as a page loaded over https and it can use html features gated behind https.
|
![]() |
![]() |
![]() |
#25 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
We set the Local Storage preference setting to true so that javascript can store values it might want to cache before cleaning it up on close. Would I need to do something similar to allow that as well?
|
![]() |
![]() |
![]() |
#26 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
And what is to keep the evil epub developer from simply using a "sigl" or calibre's FAKE_PROTOCOL scheme url to do what they want. Isn't this just moving the problem? It would be quite easy for a javascript to to get the current page url, find the newly trusted protocol/scheme and create a url using it, wouldn't it?
Last edited by KevinH; 06-06-2020 at 01:20 PM. |
![]() |
![]() |
![]() |
#27 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Unless I am missing how using our own trusted protocol actually helps instead of moving the problem, perhaps it would be better to instead intercept it in acceptNavigationRequest and reject any file:/// url that is outside the bounds of the ebook folder. Javascript generated target links do pass through there and can be stopped at that point.
|
![]() |
![]() |
![]() |
#28 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,789
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Either way we would have to allow our local file:/// mathjax url, and local user css urls to be passed through.
|
![]() |
![]() |
![]() |
#29 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
![]() |
![]() |
![]() |
#30 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle PW3 5.9.6.1 ssh broken pipe leaves broken ssh | xception | Kindle Developer's Corner | 8 | 01-27-2019 10:23 AM |
Broken PRS-505; any place to buy chrome bottom piece? Or anyone with broken 505? | erikk | Sony Reader | 1 | 12-09-2009 06:51 PM |
Broken Ipod works Fine! except that its broken | Andybaby | Lounge | 1 | 06-04-2009 02:03 AM |
Broken | jeffoest | Sony Reader | 57 | 12-11-2007 03:15 PM |
is it broken ? | markiehill | Sony Reader | 5 | 02-15-2007 08:53 AM |