mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibWeb: Reject iframing file:// URLs if document is not a file:// URL
This commit is contained in:
parent
8928607455
commit
a950d3dd5f
Notes:
sideshowbarker
2024-07-19 01:31:57 +09:00
Author: https://github.com/bcoles
Commit: a950d3dd5f
Pull-request: https://github.com/SerenityOS/serenity/pull/3978
1 changed files with 6 additions and 2 deletions
|
@ -74,13 +74,17 @@ void HTMLIFrameElement::document_will_detach_from_frame(Frame&)
|
|||
|
||||
void HTMLIFrameElement::load_src(const String& value)
|
||||
{
|
||||
dbg() << "Loading iframe document from " << value;
|
||||
auto url = document().complete_url(value);
|
||||
if (!url.is_valid()) {
|
||||
dbg() << "Actually no I'm not, because the URL is not valid :(";
|
||||
dbg() << "iframe failed to load URL: Invalid URL: " << value;
|
||||
return;
|
||||
}
|
||||
if (url.protocol() == "file" && content_origin().protocol() != "file") {
|
||||
dbg() << "iframe failed to load URL: Security violation: " << document().url() << " may not load " << value;
|
||||
return;
|
||||
}
|
||||
|
||||
dbg() << "Loading iframe document from " << value;
|
||||
m_content_frame->loader().load(url, FrameLoader::Type::IFrame);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue