@@ -1986,7 +1986,6 @@ describe("qa suite runtime launcher", () => {
19861986 expect ( runQaTestFileScenarios ) . toHaveBeenNthCalledWith (
19871987 2 ,
19881988 expect . objectContaining ( {
1989- onCommandOutput : expect . any ( Function ) ,
19901989 progress : expect . any ( Function ) ,
19911990 scenarios : [
19921991 expect . objectContaining ( { execution : expect . objectContaining ( { kind : "script" } ) } ) ,
@@ -1995,149 +1994,51 @@ describe("qa suite runtime launcher", () => {
19951994 ) ;
19961995 } ) ;
19971996
1998- it ( "redacts split native output and neutralizes CI commands before streaming " , async ( ) => {
1999- const repoRoot = await makeTempRepo ( "qa-suite-safe-native-output -" ) ;
1997+ it ( "streams native owner progress without exposing child output to CI " , async ( ) => {
1998+ const repoRoot = await makeTempRepo ( "qa-suite-safe-native-progress -" ) ;
20001999 vi . stubEnv ( "OPENCLAW_QA_SUITE_PROGRESS" , "1" ) ;
20012000 const stdoutWrite = vi . spyOn ( process . stdout , "write" ) . mockReturnValue ( true ) ;
20022001 const stderrWrite = vi . spyOn ( process . stderr , "write" ) . mockReturnValue ( true ) ;
20032002 const defaultTestFileImplementation = requireDefaultQaTestFileImplementation ( ) ;
20042003 runQaTestFileScenarios . mockImplementationOnce ( async ( params ) => {
2005- params . onCommandOutput ?.( "stdout" , Buffer . from ( "OPENAI_API_" ) ) ;
2006- params . onCommandOutput ?.( "stdout" , Buffer . from ( "KEY=synthetic-split-secret-123456789\n" ) ) ;
2007- params . onCommandOutput ?.( "stdout" , Buffer . from ( "::stop-" ) ) ;
2008- params . onCommandOutput ?.( "stdout" , Buffer . from ( "commands::attacker\n" ) ) ;
2009- params . onCommandOutput ?.( "stderr" , Buffer . from ( "Authorization: Bea" ) ) ;
2010- params . onCommandOutput ?.( "stderr" , Buffer . from ( "rer synthetic-bearer-secret-987654321\n" ) ) ;
2011- params . onCommandOutput ?.( "stderr" , Buffer . from ( "#" ) ) ;
2012- params . onCommandOutput ?.( "stderr" , Buffer . from ( "#[error]attacker\n" ) ) ;
2013- params . onCommandOutput ?.( "stdout" , Buffer . from ( "prefix -----BEGIN RSA PRIVATE KEY-----\n" ) ) ;
2014- params . onCommandOutput ?.( "stdout" , Buffer . from ( "synthetic-pem-secret-body-22334455\n" ) ) ;
2015- params . onCommandOutput ?.( "stdout" , Buffer . from ( "-----END RSA PRIVATE KEY-----\n" ) ) ;
2016- params . onCommandOutput ?.(
2017- "stdout" ,
2018- Buffer . from ( `${ "x" . repeat ( 16_384 ) } -----BEGIN EC PRIVATE KEY-----\n` ) ,
2004+ params . progress ?.( "native docker-batch start scenarios=1 timeoutMs=60000" ) ;
2005+ expect ( stderrWrite ) . toHaveBeenCalledWith (
2006+ expect . stringContaining ( "[qa-suite] native docker-batch start" ) ,
20192007 ) ;
2020- params . onCommandOutput ?.( "stdout" , Buffer . from ( "synthetic-oversized-pem-secret-body\n" ) ) ;
2021- params . onCommandOutput ?.(
2022- "stdout" ,
2023- Buffer . from ( "-----END EC PRIVATE KEY-----\nsafe PEM recovery\n" ) ,
2024- ) ;
2025- params . onCommandOutput ?.( "stdout" , Buffer . from ( `${ "x" . repeat ( 16_380 ) } -----BE` ) ) ;
2026- params . onCommandOutput ?.( "stdout" , Buffer . from ( "GIN OPENSSH PRIVATE KEY-----\n" ) ) ;
2027- params . onCommandOutput ?.( "stdout" , Buffer . from ( "synthetic-split-oversized-pem-secret\n" ) ) ;
2028- params . onCommandOutput ?.( "stdout" , Buffer . from ( "-----END OPENSSH PRI" ) ) ;
2029- params . onCommandOutput ?.( "stdout" , Buffer . from ( "VATE KEY-----\nsafe split PEM recovery\n" ) ) ;
2030- params . onCommandOutput ?.( "stderr" , Buffer . from ( "channels.buzz.authTag: [\r\n" ) ) ;
2031- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "synthetic-auth-tag-secret",\r\n' ) ) ;
2032- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "synthetic-auth-signature"\r\n]\r\n' ) ) ;
2033- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "authTag": [\n' ) ) ;
2034- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "synthetic-json-auth-tag-secret"\n]\n' ) ) ;
2035- params . onCommandOutput ?.( "stderr" , Buffer . from ( "channels.buzz.authTag:\n" ) ) ;
2036- params . onCommandOutput ?.(
2037- "stderr" ,
2038- Buffer . from ( '[\n"synthetic-line-separated-auth-secret"\n]\n' ) ,
2039- ) ;
2040- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "authTag":\r\n' ) ) ;
2041- params . onCommandOutput ?.(
2042- "stderr" ,
2043- Buffer . from ( '[\r\n"synthetic-quoted-line-separated-auth-secret"\r\n]\r\n' ) ,
2044- ) ;
2045- params . onCommandOutput ?.( "stderr" , Buffer . from ( ' "authTag"\r\n' ) ) ;
2046- params . onCommandOutput ?.( "stderr" , Buffer . from ( ":\r\n" ) ) ;
2047- params . onCommandOutput ?.(
2048- "stderr" ,
2049- Buffer . from ( '[\r\n"synthetic-key-colon-separated-auth-secret"\r\n]\r\n' ) ,
2050- ) ;
2051- params . onCommandOutput ?.(
2052- "stderr" ,
2053- Buffer . from ( "authTag validation: channels.buzz.authTag:\n" ) ,
2054- ) ;
2055- params . onCommandOutput ?.(
2056- "stderr" ,
2057- Buffer . from ( '[\n"synthetic-repeated-mention-auth-secret"\n]\n' ) ,
2058- ) ;
2059- params . onCommandOutput ?.( "stderr" , Buffer . from ( "channels.buzz.AUTHTAG:\n" ) ) ;
2060- params . onCommandOutput ?.( "stderr" , Buffer . from ( '[\n"synthetic-mixed-case-auth-secret"\n]\n' ) ) ;
2061- params . onCommandOutput ?.( "stderr" , Buffer . from ( "ordinary mention of authTag\n" ) ) ;
2062- params . onCommandOutput ?.( "stderr" , Buffer . from ( "ordinary progress resumed\n" ) ) ;
2063- params . onCommandOutput ?.(
2064- "stderr" ,
2065- Buffer . from ( `${ "x" . repeat ( 16_384 ) } channels.buzz.authTag: [\n` ) ,
2066- ) ;
2067- params . onCommandOutput ?.( "stderr" , Buffer . from ( '"synthetic-oversized-auth-tag-secret"\n]\n' ) ) ;
2068- params . onCommandOutput ?.( "stderr" , Buffer . from ( `${ "x" . repeat ( 16_375 ) } channels.buzz.auth` ) ) ;
2069- params . onCommandOutput ?.( "stderr" , Buffer . from ( "Tag: [\n" ) ) ;
2070- params . onCommandOutput ?.(
2071- "stderr" ,
2072- Buffer . from ( '"synthetic-split-oversized-auth-secret"\n]\n' ) ,
2008+ const childOutput = Buffer . from (
2009+ [
2010+ "OPENAI_API_KEY=synthetic-provider-secret" ,
2011+ 'warning: invalid value " channels.buzz.authTag:' ,
2012+ "[" ,
2013+ ' "synthetic-auth-secret"' ,
2014+ "]" ,
2015+ "::stop-commands::synthetic-runner-attack" ,
2016+ "##[error]synthetic-runner-attack" ,
2017+ ] . join ( "\n" ) ,
20732018 ) ;
2074- params . onCommandOutput ?.( "stderr" , Buffer . from ( `OPENAI_API_KEY=${ "x" . repeat ( 20_000 ) } ` ) ) ;
2075- params . onCommandOutput ?.( "stderr" , Buffer . from ( "discarded-secret\nsafe output resumed\n" ) ) ;
2076- params . onCommandOutput ?.( "stdout" , Buffer . from ( "OPENAI_API_KEY=" ) ) ;
2077- params . onCommandOutput ?.( "stdout" , Buffer . from ( "synthetic-trailing-secret-1122334455" ) ) ;
2078- expect ( stdoutWrite ) . toHaveBeenCalled ( ) ;
2019+ params . onCommandOutput ?.( "stdout" , childOutput ) ;
2020+ params . onCommandOutput ?.( "stderr" , childOutput ) ;
20792021 return await defaultTestFileImplementation ( params ) ;
20802022 } ) ;
20812023
20822024 try {
20832025 await runQaSuite ( {
20842026 repoRoot,
2085- outputDir : ".artifacts/qa-e2e/safe-native-output " ,
2027+ outputDir : ".artifacts/qa-e2e/safe-native-progress " ,
20862028 scenarioIds : [ "docker-npm-onboard-channel-agent" ] ,
20872029 } ) ;
2088- const unsafeTailFragments = [
2089- "OPENAI_API_K" ,
2090- "EY=synthetic-cross-forwarder-secret-55667788" ,
2091- ":" ,
2092- ":stop-commands::cross-forwarder-attacker" ,
2093- "-----BEGIN OPENSSH PRIVATE KEY-----\nsynthetic-incomplete-private-key" ,
2094- ] ;
2095- for ( const [ index , fragment ] of unsafeTailFragments . entries ( ) ) {
2096- runQaTestFileScenarios . mockImplementationOnce ( async ( params ) => {
2097- params . onCommandOutput ?.( "stdout" , Buffer . from ( fragment ) ) ;
2098- return await defaultTestFileImplementation ( params ) ;
2099- } ) ;
2100- await runQaSuite ( {
2101- repoRoot,
2102- outputDir : `.artifacts/qa-e2e/safe-native-output-${ index } ` ,
2103- scenarioIds : [ "docker-npm-onboard-channel-agent" ] ,
2104- } ) ;
2105- }
21062030
2107- const stdout = stdoutWrite . mock . calls . map ( ( [ chunk ] ) => String ( chunk ) ) . join ( "" ) ;
2108- const stderr = stderrWrite . mock . calls . map ( ( [ chunk ] ) => String ( chunk ) ) . join ( "" ) ;
2109- expect ( stdout ) . toContain ( "OPENAI_API_KEY=<redacted>" ) ;
2110- expect ( stdout ) . toContain ( ": :stop-commands::attacker" ) ;
2111- expect ( stdout ) . not . toContain ( "synthetic-split-secret-123456789" ) ;
2112- expect ( stdout ) . not . toContain ( "synthetic-trailing-secret-1122334455" ) ;
2113- expect ( stdout ) . not . toContain ( "synthetic-pem-secret-body-22334455" ) ;
2114- expect ( stdout ) . not . toContain ( "synthetic-oversized-pem-secret-body" ) ;
2115- expect ( stdout ) . toContain ( "safe PEM recovery" ) ;
2116- expect ( stdout ) . not . toContain ( "synthetic-split-oversized-pem-secret" ) ;
2117- expect ( stdout ) . toContain ( "safe split PEM recovery" ) ;
2118- expect ( stdout ) . not . toContain ( "synthetic-cross-forwarder-secret-55667788" ) ;
2119- expect ( stdout ) . not . toContain ( "synthetic-incomplete-private-key" ) ;
2120- expect ( stdout ) . not . toContain ( "cross-forwarder-attacker" ) ;
2121- expect ( stdout ) . not . toContain ( "::stop-commands::" ) ;
2122- expect ( stderr ) . toContain ( "Bearer <redacted>" ) ;
2123- expect ( stderr ) . toContain ( "# #[error]attacker" ) ;
2124- expect ( stderr ) . toContain ( "channels.buzz.authTag: <redacted>" ) ;
2125- expect ( stderr ) . toContain ( "native output line omitted: exceeded safe limit" ) ;
2126- expect ( stderr ) . toContain ( "safe output resumed" ) ;
2127- expect ( stderr ) . not . toContain ( "synthetic-bearer-secret-987654321" ) ;
2128- expect ( stderr ) . not . toContain ( "synthetic-auth-tag-secret" ) ;
2129- expect ( stderr ) . not . toContain ( "synthetic-auth-signature" ) ;
2130- expect ( stderr ) . not . toContain ( "synthetic-json-auth-tag-secret" ) ;
2131- expect ( stderr ) . not . toContain ( "synthetic-line-separated-auth-secret" ) ;
2132- expect ( stderr ) . not . toContain ( "synthetic-quoted-line-separated-auth-secret" ) ;
2133- expect ( stderr ) . not . toContain ( "synthetic-key-colon-separated-auth-secret" ) ;
2134- expect ( stderr ) . not . toContain ( "synthetic-repeated-mention-auth-secret" ) ;
2135- expect ( stderr ) . not . toContain ( "synthetic-mixed-case-auth-secret" ) ;
2136- expect ( stderr ) . toContain ( "ordinary progress resumed" ) ;
2137- expect ( stderr ) . not . toContain ( "synthetic-oversized-auth-tag-secret" ) ;
2138- expect ( stderr ) . not . toContain ( "synthetic-split-oversized-auth-secret" ) ;
2139- expect ( stderr ) . not . toContain ( "discarded-secret" ) ;
2140- expect ( stderr ) . not . toContain ( "##[error]" ) ;
2031+ const runnerParams = runQaTestFileScenarios . mock . calls [ 0 ] ?. [ 0 ] ;
2032+ expect ( runnerParams ?. progress ) . toEqual ( expect . any ( Function ) ) ;
2033+ expect ( runnerParams ) . not . toHaveProperty ( "onCommandOutput" ) ;
2034+ const output = [ ...stdoutWrite . mock . calls , ...stderrWrite . mock . calls ]
2035+ . map ( ( [ chunk ] ) => String ( chunk ) )
2036+ . join ( "" ) ;
2037+ expect ( output ) . toContain ( "[qa-suite] native docker-batch start" ) ;
2038+ expect ( output ) . not . toContain ( "synthetic-provider-secret" ) ;
2039+ expect ( output ) . not . toContain ( "synthetic-auth-secret" ) ;
2040+ expect ( output ) . not . toContain ( "::stop-commands::" ) ;
2041+ expect ( output ) . not . toContain ( "##[error]" ) ;
21412042 } finally {
21422043 stdoutWrite . mockRestore ( ) ;
21432044 stderrWrite . mockRestore ( ) ;
0 commit comments