]> ruderich.org/simon Gitweb - safcm/safcm.git/commit
remote: use better approach to upload remote helper
authorSimon Ruderich <simon@ruderich.org>
Sat, 25 Oct 2025 10:22:40 +0000 (12:22 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 26 Oct 2025 07:26:32 +0000 (08:26 +0100)
commit63a6a1c1305de5bd541fc74fd9d3c443bb837525
tree1b67a79d8188c1fd0fe29f2da399dc9c04877309
parentd53b5f120fdbe793a6f2e2ca498ebb0763703bbf
remote: use better approach to upload remote helper

This change also prevents a race condition when the remote helper is run
concurrently. An attacker could use the small window when the old helper
gets removed to create a file which is then executed by the concurrent
run.

A few other approaches were considered. The main issue is the
uncertainty in the behavior of command line tools like `mv`. The system
calls have well defined behavior but it's not clear how exactly the
tools are implemented. The goal was to find an approach which is secure
even under these circumstances without having to validate them across
multiple operating systems.
README.adoc
cmd/safcm/main_sync_test.go
rpc/dial.go