ci: expand CI checks and make consumer sync opt-in

- Add Go, npm, Python, and Java validation to CI
- Run Go tests against PostgreSQL
- Record performance fixes in the report
This commit is contained in:
Gabriel20xx committed 2026-10-19 21:14:31 +00:00
1 parent 199a5efaef
commit 22887fef03
100 files changed
+9740 -429

No files matched your search

+25 -1
View File
@@ -11,8 +11,11 @@
package coreconfig
import (
"crypto/subtle"
"encoding/json"
"errors"
"net/http"
"net/url"
"strings"
"sync"
)
@@ -179,7 +182,7 @@ func normalizeInfo(info Info) Info {
// own internal-auth-gated routes use).
func Handler(secret string, store *Store) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if secret == "" || r.Header.Get("X-Internal-Auth") != secret {
if secret == "" || subtle.ConstantTimeCompare([]byte(r.Header.Get("X-Internal-Auth")), []byte(secret)) != 1 {
writeError(w, http.StatusUnauthorized, "internal service authentication required")
return
}
@@ -188,6 +191,10 @@ func Handler(secret string, store *Store) http.HandlerFunc {
writeError(w, http.StatusBadRequest, "invalid JSON body")
return
}
if err := validateServiceURLs(input); err != nil {
writeError(w, http.StatusBadRequest, err.Error())
return
}
store.Set(input)
// Do not echo service credentials to the caller. The push is authenticated, but
// these credentials are needed only by the recipient.
@@ -198,6 +205,23 @@ func Handler(secret string, store *Store) http.HandlerFunc {
}
}
// validateServiceURLs refuses a pushed URL that is not an http or https URL with a host, so a push
// cannot point this service's clients at another scheme or at an empty host.
func validateServiceURLs(info Info) error {
urls := append([]string{info.AuthGuardURL, info.ComfyUIURL, info.ProjectConfiguratorURL, info.ContentScannerURL, info.CarrierNodeURL}, info.CarrierNodeURLs...)
for _, raw := range urls {
value := strings.TrimSpace(raw)
if value == "" {
continue
}
parsed, err := url.Parse(value)
if err != nil || (parsed.Scheme != "http" && parsed.Scheme != "https") || parsed.Host == "" {
return errors.New("core service URL must be an http or https URL with a host")
}
}
return nil
}
func writeJSON(w http.ResponseWriter, status int, value any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(status)