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
{{ message }}
Repository navigation
Refuse in-root symlinks for auth files opened through os.Root #257
readAuth (reviewer/auth_profile_unix.go:174) opens auth files (state.json, lease.json, …) with root.OpenFile(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK, 0) on an *os.Root. With Go 1.26, os.Root.OpenFile follows a symlink whose target stays inside the root even when O_NOFOLLOW is set; only a plain os.OpenFile refuses it (ELOOP). The following privateAuthFile check then judges the symlink's target, so the documented "no symlink" rule for the private auth directory is not enforced. Production has 55 OpenFile(... O_NOFOLLOW ...) call sites; those on an *os.Root may share this gap.
Evidence
Reproduced on mini with go1.26.7: in a fresh directory, state.json -> real.json; os.OpenRoot(dir).OpenFile("state.json", O_RDONLY|O_NOFOLLOW, 0) returns the file with no error, while os.OpenFile(dir+"/state.json", O_RDONLY|O_NOFOLLOW, 0) fails with "too many levels of symbolic links". Observed first by the E2E qualification work for #250.
Impact
Low: creating such a link already requires write access to the private 0700 auth directory. It is a hardening gap where the code's stated invariant is silently not enforced.
Acceptance criteria
Opening an auth file that is a symlink (in-root or escaping) is refused, for every auth file the store reads or writes.
The other *os.Root + O_NOFOLLOW call sites are audited, and each either refuses symlinks or documents why following an in-root link is acceptable.
Tests create an in-root symlink for each audited path and require refusal.
Validation
go -C reviewer test -race -run 'Auth' . and the full race suite.
Activity
Parse production sources in the os.Root guard and correct the refusal…
Refuse in-root symlinks at every os.Root O_NOFOLLOW open (#265)