You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Root may be used to only access files within a single directory tree.
Methods on Root can only access files and directories beneath a root directory. If any component of a file name passed to a method of Root references a location outside the root, the method returns an error.
It would be nice for gosec to suggest using os.Root and its methods over the direct os equivalents (e.g. os.Root.Open over os.Open) when appropriate:
Go version (either 1.24 or 1.25 depending on required methods)
os.Root is an upcoming type in Go 1.24 aimed at solving directory traversal. (upstream proposal). Note: some methods won't be released until Go 1.25.
It would be nice for
gosec
to suggest usingos.Root
and its methods over the directos
equivalents (e.g.os.Root.Open
overos.Open
) when appropriate:This could also be considered when evaluating / remediating
G305: File traversal when extracting zip/tar archive
The text was updated successfully, but these errors were encountered: