fix(auth): harden interactive diagnostic lifecycle

This commit is contained in:
2026-08-17 17:57:10 +02:00
parent ef244ab56d
commit af16464e68
9 changed files with 576 additions and 59 deletions
@@ -0,0 +1,28 @@
package compose
import (
"os"
"strings"
"testing"
)
func TestWindowsTerminationUsesBoundedExactPIDTreeKillWithoutAShell(t *testing.T) {
source, err := os.ReadFile("process_windows.go")
if err != nil {
t.Fatal(err)
}
text := string(source)
for _, required := range []string{
"context.WithTimeout", "exec.CommandContext", `"taskkill.exe"`, `"/PID"`,
"strconv.Itoa", `"/T"`, `"/F"`, "io.Discard", "ErrProcessReap",
} {
if !strings.Contains(text, required) {
t.Errorf("process_windows.go is missing %q", required)
}
}
for _, forbidden := range []string{"cmd.exe", "powershell", `exec.Command("taskkill.exe"`} {
if strings.Contains(strings.ToLower(text), strings.ToLower(forbidden)) {
t.Errorf("process_windows.go contains unsafe command form %q", forbidden)
}
}
}