Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Cover loopback override in AI fetch guard

rcourtmandd3e9fc4a832
diff --git a/internal/ai/service_tools_test.go b/internal/ai/service_tools_test.go
index eecc534686..193ffa0c48 100644
--- a/internal/ai/service_tools_test.go
+++ b/internal/ai/service_tools_test.go
@@ -119,6 +119,15 @@ func TestIsBlockedFetchIP(t *testing.T) {
if isBlockedFetchIP(privateIP) {
t.Error("Private IP should be allowed when PULSE_AI_ALLOW_PRIVATE_IPS=true")
}
+
+ // Test that loopback IPs can be allowed via environment variable
+ os.Setenv("PULSE_AI_ALLOW_LOOPBACK", "true")
+ defer os.Unsetenv("PULSE_AI_ALLOW_LOOPBACK")
+
+ loopbackIP := net.ParseIP("127.0.0.1")
+ if isBlockedFetchIP(loopbackIP) {
+ t.Error("Loopback IP should be allowed when PULSE_AI_ALLOW_LOOPBACK=true")
+ }
}
func TestFetchURL_SizeLimit(t *testing.T) {