@@ -354,31 +354,24 @@ private module Pino {
354
354
/**
355
355
* Gets a logger instance from the `pino` library.
356
356
*/
357
- private DataFlow :: SourceNode pino ( ) {
358
- result = pinoApi ( ) . getAnImmediateUse ( )
357
+ private API :: Node pino ( ) {
358
+ result = pinoApi ( )
359
359
or
360
360
// `pino` is installed as the "log" property on the request object in `Express` and similar libraries.
361
361
// in `Hapi` the property is "logger".
362
- exists ( HTTP:: RequestExpr req |
363
- result = req .flow ( ) .getALocalSource ( ) .getAPropertyRead ( [ "log" , "logger" ] )
362
+ exists ( HTTP:: RequestExpr req , API:: Node reqNode |
363
+ reqNode .getAnImmediateUse ( ) = req .flow ( ) .getALocalSource ( ) and
364
+ result = reqNode .getMember ( [ "log" , "logger" ] )
364
365
)
365
366
}
366
367
367
- /**
368
- * Gets a reference to a logger method from the `pino` library.
369
- */
370
- private DataFlow:: SourceNode pinoCallee ( DataFlow:: TypeTracker t ) {
371
- t .startInProp ( [ "trace" , "debug" , "info" , "warn" , "error" , "fatal" ] ) and
372
- result = pino ( )
373
- or
374
- exists ( DataFlow:: TypeTracker t2 | result = pinoCallee ( t2 ) .track ( t2 , t ) )
375
- }
376
-
377
368
/**
378
369
* A logging call to the `pino` library.
379
370
*/
380
371
private class PinoCall extends LoggerCall {
381
- PinoCall ( ) { this = pinoCallee ( DataFlow:: TypeTracker:: end ( ) ) .getACall ( ) }
372
+ PinoCall ( ) {
373
+ this = pino ( ) .getMember ( [ "trace" , "debug" , "info" , "warn" , "error" , "fatal" ] ) .getACall ( )
374
+ }
382
375
383
376
override DataFlow:: Node getAMessageComponent ( ) { result = getAnArgument ( ) }
384
377
}
0 commit comments