fix(core): correctness and robustness fixes across all subsystems

- Move status page template to package-level template.Must (panic on
  parse error at init instead of nil deref at runtime)
- Fix XSS in import error responses (log detail server-side, return
  generic message to client)
- Handle ListenAndServe errors in HTTP and SSH servers
- Use defer resp.Body.Close() in all alert providers, check
  json.Marshal errors
- Share HTTP clients across checks instead of creating per-request
- Use http.NewRequestWithContext for per-site timeout control
- Support HTTP method field (was always GET despite DB storing method)
- Implement AcceptedCodes validation (was hardcoded >= 400 despite DB
  storing accepted code ranges)
- Add defer tx.Rollback() to ImportData for transaction safety
This commit is contained in:
2026-05-15 00:00:02 -04:00
parent 77fa6324f2
commit 4d5116644f
7 changed files with 218 additions and 153 deletions
+5 -1
View File
@@ -161,7 +161,11 @@ func startSSHServer(port int) {
fmt.Printf("SSH server error: %v\n", err)
return
}
go func() { s.ListenAndServe() }()
go func() {
if err := s.ListenAndServe(); err != nil {
log.Fatalf("SSH server failed: %v", err)
}
}()
}
func seedDemoData(s store.Store) {