mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-06 04:34:08 +01:00
* Absicherung: Tests auf Windows/macOS, govulncheck, Dependabot, Fuzz-Tests, Signatur-Anleitung - CI: Job platforms (windows-latest, macos-latest), vuln (govulncheck), fuzz (15 s je Ziel) - Go immer neuester 1.26-Patch (check-latest) statt fest 1.26.0 - Dependabot für Go-Module und Actions (wöchentlich, gruppiert) - Fuzz-Tests: Terminal-Emulator, Bildsequenzen, Telnet, PPK, LLDP/ARP/MAC, Import, Host-Übersicht, trzsz-Dateinamen - PPK: Argon2-Werte aus der Datei begrenzt (1 GiB, 1000 Durchläufe) - release.yml: Warnung bei unsigniertem Release, Abbruch bei Public Key ohne Secret - docs/signatur.md, make fuzz / make vuln Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Signatur-Anleitung: keygen im Repository-Ordner ausführen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Host-Übersicht macOS: Laufzeit aus kern.boottime richtig lesen (sed nahm usec statt sec) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Import ssh_config: Include nur normale Dateien bis 1 MiB, höchstens 64 (Fuzz-Fund: Import hing) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Windows: Switch-Auflegen auch bei WSAECONNRESET erkennen, Latenz nie 0; Tests plattformfest - isHangup: WSAECONNRESET/WSAECONNABORTED per Fehlercode (deutscher Windows-Text half der Textsuche nicht) - Keepalive-Latenz mindestens 1 ns (Windows-Uhr gröber als localhost-Rundreise) - Tests: USERPROFILE neben HOME, Unix-Rechte nur außerhalb Windows prüfen, Server-Skript-Test nicht unter Git-Bash, Windows-Pfad mit Laufwerk Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Sixel: Zahlen deckeln (Fuzz-Fund: überlaufende Wiederholung hielt das Terminal Sekunden bis endlos fest) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz * Eigenes Fenster (Windows): Named Pipe mit Puffer, Schreiben blockiert nicht mehr bis zum Lesen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUifSEzjZLFvqVjcUxz --------- Co-authored-by: Claude <noreply@anthropic.com>
53 lines
1.7 KiB
Go
53 lines
1.7 KiB
Go
package domain
|
|
|
|
import (
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func TestPortableKeyPath(t *testing.T) {
|
|
home := filepath.Join(string(filepath.Separator)+"home", "dom")
|
|
if runtime.GOOS == "windows" {
|
|
home = `C:\Users\dom` // ohne Laufwerk ist ein Pfad unter Windows nicht absolut
|
|
}
|
|
in := filepath.Join(home, ".ssh", "id_ed25519")
|
|
if got := PortableKeyPath(in, home); got != "~/.ssh/id_ed25519" {
|
|
t.Fatalf("PortableKeyPath = %q", got)
|
|
}
|
|
other := filepath.Join(string(filepath.Separator)+"opt", "keys", "k")
|
|
if got := PortableKeyPath(other, home); got != other {
|
|
t.Fatalf("fremder Pfad geändert: %q", got)
|
|
}
|
|
if got := PortableKeyPath(home+"x/k", home); got != home+"x/k" {
|
|
t.Fatalf("Präfix ohne Trenner: %q", got)
|
|
}
|
|
if got := ExpandKeyPath("~/.ssh/id", home); got != filepath.Join(home, ".ssh", "id") {
|
|
t.Fatalf("ExpandKeyPath = %q", got)
|
|
}
|
|
}
|
|
|
|
func TestKeyPathCandidatesForeignHome(t *testing.T) {
|
|
home := filepath.Join(string(filepath.Separator)+"Users", "dom")
|
|
cases := map[string][]string{
|
|
`C:\Users\db9\.ssh\id_ed25519`: {`C:\Users\db9\.ssh\id_ed25519`, filepath.Join(home, ".ssh", "id_ed25519")},
|
|
`C:\Users\db9\AppData\Local\NVIDIA Corporation\Sync\config\nvsync.key`: {
|
|
`C:\Users\db9\AppData\Local\NVIDIA Corporation\Sync\config\nvsync.key`,
|
|
filepath.Join(home, "AppData", "Local", "NVIDIA Corporation", "Sync", "config", "nvsync.key"),
|
|
filepath.Join(home, ".ssh", "nvsync.key"),
|
|
},
|
|
"/home/x/keys/k": {"/home/x/keys/k", filepath.Join(home, "keys", "k"), filepath.Join(home, ".ssh", "k")},
|
|
}
|
|
for in, want := range cases {
|
|
got := KeyPathCandidates(in, home)
|
|
if len(got) != len(want) {
|
|
t.Fatalf("%s: %q", in, got)
|
|
}
|
|
for i := range want {
|
|
if got[i] != want[i] {
|
|
t.Fatalf("%s: %q, erwartet %q", in, got, want)
|
|
}
|
|
}
|
|
}
|
|
}
|