Files
rcourtman c7e50d5602 Harden provider-hosted MSP isolation
Broker provider control-plane Docker access through a socket proxy, remove broad host mounts, align audit and rate-limit proxy trust, harden tenant runtime containers, restrict workspace report logo paths, and update provider deploy guardrails.
2026-06-02 21:10:13 +01:00

39 lines
818 B
Go

package auditlog
import (
"net/http"
"strings"
"github.com/rcourtman/pulse-go-rewrite/internal/cloudcp/proxytrust"
)
// ClientIP resolves the best-effort client IP for audit metadata.
func ClientIP(r *http.Request) string {
return proxytrust.ClientIP(r)
}
// ActorID returns the request actor identifier from common headers.
func ActorID(r *http.Request) string {
if r == nil {
return ""
}
for _, header := range []string{"X-Actor-ID", "X-Actor-Id", "X-User-ID", "X-User-Id"} {
if v := strings.TrimSpace(r.Header.Get(header)); v != "" {
return v
}
}
return ""
}
// RequestPath returns a stable request path for audit metadata.
func RequestPath(r *http.Request) string {
if r == nil || r.URL == nil {
return ""
}
if p := strings.TrimSpace(r.URL.Path); p != "" {
return p
}
return "/"
}