@@ -762,18 +762,24 @@ describe("provider local service", () => {
762762 const healthUrl = `http://127.0.0.1:${ port } /v1/models` ;
763763 const diagnosticSecret = "local-service-diagnostic-secret" ;
764764 const inheritedDiagnosticSecret = "inherited-local-service-diagnostic-secret" ;
765+ const headerDiagnosticSecret = "header-local-service-diagnostic-secret" ;
766+ const argumentDiagnosticSecret = "argument-local-service-diagnostic-secret" ;
765767 let startupError : Error | undefined ;
766768 vi . stubEnv ( "INHERITED_DIAGNOSTIC_TOKEN" , inheritedDiagnosticSecret ) ;
767769
768770 try {
769771 await ensureProviderLocalService ( {
770772 providerId : "local-diagnostics" ,
771773 baseUrl : `http://127.0.0.1:${ port } /v1` ,
774+ headers : {
775+ Authorization : `Bearer ${ headerDiagnosticSecret } ` ,
776+ } ,
772777 service : {
773778 command : process . execPath ,
774779 args : [
775780 "-e" ,
776- `const noise="x".repeat(9000);process.stderr.write(noise+" "+process.env.DIAGNOSTIC_SECRET+" "+process.env.INHERITED_DIAGNOSTIC_TOKEN);process.exit(17);` ,
781+ `const http=require("node:http");const noise="x".repeat(9000);const server=http.createServer((req,res)=>{process.stderr.write(noise+" "+process.env.DIAGNOSTIC_SECRET+" "+process.env.INHERITED_DIAGNOSTIC_TOKEN+" "+process.argv[1]+" "+req.headers.authorization);res.writeHead(503,{"connection":"close"});res.end("not ready");server.close();setTimeout(()=>process.exit(17),20);});server.listen(${ port } ,"127.0.0.1");` ,
782+ argumentDiagnosticSecret ,
777783 ] ,
778784 env : { DIAGNOSTIC_SECRET : diagnosticSecret } ,
779785 healthUrl,
@@ -793,6 +799,8 @@ describe("provider local service", () => {
793799 expect ( startupError ?. message ) . toContain ( "[redacted]" ) ;
794800 expect ( startupError ?. message ) . not . toContain ( diagnosticSecret ) ;
795801 expect ( startupError ?. message ) . not . toContain ( inheritedDiagnosticSecret ) ;
802+ expect ( startupError ?. message ) . not . toContain ( headerDiagnosticSecret ) ;
803+ expect ( startupError ?. message ) . not . toContain ( argumentDiagnosticSecret ) ;
796804 expect ( Buffer . byteLength ( startupError ?. message ?? "" ) ) . toBeLessThanOrEqual ( 8 * 1024 + 256 ) ;
797805 expect ( getManagedProviderLocalServiceDiagnosticsForTest ( ) ) . toEqual ( [ ] ) ;
798806 } ) ;
0 commit comments