- Every playbook ran with ANSIBLE_HOST_KEY_CHECKING=False, so anyone in the middle could pose as the server and be handed the sudo password and every secret in vars.yml. Ansible's ssh now uses StrictHostKeyChecking=accept-new, like interzone's own ssh calls: a new server is trusted on first sight, a changed key stops the run. - The ssh connection-sharing folder in /tmp is only used when it's this user's own and closed to others; someone else could have made it first and planted a socket. - Registering a user passed the password in --extra-vars, readable with ps. It goes through a 0600 vars file, like the other admin actions. - The restore source and backup destination are passed as JSON, so a path with a space no longer breaks them. - The update preview's git fetch puts "--" before the URL, as every other git call does. - A domain's backup list no longer includes dumps of another domain that starts with the same name and a dash (a.org vs a.org-b.net). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
664 B
Go
26 lines
664 B
Go
package deploy
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestListBackupsKeepsDomainsApart(t *testing.T) {
|
|
t.Setenv("XDG_DATA_HOME", t.TempDir())
|
|
if err := os.MkdirAll(BackupDir(), 0o700); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, n := range []string{"a.org-2026-01-02-0304.sql.gz", "a.org-b.net-2026-01-02-0304.sql.gz"} {
|
|
if err := os.WriteFile(filepath.Join(BackupDir(), n), nil, 0o600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
if l := ListBackups("a.org"); len(l) != 1 || filepath.Base(l[0].Path) != "a.org-2026-01-02-0304.sql.gz" {
|
|
t.Errorf("a.org: %+v", l)
|
|
}
|
|
if l := ListBackups("a.org-b.net"); len(l) != 1 {
|
|
t.Errorf("a.org-b.net: %+v", l)
|
|
}
|
|
}
|