fix(cluster)!: rename X-Upkeep-Secret header to X-Uptop-Secret
Last upkeep-era name in the wire protocol. Breaking for mixed-version clusters, but zero installed base exists pre-v0.1.0 — free now, breaking forever after first tag.
This commit was merged in pull request #122.
This commit is contained in:
@@ -174,7 +174,7 @@ Export your Kuma backup JSON, then:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/import/kuma \
|
||||
-H "X-Upkeep-Secret: your-secret" \
|
||||
-H "X-Uptop-Secret: your-secret" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @kuma-backup.json
|
||||
```
|
||||
|
||||
+1
-1
@@ -81,5 +81,5 @@ Set via `UPTOP_AGG_STRATEGY` on the leader.
|
||||
## Security
|
||||
|
||||
- Set `UPTOP_CLUSTER_SECRET` on all nodes. Without it, cluster API endpoints are unauthenticated.
|
||||
- Secrets are sent in HTTP headers (`X-Upkeep-Secret`). Use TLS or a reverse proxy for production.
|
||||
- Secrets are sent in HTTP headers (`X-Uptop-Secret`). Use TLS or a reverse proxy for production.
|
||||
- uptop warns on startup if the cluster secret is missing or if cluster mode is active without TLS.
|
||||
|
||||
@@ -52,7 +52,7 @@ func runFollowerLoop(ctx context.Context, cfg Config, eng *monitor.Engine) {
|
||||
|
||||
req, _ := http.NewRequest("GET", cfg.PeerURL+"/api/health", nil)
|
||||
if cfg.SharedKey != "" {
|
||||
req.Header.Set("X-Upkeep-Secret", cfg.SharedKey)
|
||||
req.Header.Set("X-Uptop-Secret", cfg.SharedKey)
|
||||
}
|
||||
|
||||
resp, err := client.Do(req)
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestFollowerLoop_SendsSecret(t *testing.T) {
|
||||
var receivedSecret string
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
mu.Lock()
|
||||
receivedSecret = r.Header.Get("X-Upkeep-Secret")
|
||||
receivedSecret = r.Header.Get("X-Uptop-Secret")
|
||||
mu.Unlock()
|
||||
w.WriteHeader(200)
|
||||
w.Write([]byte("OK"))
|
||||
|
||||
@@ -90,7 +90,7 @@ func probeRegister(ctx context.Context, client *http.Client, cfg ProbeConfig) er
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("X-Upkeep-Secret", cfg.SharedKey)
|
||||
req.Header.Set("X-Uptop-Secret", cfg.SharedKey)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -108,7 +108,7 @@ func probeFetchAssignments(ctx context.Context, client *http.Client, cfg ProbeCo
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("X-Upkeep-Secret", cfg.SharedKey)
|
||||
req.Header.Set("X-Uptop-Secret", cfg.SharedKey)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -180,7 +180,7 @@ func probeReportResults(ctx context.Context, client *http.Client, cfg ProbeConfi
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("X-Upkeep-Secret", cfg.SharedKey)
|
||||
req.Header.Set("X-Uptop-Secret", cfg.SharedKey)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -127,7 +127,7 @@ func (s *Server) routes() http.Handler {
|
||||
}
|
||||
|
||||
func (s *Server) requireAuth(r *http.Request) bool {
|
||||
return s.cfg.ClusterKey != "" && checkSecret(r.Header.Get("X-Upkeep-Secret"), s.cfg.ClusterKey)
|
||||
return s.cfg.ClusterKey != "" && checkSecret(r.Header.Get("X-Uptop-Secret"), s.cfg.ClusterKey)
|
||||
}
|
||||
|
||||
func (s *Server) handlePush(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -159,7 +159,7 @@ func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
if s.cfg.ClusterKey != "" && !checkSecret(r.Header.Get("X-Upkeep-Secret"), s.cfg.ClusterKey) {
|
||||
if s.cfg.ClusterKey != "" && !checkSecret(r.Header.Get("X-Uptop-Secret"), s.cfg.ClusterKey) {
|
||||
http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func authReq(method, url, secret string, body []byte) (*http.Response, error) {
|
||||
return nil, err
|
||||
}
|
||||
if secret != "" {
|
||||
req.Header.Set("X-Upkeep-Secret", secret)
|
||||
req.Header.Set("X-Uptop-Secret", secret)
|
||||
}
|
||||
return http.DefaultClient.Do(req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user