@@ -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,43 @@ 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
+ import Config
400
+ }
401
+
402
+ import DataFlow:: Make< C >
403
+ }
404
+
372
405
/**
373
406
* Any protocol value that flows to the first argument of a context constructor.
374
407
*/
375
- class SslContextCallConfig extends SslContextCallAbstractConfig {
408
+ deprecated class SslContextCallConfig extends SslContextCallAbstractConfig {
376
409
SslContextCallConfig ( ) { this = "SslContextCallConfig" }
377
410
378
411
override predicate isSource ( DataFlow:: Node source ) {
@@ -383,10 +416,24 @@ module BoostorgAsio {
383
416
}
384
417
}
385
418
419
+ /**
420
+ * Any protocol value that flows to the first argument of a context constructor.
421
+ */
422
+ private module SslContextCallConfig implements SslContextCallConfigSig {
423
+ predicate isSource ( DataFlow:: Node source ) {
424
+ exists ( Expr e | e = source .asExpr ( ) |
425
+ e .fromSource ( ) and
426
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
427
+ )
428
+ }
429
+ }
430
+
431
+ module SslContextCallFlow = SslContextCallMake< SslContextCallConfig > ;
432
+
386
433
/**
387
434
* A banned protocol value that flows to the first argument of a context constructor.
388
435
*/
389
- class SslContextCallBannedProtocolConfig extends SslContextCallAbstractConfig {
436
+ deprecated class SslContextCallBannedProtocolConfig extends SslContextCallAbstractConfig {
390
437
SslContextCallBannedProtocolConfig ( ) { this = "SslContextCallBannedProtocolConfig" }
391
438
392
439
override predicate isSource ( DataFlow:: Node source ) {
@@ -398,10 +445,25 @@ module BoostorgAsio {
398
445
}
399
446
}
400
447
448
+ /**
449
+ * A banned protocol value that flows to the first argument of a context constructor.
450
+ */
451
+ private module SslContextCallBannedProtocolConfig implements SslContextCallConfigSig {
452
+ predicate isSource ( DataFlow:: Node source ) {
453
+ exists ( Expr e | e = source .asExpr ( ) |
454
+ e .fromSource ( ) and
455
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
456
+ isExprBannedBoostProtocol ( e )
457
+ )
458
+ }
459
+ }
460
+
461
+ module SslContextCallBannedProtocolFlow = SslContextCallMake< SslContextCallBannedProtocolConfig > ;
462
+
401
463
/**
402
464
* A TLS 1.2 protocol value that flows to the first argument of a context constructor.
403
465
*/
404
- class SslContextCallTls12ProtocolConfig extends SslContextCallAbstractConfig {
466
+ deprecated class SslContextCallTls12ProtocolConfig extends SslContextCallAbstractConfig {
405
467
SslContextCallTls12ProtocolConfig ( ) { this = "SslContextCallTls12ProtocolConfig" }
406
468
407
469
override predicate isSource ( DataFlow:: Node source ) {
@@ -413,10 +475,25 @@ module BoostorgAsio {
413
475
}
414
476
}
415
477
478
+ /**
479
+ * A TLS 1.2 protocol value that flows to the first argument of a context constructor.
480
+ */
481
+ private module SslContextCallTls12ProtocolConfig implements SslContextCallConfigSig {
482
+ predicate isSource ( DataFlow:: Node source ) {
483
+ exists ( Expr e | e = source .asExpr ( ) |
484
+ e .fromSource ( ) and
485
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
486
+ isExprTls12BoostProtocol ( e )
487
+ )
488
+ }
489
+ }
490
+
491
+ module SslContextCallTls12ProtocolFlow = SslContextCallMake< SslContextCallTls12ProtocolConfig > ;
492
+
416
493
/**
417
494
* A TLS 1.3 protocol value that flows to the first argument of a context constructor.
418
495
*/
419
- class SslContextCallTls13ProtocolConfig extends SslContextCallAbstractConfig {
496
+ deprecated class SslContextCallTls13ProtocolConfig extends SslContextCallAbstractConfig {
420
497
SslContextCallTls13ProtocolConfig ( ) { this = "SslContextCallTls12ProtocolConfig" }
421
498
422
499
override predicate isSource ( DataFlow:: Node source ) {
@@ -428,10 +505,25 @@ module BoostorgAsio {
428
505
}
429
506
}
430
507
508
+ /**
509
+ * A TLS 1.3 protocol value that flows to the first argument of a context constructor.
510
+ */
511
+ private module SslContextCallTls13ProtocolConfig implements SslContextCallConfigSig {
512
+ predicate isSource ( DataFlow:: Node source ) {
513
+ exists ( Expr e | e = source .asExpr ( ) |
514
+ e .fromSource ( ) and
515
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
516
+ isExprTls13BoostProtocol ( e )
517
+ )
518
+ }
519
+ }
520
+
521
+ module SslContextCallTls13ProtocolFlow = SslContextCallMake< SslContextCallTls13ProtocolConfig > ;
522
+
431
523
/**
432
524
* A generic TLS protocol value that flows to the first argument of a context constructor.
433
525
*/
434
- class SslContextCallTlsProtocolConfig extends SslContextCallAbstractConfig {
526
+ deprecated class SslContextCallTlsProtocolConfig extends SslContextCallAbstractConfig {
435
527
SslContextCallTlsProtocolConfig ( ) { this = "SslContextCallTlsProtocolConfig" }
436
528
437
529
override predicate isSource ( DataFlow:: Node source ) {
@@ -443,10 +535,25 @@ module BoostorgAsio {
443
535
}
444
536
}
445
537
538
+ /**
539
+ * A generic TLS protocol value that flows to the first argument of a context constructor.
540
+ */
541
+ private module SslContextCallTlsProtocolConfig implements SslContextCallConfigSig {
542
+ predicate isSource ( DataFlow:: Node source ) {
543
+ exists ( Expr e | e = source .asExpr ( ) |
544
+ e .fromSource ( ) and
545
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" ) and
546
+ isExprTlsBoostProtocol ( e )
547
+ )
548
+ }
549
+ }
550
+
551
+ module SslContextCallTlsProtocolFlow = SslContextCallMake< SslContextCallTlsProtocolConfig > ;
552
+
446
553
/**
447
554
* A context constructor call that flows to a call to `SetOptions()`.
448
555
*/
449
- class SslContextFlowsToSetOptionConfig extends DataFlow:: Configuration {
556
+ deprecated class SslContextFlowsToSetOptionConfig extends DataFlow:: Configuration {
450
557
SslContextFlowsToSetOptionConfig ( ) { this = "SslContextFlowsToSetOptionConfig" }
451
558
452
559
override predicate isSource ( DataFlow:: Node source ) {
@@ -467,10 +574,34 @@ module BoostorgAsio {
467
574
}
468
575
}
469
576
577
+ /**
578
+ * A context constructor call that flows to a call to `SetOptions()`.
579
+ */
580
+ private module SslContextFlowsToSetOptionConfig implements DataFlow:: ConfigSig {
581
+ predicate isSource ( DataFlow:: Node source ) {
582
+ exists ( SslContextClass c , ConstructorCall cc |
583
+ cc = source .asExpr ( ) and
584
+ c .getAContructorCall ( ) = cc
585
+ )
586
+ }
587
+
588
+ predicate isSink ( DataFlow:: Node sink ) {
589
+ exists ( FunctionCall fc , SslSetOptionsFunction f , Variable v , VariableAccess va |
590
+ va = sink .asExpr ( )
591
+ |
592
+ f .getACallToThisFunction ( ) = fc and
593
+ v .getAnAccess ( ) = va and
594
+ va = fc .getQualifier ( )
595
+ )
596
+ }
597
+ }
598
+
599
+ module SslContextFlowsToSetOptionFlow = DataFlow:: Make< SslContextFlowsToSetOptionConfig > ;
600
+
470
601
/**
471
602
* An option value that flows to the first parameter of a call to `SetOptions()`.
472
603
*/
473
- class SslOptionConfig extends DataFlow:: Configuration {
604
+ deprecated class SslOptionConfig extends DataFlow:: Configuration {
474
605
SslOptionConfig ( ) { this = "SslOptionConfig" }
475
606
476
607
override predicate isSource ( DataFlow:: Node source ) {
@@ -488,4 +619,26 @@ module BoostorgAsio {
488
619
)
489
620
}
490
621
}
622
+
623
+ /**
624
+ * An option value that flows to the first parameter of a call to `SetOptions()`.
625
+ */
626
+ private module SslOptionConfig implements DataFlow:: ConfigSig {
627
+ predicate isSource ( DataFlow:: Node source ) {
628
+ exists ( Expr e | e = source .asExpr ( ) |
629
+ e .fromSource ( ) and
630
+ not e .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
631
+ )
632
+ }
633
+
634
+ predicate isSink ( DataFlow:: Node sink ) {
635
+ exists ( SslSetOptionsFunction f , FunctionCall call |
636
+ sink .asExpr ( ) = call .getArgument ( 0 ) and
637
+ f .getACallToThisFunction ( ) = call and
638
+ not sink .getLocation ( ) .getFile ( ) .toString ( ) .matches ( "%/boost/asio/%" )
639
+ )
640
+ }
641
+ }
642
+
643
+ module SslOptionFlow = DataFlow:: Make< SslOptionConfig > ;
491
644
}
0 commit comments