mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
c7e50d5602
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.
39 lines
818 B
Go
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 "/"
|
|
}
|