Escrow re-auth answers in the box language; a stacks test no longer writes into its source folder
gates / gates (push) Successful in 47s

Both fixed without a row (size rule): login.msg.wrong_password for the escrow re-auth
(TestEscrowReauth_WrongPasswordInTheBoxLanguage, red-proved); cmdManager gets its own DataDir (the update
journal went into internal/stacks/, and the R-578 source walk tripped on it once).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-17 10:18:53 +02:00
parent 88aa65d595
commit 68af0e97f2
5 changed files with 29 additions and 3 deletions
@@ -76,6 +76,9 @@ func wireCmdManager(m *Manager, f *fakeSwitch) *bytes.Buffer {
func cmdManager(t *testing.T, yml string) (*Manager, *fakeSwitch, *bytes.Buffer, string) {
t.Helper()
m := gateManager(t, yml)
// The update journal lives in DataDir; empty, it was written into this package's SOURCE folder
// (update-journal.json + .tmp), where the R-578 source walk running in parallel could trip on it.
m.cfg.Paths.DataDir = t.TempDir()
f := &fakeSwitch{}
buf := wireCmdManager(m, f)
dir := closedGate(t, m)
+3 -1
View File
@@ -193,7 +193,9 @@ func (s *Server) escrowStartAPIHandler(w http.ResponseWriter, r *http.Request) {
}
if err := s.comparePassword([]byte(hash), []byte(r.FormValue("password"))); err != nil {
s.logger.Printf("[WARN] [web] escrow start: failed re-auth from %s", r.RemoteAddr)
escrowJSON(w, http.StatusUnauthorized, nil, "Hibás jelszó.")
// The login form's own sentence (same Hungarian bytes as the literal it replaces), so an English box answers in
// English. Pinned by TestEscrowReauth_WrongPasswordInTheBoxLanguage.
escrowJSON(w, http.StatusUnauthorized, nil, s.msg(r, "login.msg.wrong_password"))
return
}
s.clearAuthFailures(ip)
@@ -339,3 +339,19 @@ func TestR1112_StartConvertsTheFamilyFile(t *testing.T) {
t.Error("the log line carries the session value")
}
}
// The escrow re-auth's wrong-password answer is in the box's language (it was a Hungarian Go literal; found by the
// R-1111 helper session 2026-10-17). Red-proof: the literal back → the English case fails.
func TestEscrowReauth_WrongPasswordInTheBoxLanguage(t *testing.T) {
s := rateLimitTestServer(t)
for _, c := range []struct{ lang, want string }{{"hu", "Hibás jelszó."}, {"en", "Wrong password."}} {
r := httptest.NewRequest(http.MethodPost, "/api/escrow/start?lang="+c.lang, strings.NewReader(url.Values{"password": {"wrong"}}.Encode()))
r.Header.Set("Content-Type", "application/x-www-form-urlencoded")
r.RemoteAddr = "198.51.100.77:6000"
w := httptest.NewRecorder()
s.escrowStartAPIHandler(w, r)
if w.Code != http.StatusUnauthorized || !strings.Contains(w.Body.String(), c.want) {
t.Errorf("%s: want 401 with %q, got %d %s", c.lang, c.want, w.Code, ex(w.Body.String()))
}
}
}