TestSummarizeAttachStmt verifies log/error output never includes secret material embedded in CREATE SECRET statements.
(t *testing.T)
| 165 | // TestSummarizeAttachStmt verifies log/error output never includes secret |
| 166 | // material embedded in CREATE SECRET statements. |
| 167 | func 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 | } |
nothing calls this directly
no test coverage detected