@@ -190,6 +190,47 @@ describe("observability", () => {
190190 } ) . pipe ( Effect . provide ( NodeServices . layer ) ) ,
191191 ) ;
192192
193+ it . effect ( "redacts WebSocket credentials from recorded and exported URLs" , ( ) =>
194+ Effect . gen ( function * ( ) {
195+ const delegates : Array < Tracer . NativeSpan > = [ ] ;
196+ const records : Array < EffectTraceRecord > = [ ] ;
197+ const tracer = yield * makeLocalFileTracer ( {
198+ filePath : "unused" ,
199+ maxBytes : 1024 ,
200+ maxFiles : 1 ,
201+ batchWindowMs : 10_000 ,
202+ sink : {
203+ filePath : "unused" ,
204+ push : ( record ) => {
205+ if ( record . type === "effect-span" ) records . push ( record ) ;
206+ } ,
207+ flush : Effect . void ,
208+ close : ( ) => Effect . void ,
209+ } ,
210+ delegate : Tracer . make ( {
211+ span : ( options ) => {
212+ const span = new Tracer . NativeSpan ( options ) ;
213+ delegates . push ( span ) ;
214+ return span ;
215+ } ,
216+ } ) ,
217+ } ) ;
218+ yield * Effect . annotateCurrentSpan ( {
219+ "url.full" : "http://127.0.0.1:3773/ws?wsTicket=ticket-secret&clientSurface=web" ,
220+ "url.query" : "dpop=proof-secret&wsTicket=ticket-secret" ,
221+ "url.path" : "/ws" ,
222+ } ) . pipe ( Effect . withSpan ( "GET" ) , Effect . provideService ( Tracer . Tracer , tracer ) ) ;
223+
224+ const expected = {
225+ "url.full" : "http://127.0.0.1:3773/ws?wsTicket=<redacted>&clientSurface=web" ,
226+ "url.query" : "dpop=<redacted>&wsTicket=<redacted>" ,
227+ "url.path" : "/ws" ,
228+ } ;
229+ assert . deepInclude ( records [ 0 ] ?. attributes , expected ) ;
230+ assert . deepInclude ( Object . fromEntries ( delegates [ 0 ] ! . attributes ) , expected ) ;
231+ } ) . pipe ( Effect . provide ( NodeServices . layer ) ) ,
232+ ) ;
233+
193234 it ( "normalizes circular arrays, maps, and sets without recursing forever" , ( ) => {
194235 const array : Array < unknown > = [ "alpha" ] ;
195236 array . push ( array ) ;
0 commit comments