Fix bugs found in full security and stability audit.

Harden artifact paths and fusion uploads, repair pool reconnect and login ID tracking, fix agent/fusion/frontend regressions, and refresh PROBLEMS.md with the full findings list.
This commit is contained in:
drjones
2026-05-29 09:57:22 -07:00
parent e11fb30350
commit f9e26bb1a6
13 changed files with 281 additions and 82 deletions

View File

@@ -475,20 +475,28 @@ func (a *AIRunner) isProcessRunning(name string) bool {
if name == "" {
return false
}
// Use tasklist on Windows to check if process is running
cmd := exec.Command("tasklist", "/FI", fmt.Sprintf("IMAGENAME eq %s", name))
imName := name
if !strings.HasSuffix(strings.ToLower(imName), ".exe") {
imName += ".exe"
}
cmd := exec.Command("tasklist", "/FI", fmt.Sprintf("IMAGENAME eq %s", imName))
output, err := cmd.Output()
if err != nil {
return false
}
return strings.Contains(string(output), name)
return strings.Contains(string(output), imName)
}
func (a *AIRunner) restartMiner(processName string) (string, error) {
log.Printf("[AI] Restarting miner: %s", processName)
imName := processName
if !strings.HasSuffix(strings.ToLower(imName), ".exe") {
imName += ".exe"
}
// Kill existing process
killCmd := exec.Command("taskkill", "/F", "/IM", processName)
killCmd := exec.Command("taskkill", "/F", "/IM", imName)
killOutput, _ := killCmd.CombinedOutput()
// Start new process from install directory
@@ -497,7 +505,7 @@ func (a *AIRunner) restartMiner(processName string) (string, error) {
return string(killOutput), fmt.Errorf("cannot get install directory: %w", err)
}
exePath := filepath.Join(installDir, processName)
exePath := filepath.Join(installDir, imName)
if _, err := os.Stat(exePath); os.IsNotExist(err) {
return string(killOutput), fmt.Errorf("executable not found: %s", exePath)
}
@@ -524,7 +532,7 @@ func (a *AIRunner) reinstallMiner(serverURL, buildID string) (string, error) {
exePath := filepath.Join(installDir, a.cfg.EffectiveProcessName()+".exe")
// Download the new binary
resp, err := http.Get(downloadURL)
resp, err := a.httpClient.Get(downloadURL)
if err != nil {
return "", fmt.Errorf("download failed: %w", err)
}