]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
Update comment regarding O_NOFOLLOW
authorSimon Ruderich <simon@ruderich.org>
Tue, 29 Sep 2026 06:14:02 +0000 (08:14 +0200)
committerSimon Ruderich <simon@ruderich.org>
Wed, 4 Nov 2026 06:56:39 +0000 (07:56 +0100)
Go was bitten by this issue: CVE-2026-39822,
https://github.com/advisories/GHSA-xcgv-8mv7-v8c7

    On Unix systems, opening a file in an os.Root improperly follows
    symlinks to locations outside of the Root when the final path
    component of the a path is a symbolic link and the path ends in /.
    For example, 'root.Open("symlink/")' will open "symlink" even when
    "symlink" is a symbolic link pointing outside of the root.

remote/sync/files.go

index 4ccca5d09843c0c899bceb083c7c5892abc3382f..d45bbfee202711073f976e5f01adb1bbd2ff2e19 100644 (file)
@@ -36,7 +36,8 @@ import (
 // openReadonlyFlags are flags for open* syscalls to safely read a file or
 // directory.
 //
-// O_NOFOLLOW prevents symlink attacks in the last path component
+// O_NOFOLLOW prevents symlink attacks in the last path component (as long as
+// it doesn't end in a slash!)
 // O_NONBLOCK is necessary to prevent blocking on FIFOs
 const openReadonlyFlags = unix.O_RDONLY | unix.O_NOFOLLOW | unix.O_NONBLOCK