Skip to content

Prevent recursion attacks in EXT4Formatter.unlink#415

Open
wlan0 wants to merge 2 commits intoapple:mainfrom
wlan0:main
Open

Prevent recursion attacks in EXT4Formatter.unlink#415
wlan0 wants to merge 2 commits intoapple:mainfrom
wlan0:main

Conversation

@wlan0
Copy link
Copy Markdown
Contributor

@wlan0 wlan0 commented Nov 18, 2025

This issue doesn't affect any of our existing products. This is a preemptive fix for downstream consumers of EXT4.format where, in some platforms, leading // in the path could get resolved into a FileTree that looks like this

/ 
 └──  / 
 └── usr

@wlan0 wlan0 requested review from dcantah and jglogan November 18, 2025 05:59
@wlan0 wlan0 force-pushed the main branch 3 times, most recently from 3d2676c to 7bafb59 Compare November 18, 2025 06:19
@wlan0 wlan0 requested a review from adityaramani November 18, 2025 19:02
@dkovba dkovba self-requested a review April 6, 2026 17:00
for childPtr in pathNode.children {
try self.unlink(path: path.join(childPtr.pointee.name))
// Iterative breath-first traversal of the FileTree to prevent recursion attacks
var queue: [(parent: Ptr<FileTree.FileTreeNode>?, entry: Ptr<FileTree.FileTreeNode>)] = pathNode.children.map { (pathPtr, $0) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent need not be optional; there's no way it can be nil right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants