@@ -452,45 +452,128 @@ S608.py:86:30: S608 Possible SQL injection vector through string-based query con
452
452
88 | # # pass
453
453
|
454
454
455
- S608 .py :98 :9 : S608 Possible SQL injection vector through string - based query construction
455
+ S608 .py :98 :11 : S608 Possible SQL injection vector through string - based query construction
456
456
|
457
457
97 | # # INSERT without INTO (e .g . MySQL and derivatives )
458
- 98 | query = " INSERT table VALUES (%s)" % (var ,)
459
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
458
+ 98 | query46 = " INSERT table VALUES (%s)" % (var ,)
459
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
460
460
99 |
461
461
100 | # # REPLACE (e .g . MySQL and derivatives , SQLite )
462
462
|
463
463
464
- S608 .py :101 :9 : S608 Possible SQL injection vector through string - based query construction
464
+ S608 .py :101 :11 : S608 Possible SQL injection vector through string - based query construction
465
465
|
466
466
100 | # # REPLACE (e .g . MySQL and derivatives , SQLite )
467
- 101 | query = " REPLACE INTO table VALUES (%s)" % (var ,)
468
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
469
- 102 | query = " REPLACE table VALUES (%s)" % (var ,)
467
+ 101 | query47 = " REPLACE INTO table VALUES (%s)" % (var ,)
468
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
469
+ 102 | query48 = " REPLACE table VALUES (%s)" % (var ,)
470
470
|
471
471
472
- S608 .py :102 :9 : S608 Possible SQL injection vector through string - based query construction
472
+ S608 .py :102 :11 : S608 Possible SQL injection vector through string - based query construction
473
473
|
474
474
100 | # # REPLACE (e .g . MySQL and derivatives , SQLite )
475
- 101 | query = " REPLACE INTO table VALUES (%s)" % (var ,)
476
- 102 | query = " REPLACE table VALUES (%s)" % (var ,)
477
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
475
+ 101 | query47 = " REPLACE INTO table VALUES (%s)" % (var ,)
476
+ 102 | query48 = " REPLACE table VALUES (%s)" % (var ,)
477
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
478
478
103 |
479
- 104 | query = " Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % " there"
479
+ 104 | query49 = " Deselect something that is not SQL even though it has a ' from ' somewhere in %s." % " there"
480
480
|
481
481
482
482
S608 .py :111 :1 : S608 Possible SQL injection vector through string - based query construction
483
483
|
484
484
110 | # # errors
485
- 111 | " SELECT * FROM " + (" table1" if x > 0 else " table2" )
485
+ 111 | " SELECT * FROM " + (" table1" if x > 0 else " table2" ) # query50
486
486
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
487
- 112 | " SELECT * FROM " + (" table1" if x > 0 else [" table2" ])
487
+ 112 | " SELECT * FROM " + (" table1" if x > 0 else [" table2" ]) # query51
488
488
|
489
489
490
490
S608 .py :112 :1 : S608 Possible SQL injection vector through string - based query construction
491
491
|
492
492
110 | # # errors
493
- 111 | " SELECT * FROM " + (" table1" if x > 0 else " table2" )
494
- 112 | " SELECT * FROM " + (" table1" if x > 0 else [" table2" ])
493
+ 111 | " SELECT * FROM " + (" table1" if x > 0 else " table2" ) # query50
494
+ 112 | " SELECT * FROM " + (" table1" if x > 0 else [" table2" ]) # query51
495
495
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S608
496
+ 113 |
497
+ 114 | # test cases from #12044
498
+ |
499
+
500
+ S608 .py :117 :12 : S608 Possible SQL injection vector through string - based query construction
501
+ |
502
+ 116 | def query52 ():
503
+ 117 | return f " " "
504
+ | ____________^
505
+ 118 | | SELECT {var }
506
+ 119 | | FROM bar
507
+ 120 | | " " "
508
+ | |_______^ S608
509
+ 121 |
510
+ 122 | def query53 ():
511
+ |
512
+
513
+ S608 .py :123 :12 : S608 Possible SQL injection vector through string - based query construction
514
+ |
515
+ 122 | def query53 ():
516
+ 123 | return f " " "
517
+ | ____________^
518
+ 124 | | SELECT
519
+ 125 | | {var }
520
+ 126 | | FROM bar
521
+ 127 | | " " "
522
+ | |_______^ S608
523
+ 128 |
524
+ 129 | def query54 ():
525
+ |
526
+
527
+ S608 .py :130 :12 : S608 Possible SQL injection vector through string - based query construction
528
+ |
529
+ 129 | def query54 ():
530
+ 130 | return f " " "
531
+ | ____________^
532
+ 131 | | SELECT {var }
533
+ 132 | | FROM
534
+ 133 | | bar
535
+ 134 | | " " "
536
+ | |_______^ S608
537
+ 135 |
538
+ 136 | query55 = f " " " SELECT * FROM
539
+ |
540
+
541
+ S608 .py :136 :11 : S608 Possible SQL injection vector through string - based query construction
542
+ |
543
+ 134 | " " "
544
+ 135 |
545
+ 136 | query55 = f " " " SELECT * FROM
546
+ | ___________ ^
547
+ 137 | | {var }.table
548
+ 138 | | " " "
549
+ | |___^ S608
550
+ 139 |
551
+ 140 | query56 = f " " " SELECT *
552
+ |
553
+
554
+ S608 .py :140 :11 : S608 Possible SQL injection vector through string - based query construction
555
+ |
556
+ 138 | " " "
557
+ 139 |
558
+ 140 | query56 = f " " " SELECT *
559
+ | ___________ ^
560
+ 141 | | FROM {var }.table
561
+ 142 | | " " "
562
+ | |___^ S608
563
+ 143 |
564
+ 144 | query57 = f " " "
565
+ |
566
+
567
+ S608 .py :144 :11 : S608 Possible SQL injection vector through string - based query construction
568
+ |
569
+ 142 | " " "
570
+ 143 |
571
+ 144 | query57 = f " " "
572
+ | ___________^
573
+ 145 | | SELECT *
574
+ 146 | | FROM {var }.table
575
+ 147 | | " " "
576
+ | |___^ S608
577
+ 148 |
578
+ 149 | query57 = f " " "
496
579
|
0 commit comments