MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestSummarizeAttachStmt

Function TestSummarizeAttachStmt

server/attach_timeout_test.go:167–186  ·  view source on GitHub ↗

TestSummarizeAttachStmt verifies log/error output never includes secret material embedded in CREATE SECRET statements.

(t *testing.T)

Source from the content-addressed store, hash-verified

165// TestSummarizeAttachStmt verifies log/error output never includes secret
166// material embedded in CREATE SECRET statements.
167func TestSummarizeAttachStmt(t *testing.T) {
168 secretStmt := `
169 CREATE OR REPLACE SECRET ducklake_s3 (
170 TYPE s3,
171 PROVIDER config,
172 KEY_ID 'AKIAEXAMPLEKEY',
173 SECRET 'supersecretvalue'
174 )`
175 got := summarizeAttachStmt(secretStmt)
176 if strings.Contains(got, "AKIAEXAMPLEKEY") || strings.Contains(got, "supersecretvalue") {
177 t.Fatalf("summary leaks credentials: %q", got)
178 }
179 if !strings.Contains(got, "CREATE OR REPLACE SECRET ducklake_s3") {
180 t.Fatalf("summary lost the identifying prefix: %q", got)
181 }
182
183 if got := summarizeAttachStmt("SET ducklake_max_retry_count = 100"); got != "SET ducklake_max_retry_count = 100" {
184 t.Fatalf("short statement mangled: %q", got)
185 }
186}

Callers

nothing calls this directly

Calls 1

summarizeAttachStmtFunction · 0.85

Tested by

no test coverage detected