]> ruderich.org/simon Gitweb - safcm/safcm.git/commit
remote: guard against symlinks in earlier path components
authorSimon Ruderich <simon@ruderich.org>
Tue, 1 Jun 2021 05:59:59 +0000 (07:59 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 1 Jun 2021 05:59:59 +0000 (07:59 +0200)
commit2804606f9f8dc5078c38580bac363b47eb638620
tree13d4c07adcbbb93ca3569fa9d15804f75e825896
parenta950980d2e302547743fb567d0636b766f4e9704
remote: guard against symlinks in earlier path components

This was only an issue when syncing files to directories where other
users have write access to the parent directory. For example when
copying files to /home/user/.ssh/authorized_keys the user could replace
.ssh with a symlink which permitted overwriting authorized_keys anywhere
on the system.

Fix possible attacks by using *at syscalls and disallowing symlinks in
all path components except for the last of synced paths. Syncing
symlinks is obviously still permitted.
cmd/safcm/fixperms.go
remote/ainsl/ainsl.go
remote/ainsl/ainsl_test.go
remote/sync/files.go
remote/sync/files_compat.go [new file with mode: 0644]
remote/sync/files_compat_openbsd.go [new file with mode: 0644]
remote/sync/files_test.go
remote/sync/files_windows.go