@@ -27,13 +27,16 @@ describe("AcpStderr", () => {
2727 expect ( excerpt ) . not . toContain ( "sk-abcdefghijklmnopqrstuv" ) ;
2828 } ) ;
2929
30- it ( "redacts complete API keys whose synthetic bodies contain underscores" , ( ) => {
31- const excerpt = sanitizeAcpStderrExcerpt (
32- "openai=sk-proj-fixture_abc_def_0123456789\nanthropic=sk-ant-api03-fixture_abc_def_0123456789-AA" ,
33- "fixture-home" ,
34- { } ,
35- ) ;
36- expect ( excerpt ) . toBe ( "openai=[redacted]\nanthropic=[redacted]" ) ;
30+ it ( "withholds multiline private-key bodies, including unterminated keys" , ( ) => {
31+ for ( const end of [ "-----END PRIVATE KEY-----" , "" ] ) {
32+ const excerpt = sanitizeAcpStderrExcerpt (
33+ `Configuration failed.\n-----BEGIN PRIVATE KEY-----\nZml4dHVyZS1wcml2YXRlLWJvZHk=\n${ end } ` ,
34+ "/home/server" ,
35+ { } ,
36+ ) ;
37+ expect ( excerpt ) . toContain ( "Configuration failed." ) ;
38+ expect ( excerpt ) . not . toContain ( "Zml4dHVyZS1wcml2YXRlLWJvZHk=" ) ;
39+ }
3740 } ) ;
3841
3942 it ( "redacts hyphenated OpenAI project keys and header credentials" , ( ) => {
@@ -44,6 +47,7 @@ describe("AcpStderr", () => {
4447 "anthropic=sk-ant-api03-abcdefghijklmnopqrstuvwxyz012345" ,
4548 "Authorization: Basic dXNlcjpwYXNz" ,
4649 "x-api-key: ant-api-key-value" ,
50+ "github_pat_fixture_123 gho_fixture123 ghu_fixture123 ghs_fixture123 ghr_fixture123" ,
4751 ] . join ( "\n" ) ,
4852 "/Users/ada" ,
4953 { } ,
@@ -58,6 +62,8 @@ describe("AcpStderr", () => {
5862 expect ( excerpt ) . not . toContain ( "abcdefghijklmnopqrstuvwxyz012345" ) ;
5963 expect ( excerpt ) . not . toContain ( "dXNlcjpwYXNz" ) ;
6064 expect ( excerpt ) . not . toContain ( "ant-api-key-value" ) ;
65+ expect ( excerpt ) . not . toContain ( "fixture123" ) ;
66+ expect ( excerpt ) . not . toContain ( "fixture_123" ) ;
6167 } ) ;
6268
6369 it ( "redacts the whole key when its body contains underscores" , ( ) => {
0 commit comments