mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-30 21:01:00 +00:00 
			
		
		
		
	LibWeb: Make frames nesting-aware and disallow deep nesting
A Frame now knows about its nesting-level. The FrameLoader checks whether the recursion level of the current frame allows it to be displayed and if not doesn't even load the requested resource. The nesting-check is done on a per-URL-basis, so there can be many many nested Frames as long as they have different URLs. If there are however Frames with the same URL nested inside each other we only allow this to happen 3 times. This mitigates infinetely recursing <iframe>s in an HTML-document crashing the browser with an OOM.
This commit is contained in:
		
							parent
							
								
									9e49895bbf
								
							
						
					
					
						commit
						1b6824d296
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-18 18:34:28 +09:00 
				
			
			Author: https://github.com/TobyAsE
Commit: 1b6824d296
Pull-request: https://github.com/SerenityOS/serenity/pull/6485
Issue: https://github.com/SerenityOS/serenity/issues/6449
Reviewed-by: https://github.com/awesomekling
			
					 4 changed files with 27 additions and 1 deletions
				
			
		|  | @ -26,8 +26,11 @@ void FrameHostElement::inserted() | |||
|     HTMLElement::inserted(); | ||||
|     if (!is_connected()) | ||||
|         return; | ||||
|     if (auto* frame = document().frame()) | ||||
|     if (auto* frame = document().frame()) { | ||||
|         m_content_frame = Frame::create_subframe(*this, frame->main_frame()); | ||||
|         m_content_frame->set_frame_nesting_levels(frame->frame_nesting_levels()); | ||||
|         m_content_frame->register_frame_nesting(document().url()); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| Origin FrameHostElement::content_origin() const | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tobias Christiansen
						Tobias Christiansen