| 63 | } |
| 64 | if cfg2.DuckLake.MetadataStore != cfg.DuckLake.MetadataStore { |
| 65 | t.Errorf("DuckLake.MetadataStore mismatch: got %q, want %q", cfg2.DuckLake.MetadataStore, cfg.DuckLake.MetadataStore) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | func TestChildConfigSecurityNote(t *testing.T) { |
| 70 | // This test documents the security improvement: config is passed via stdin |
| 71 | // instead of environment variables, which prevents other processes from |
| 72 | // reading passwords via /proc/<pid>/environ |
| 73 | |
| 74 | cfg := ChildConfig{ |
| 75 | Users: map[string]string{ |
| 76 | "admin": "supersecret", |
| 77 | "readonly": "lesssecret", |
| 78 | }, |
| 79 | } |
| 80 | |
| 81 | data, err := json.Marshal(cfg) |
| 82 | if err != nil { |
| 83 | t.Fatalf("Failed to marshal: %v", err) |
| 84 | } |
| 85 | |
| 86 | // Verify sensitive data is in the JSON (it will be passed via stdin pipe) |
| 87 | dataStr := string(data) |
| 88 | if dataStr == "" { |
| 89 | t.Error("Expected non-empty serialized config") |
| 90 | } |
| 91 | |
| 92 | // The key security property is that this JSON is passed via stdin pipe |
| 93 | // (a private file descriptor) rather than DUCKGRES_CHILD_CONFIG env var |
| 94 | // which would be visible in /proc/<pid>/environ |
| 95 | |
| 96 | // Verify the Users map is properly serialized |
| 97 | var cfg2 ChildConfig |
| 98 | if err := json.Unmarshal(data, &cfg2); err != nil { |
| 99 | t.Fatalf("Failed to unmarshal: %v", err) |
| 100 | } |
| 101 | if cfg2.Users["admin"] != "supersecret" { |
| 102 | t.Error("Password not properly serialized/deserialized") |
| 103 | } |