Implement file handling in terms of io.FS and os.Root
Eschewed features
- This issue is not requesting templating, unstuctured edits, build-time side-effects from args or env vars, or any other eschewed feature.
What would you like to have added?
Go 1.24 added its own filesystem re-rooting capability with os.Root.
While this was primarily intended as an anti-traversal mechanism, the API essentially allows for designating any arbitrary folder as a new filesystem root... including things like temp directories. This, in combination with (readonly capabilities of) io.FS, allows for a more standardized way to interact with the filesystem.
It would be great to migrate all file handling to use these packages/interfaces.
Why is this needed?
Use of io.FS and os.Root would allow for easier integration with downstream consumers and libraries.
Additionally, it could eventually eliminate a large maintenance burden in a critical security area, by delegating traversal prevention to the standard library.
Can you accomplish the motivating task without this feature, and if so, how?
While it's generally possible to implement a wrapper to go from kyaml.filesys -> io.FS (given the opposite may be the best migration/re-implementation path), this would be large surface area for each consumer to implement. Alternatively, consumers are forced to rely on navigating through the underlying physical filesystem instead of a common interfacing type.
What other solutions have you considered?
N/A.
Anything else we should know?
No response
Feature ownership
- I am interested in contributing this feature myself!
Source: kubernetes-sigs/kustomize