@@ -357,7 +357,7 @@ module BoostorgAsio {
357
357
* Abstract class for flows of protocol values to the first argument of a context
358
358
* constructor.
359
359
*/
360
- abstract class SslContextCallAbstractConfig extends DataFlow:: Configuration {
360
+ abstract deprecated class SslContextCallAbstractConfig extends DataFlow:: Configuration {
361
361
bindingset [ this ]
362
362
SslContextCallAbstractConfig ( ) { any ( ) }
363
363
@@ -369,10 +369,47 @@ module BoostorgAsio {
369
369
}
370
370
}
371
371
372
+ /**
373
+ * Signature for flows of protocol values to the first argument of a context
374
+ * constructor.
375
+ */
376
+ signature module SslContextCallConfigSig {
377
+ /**
378
+ * Holds if `source` is a relevant data flow source.
379
+ */
380
+ predicate isSource ( DataFlow:: Node source ) ;
381
+
382
+ /**
383
+ * Holds if `sink` is a relevant data flow sink.
384
+ */
385
+ default predicate isSink ( DataFlow:: Node sink ) {
386
+ exists ( ConstructorCall cc , SslContextClass c , Expr e | e = sink .asExpr ( ) |
387
+ c .getAContructorCall ( ) = cc and
388
+ cc .getArgument ( 0 ) = e
389
+ )
390
+ }
391
+ }
392
+
393
+ /**
394
+ * Constructs a standard data flow computation for protocol values to the first argument
395
+ * of a context constructor.
396
+ */
397
+ module SslContextCallMake< SslContextCallConfigSig Config> {
398
+ private module C implements DataFlow:: ConfigSig {
399
+ predicate isSource = Config:: isSource / 1 ;
400
+
401
+ predicate isSink = Config:: isSink / 1 ;
402
+ }
403
+
404
+ module F = DataFlow:: Make< C > ;
405
+
406
+ import F
407
+ }
408
+
372
409
/**
373
410
* Any protocol value that flows to the first argument of a context constructor.
374
411
*/
375
- class SslContextCallConfig extends SslContextCallAbstractConfig {
412
+ deprecated class SslContextCallConfig extends SslContextCallAbstractConfig {
376
413
SslContextCallConfig ( ) { this = "SslContextCallConfig" }
377
414
378
415
override predicate isSource ( DataFlow:: Node source ) {
@@ -383,10 +420,24 @@ module BoostorgAsio {
383
420
}
384
421
}
385
422
423
+ /**
424
+ * Any protocol value that flows to the first argument of a context constructor.
425
+ */
426
+ private module SslContextCallConfig implements SslContextCallConfigSig {
427
+ predicate isSource ( DataFlow:: Node source ) {
428
+ exists ( Expr e | e = source .asExpr ( ) |
429
+ e .fromSource ( ) and
430
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
431
+ )
432
+ }
433
+ }
434
+
435
+ module SslContextCallFlow = SslContextCallMake< SslContextCallConfig > ;
436
+
386
437
/**
387
438
* A banned protocol value that flows to the first argument of a context constructor.
388
439
*/
389
- class SslContextCallBannedProtocolConfig extends SslContextCallAbstractConfig {
440
+ deprecated class SslContextCallBannedProtocolConfig extends SslContextCallAbstractConfig {
390
441
SslContextCallBannedProtocolConfig ( ) { this = "SslContextCallBannedProtocolConfig" }
391
442
392
443
override predicate isSource ( DataFlow:: Node source ) {
@@ -398,10 +449,25 @@ module BoostorgAsio {
398
449
}
399
450
}
400
451
452
+ /**
453
+ * A banned protocol value that flows to the first argument of a context constructor.
454
+ */
455
+ private module SslContextCallBannedProtocolConfig implements SslContextCallConfigSig {
456
+ predicate isSource ( DataFlow:: Node source ) {
457
+ exists ( Expr e | e = source .asExpr ( ) |
458
+ e .fromSource ( ) and
459
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
460
+ isExprBannedBoostProtocol ( e )
461
+ )
462
+ }
463
+ }
464
+
465
+ module SslContextCallBannedProtocolFlow = SslContextCallMake< SslContextCallBannedProtocolConfig > ;
466
+
401
467
/**
402
468
* A TLS 1.2 protocol value that flows to the first argument of a context constructor.
403
469
*/
404
- class SslContextCallTls12ProtocolConfig extends SslContextCallAbstractConfig {
470
+ deprecated class SslContextCallTls12ProtocolConfig extends SslContextCallAbstractConfig {
405
471
SslContextCallTls12ProtocolConfig ( ) { this = "SslContextCallTls12ProtocolConfig" }
406
472
407
473
override predicate isSource ( DataFlow:: Node source ) {
@@ -413,10 +479,25 @@ module BoostorgAsio {
413
479
}
414
480
}
415
481
482
+ /**
483
+ * A TLS 1.2 protocol value that flows to the first argument of a context constructor.
484
+ */
485
+ private module SslContextCallTls12ProtocolConfig implements SslContextCallConfigSig {
486
+ predicate isSource ( DataFlow:: Node source ) {
487
+ exists ( Expr e | e = source .asExpr ( ) |
488
+ e .fromSource ( ) and
489
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
490
+ isExprTls12BoostProtocol ( e )
491
+ )
492
+ }
493
+ }
494
+
495
+ module SslContextCallTls12ProtocolFlow = SslContextCallMake< SslContextCallTls12ProtocolConfig > ;
496
+
416
497
/**
417
498
* A TLS 1.3 protocol value that flows to the first argument of a context constructor.
418
499
*/
419
- class SslContextCallTls13ProtocolConfig extends SslContextCallAbstractConfig {
500
+ deprecated class SslContextCallTls13ProtocolConfig extends SslContextCallAbstractConfig {
420
501
SslContextCallTls13ProtocolConfig ( ) { this = "SslContextCallTls12ProtocolConfig" }
421
502
422
503
override predicate isSource ( DataFlow:: Node source ) {
@@ -428,10 +509,25 @@ module BoostorgAsio {
428
509
}
429
510
}
430
511
512
+ /**
513
+ * A TLS 1.3 protocol value that flows to the first argument of a context constructor.
514
+ */
515
+ private module SslContextCallTls13ProtocolConfig implements SslContextCallConfigSig {
516
+ predicate isSource ( DataFlow:: Node source ) {
517
+ exists ( Expr e | e = source .asExpr ( ) |
518
+ e .fromSource ( ) and
519
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
520
+ isExprTls13BoostProtocol ( e )
521
+ )
522
+ }
523
+ }
524
+
525
+ module SslContextCallTls13ProtocolFlow = SslContextCallMake< SslContextCallTls13ProtocolConfig > ;
526
+
431
527
/**
432
528
* A generic TLS protocol value that flows to the first argument of a context constructor.
433
529
*/
434
- class SslContextCallTlsProtocolConfig extends SslContextCallAbstractConfig {
530
+ deprecated class SslContextCallTlsProtocolConfig extends SslContextCallAbstractConfig {
435
531
SslContextCallTlsProtocolConfig ( ) { this = "SslContextCallTlsProtocolConfig" }
436
532
437
533
override predicate isSource ( DataFlow:: Node source ) {
@@ -443,10 +539,25 @@ module BoostorgAsio {
443
539
}
444
540
}
445
541
542
+ /**
543
+ * A generic TLS protocol value that flows to the first argument of a context constructor.
544
+ */
545
+ private module SslContextCallTlsProtocolConfig implements SslContextCallConfigSig {
546
+ predicate isSource ( DataFlow:: Node source ) {
547
+ exists ( Expr e | e = source .asExpr ( ) |
548
+ e .fromSource ( ) and
549
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
550
+ isExprTlsBoostProtocol ( e )
551
+ )
552
+ }
553
+ }
554
+
555
+ module SslContextCallTlsProtocolFlow = SslContextCallMake< SslContextCallTlsProtocolConfig > ;
556
+
446
557
/**
447
558
* A context constructor call that flows to a call to `SetOptions()`.
448
559
*/
449
- class SslContextFlowsToSetOptionConfig extends DataFlow:: Configuration {
560
+ deprecated class SslContextFlowsToSetOptionConfig extends DataFlow:: Configuration {
450
561
SslContextFlowsToSetOptionConfig ( ) { this = "SslContextFlowsToSetOptionConfig" }
451
562
452
563
override predicate isSource ( DataFlow:: Node source ) {
@@ -467,10 +578,34 @@ module BoostorgAsio {
467
578
}
468
579
}
469
580
581
+ /**
582
+ * A context constructor call that flows to a call to `SetOptions()`.
583
+ */
584
+ private module SslContextFlowsToSetOptionConfig implements DataFlow:: ConfigSig {
585
+ predicate isSource ( DataFlow:: Node source ) {
586
+ exists ( SslContextClass c , ConstructorCall cc |
587
+ cc = source .asExpr ( ) and
588
+ c .getAContructorCall ( ) = cc
589
+ )
590
+ }
591
+
592
+ predicate isSink ( DataFlow:: Node sink ) {
593
+ exists ( FunctionCall fc , SslSetOptionsFunction f , Variable v , VariableAccess va |
594
+ va = sink .asExpr ( )
595
+ |
596
+ f .getACallToThisFunction ( ) = fc and
597
+ v .getAnAccess ( ) = va and
598
+ va = fc .getQualifier ( )
599
+ )
600
+ }
601
+ }
602
+
603
+ module SslContextFlowsToSetOptionFlow = DataFlow:: Make< SslContextFlowsToSetOptionConfig > ;
604
+
470
605
/**
471
606
* An option value that flows to the first parameter of a call to `SetOptions()`.
472
607
*/
473
- class SslOptionConfig extends DataFlow:: Configuration {
608
+ deprecated class SslOptionConfig extends DataFlow:: Configuration {
474
609
SslOptionConfig ( ) { this = "SslOptionConfig" }
475
610
476
611
override predicate isSource ( DataFlow:: Node source ) {
@@ -488,4 +623,26 @@ module BoostorgAsio {
488
623
)
489
624
}
490
625
}
626
+
627
+ /**
628
+ * An option value that flows to the first parameter of a call to `SetOptions()`.
629
+ */
630
+ private module SslOptionConfig implements DataFlow:: ConfigSig {
631
+ predicate isSource ( DataFlow:: Node source ) {
632
+ exists ( Expr e | e = source .asExpr ( ) |
633
+ e .fromSource ( ) and
634
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
635
+ )
636
+ }
637
+
638
+ predicate isSink ( DataFlow:: Node sink ) {
639
+ exists ( SslSetOptionsFunction f , FunctionCall call |
640
+ sink .asExpr ( ) = call .getArgument ( 0 ) and
641
+ f .getACallToThisFunction ( ) = call and
642
+ not sink .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
643
+ )
644
+ }
645
+ }
646
+
647
+ module SslOptionFlow = DataFlow:: Make< SslOptionConfig > ;
491
648
}
0 commit comments