[draft]: Migrate filesystem to os.Root to mitigate TOCTOU filesystem attacks and remove need for own maintained code#306
Open
DaneEveritt wants to merge 30 commits intodevelopfrom
Open
[draft]: Migrate filesystem to os.Root to mitigate TOCTOU filesystem attacks and remove need for own maintained code#306DaneEveritt wants to merge 30 commits intodevelopfrom
os.Root to mitigate TOCTOU filesystem attacks and remove need for own maintained code#306DaneEveritt wants to merge 30 commits intodevelopfrom
Conversation
Co-Authored-By: Matthew Penner <[email protected]>
DaneEveritt
commented
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
This PR is open for review and will remain so for a little bit to allow others to browse through the code and try to break things. If you test this PR and come across issues, please leave review feedback.
This is a significant change to the filesystem handling code and there was a lot of work that went into it. Things are guaranteed to break in unexpected ways. Please try to break it.
https://go.dev/blog/osroot
This PR seeks to address long-standing maintenance burdens by shifting from home-rolled filesystem logic to logic maintained, tested, and reviewed by the official Go library. Rather than home rolling the filesystem and copying a lot of internal code this PR seeks to replace almost all usage with calls through
os.Rootwhich drastically simplifies the library and dramatically reduces the surface area of code we need to understand and maintain.I took a rather brute force approach to this, fully reverting back to the original filesystem implementation and trying to parse through the changes while doing that. There are some inherent bug fixes that got lost while doing this. I am still working through reviewing everything to make sure any fixes are properly re-captured in this work.