An authfile change made during server startup is never applied
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 83/100
Direzione di ricerca
Inizia con UserIndex.LoadUsers, loadUserIndex e addWatchEvents in share/settings/users.go. L’issue include una riproduzione deterministica della modifica persa durante l’avvio; eseguila nel package share/settings per confermare il comportamento. Il lavoro è concluso quando viene caricata una modifica effettuata tra la lettura iniziale e la configurazione del watcher e la riproduzione ha esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
UserIndex.LoadUsers (share/settings/users.go) reads the authfile
(loadUserIndex) and only then starts watching its directory (addWatchEvents). If
the file changes between the read and watcher.Add, no event is ever delivered for
that change. The server keeps the users it read at startup until the file changes
again. The 1-second reconcile ticker only compares symlink targets, so it doesn't
catch a plain rename or write.
This matters wherever the authfile and the server are managed together: a
config-management run or a Kubernetes rollout that updates the authfile while the
server is restarting leaves the server enforcing stale users and passwords,
indefinitely.
In our test, the server restarted, read the authfile at startup, and the file was
atomically replaced moments later, before LoadUsers returned. For the next
120 s the server kept refusing the new file's users and accepting the old file's.
Reproduction
A test in share/settings that runs LoadUsers's two steps with the change between
them. It fails every time:
package settings
import (
"os"
"path/filepath"
"testing"
"time"
"github.com/jpillora/chisel/share/cio"
)
func TestAuthfileChangeDuringStartupIsMissed(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "users.json")
os.WriteFile(path, []byte(`{"old:pw": [""]}`), 0644)
u := NewUserIndex(cio.NewLogger("test"))
u.configFile = path
if err := u.loadUserIndex(); err != nil { // step 1 of LoadUsers
t.Fatal(err)
}
tmp := filepath.Join(dir, "tmp")
os.WriteFile(tmp, []byte(`{"new:pw": [""]}`), 0644)
os.Rename(tmp, path) // the change lands here
if err := u.addWatchEvents(); err != nil { // step 2 of LoadUsers
t.Fatal(err)
}
time.Sleep(3 * time.Second)
if _, ok := u.Get("new"); !ok {
t.Errorf("authfile changed during startup was never applied: users still %v", u.inner)
}
}
--- FAIL: TestAuthfileChangeDuringStartupIsMissed (3.00s)
authfile changed during startup was never applied: users still map[old:0x...]
A fix: start the watch before the first read, or reload once more right after the
watch is set up.
Notes
- Found at
5ee6c74with an Antithesis test that rewrites the authfile under a running server while clients log in and open tunnels. - Related:
TASKS.md#2 (watcher misses rename/truncate updates) is fixed; this startup
window remains. GitHub #298 and #493 (both open) report authfile changes
not being picked up, without a root cause; this race is one possible cause.
- Lingua principale
- Go
- Stelle
- 16.8k
- Fork
- 1.6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jpillora/chisel
-
Rebuild and release with Go 1.27.3 to distrust compromised eMudhra intermediates (CVE-2026-111943)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Release v1.12.0-rc1Forse di nuovo libera @jpillora l’ha presa 137 giorni fa e non c’è nessuna pull request aperta. Aperta
-
Packages in Need of UpdatesAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Tutte le issue di jpillora/chisel
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
containers/gvisor-tap-vsock#796 ·
I maintainer di solito rispondono entro 2 giorni
-
external needs:triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
celestiaorg/celestia-node#5448 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsForse già presa @huanghaoyuanhhy l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zilliztech/milvus-backup#1418 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
projectdiscovery/nuclei#8423 ·
I maintainer di solito rispondono entro 1 giorno