From 7ed0642819982fea1cb92a4b7196084ba603b951 Mon Sep 17 00:00:00 2001 From: Test Date: Sun, 6 Sep 2026 06:01:21 -0700 Subject: [PATCH] security: remove hardcoded cluster.local URLs from source code - activity/memory.go: read MEMORY_SERVICE_URL from env, default localhost - pkg/db/db.go: remove cluster.local from DSN comment - Fix memory_test.go env var name to match --- activity/memory.go | 4 ++-- activity/memory_test.go | 4 ++-- pkg/db/db.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/activity/memory.go b/activity/memory.go index b4b6ad8..e810793 100644 --- a/activity/memory.go +++ b/activity/memory.go @@ -92,9 +92,9 @@ func RetrieveMemoryActivity(ctx context.Context, in RetrieveMemoryInput) (Retrie } // Get memory service URL and token - baseURL := os.Getenv("POIMEN_MEMORY_URL") + baseURL := os.Getenv("MEMORY_SERVICE_URL") if baseURL == "" { - baseURL = "http://poimen-memory.poimen.svc.cluster.local:8080" + baseURL = "http://localhost:8080" } token := os.Getenv("POIMEN_MEMORY_TOKEN") diff --git a/activity/memory_test.go b/activity/memory_test.go index a2e3162..cb9ba95 100644 --- a/activity/memory_test.go +++ b/activity/memory_test.go @@ -39,7 +39,7 @@ func TestRetrieveMemoryActivity_Query(t *testing.T) { defer server.Close() // Set env for test - t.Setenv("POIMEN_MEMORY_URL", server.URL) + t.Setenv("MEMORY_SERVICE_URL", server.URL) output, err := RetrieveMemoryActivity(context.Background(), RetrieveMemoryInput{ Query: "security scanning", @@ -93,7 +93,7 @@ func TestRetrieveMemoryActivity_Context(t *testing.T) { })) defer server.Close() - t.Setenv("POIMEN_MEMORY_URL", server.URL) + t.Setenv("MEMORY_SERVICE_URL", server.URL) output, err := RetrieveMemoryActivity(context.Background(), RetrieveMemoryInput{ Query: "security scan repo", diff --git a/pkg/db/db.go b/pkg/db/db.go index 0ed06d1..a48216a 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -17,7 +17,7 @@ type DB struct { } // New creates a new database connection to memory-db (K8s CNPG) -// Expected DSN format: postgresql://app:password@memory-db-rw.poimen.svc.cluster.local:5432/memory?sslmode=disable +// Expected DSN format: postgresql://app:password@host:5432/dbname?sslmode=disable func New(dsn string) (*DB, error) { if dsn == "" { // Fallback: try to construct from K8s env vars