@codacy/tools-bandit-1 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ var patterns_default = [
47
47
  category: "Security",
48
48
  severityLevel: "High",
49
49
  title: "Avoid Use of Assert Statements",
50
- enabled: false,
50
+ enabled: true,
51
51
  languages: ["Python"],
52
52
  parameters: []
53
53
  },
@@ -92,7 +92,7 @@ var patterns_default = [
92
92
  category: "Security",
93
93
  severityLevel: "High",
94
94
  title: "Detect Hardcoded Password Function Arguments",
95
- enabled: false,
95
+ enabled: true,
96
96
  languages: ["Python"],
97
97
  parameters: []
98
98
  },
@@ -114,15 +114,6 @@ var patterns_default = [
114
114
  languages: ["Python"],
115
115
  parameters: []
116
116
  },
117
- {
118
- id: "Bandit_B109",
119
- category: "Security",
120
- severityLevel: "Warning",
121
- title: "Detect Password Based Config Options Not Marked Secret",
122
- enabled: true,
123
- languages: ["Python"],
124
- parameters: []
125
- },
126
117
  {
127
118
  id: "Bandit_B110",
128
119
  category: "Security",
@@ -132,15 +123,6 @@ var patterns_default = [
132
123
  languages: ["Python"],
133
124
  parameters: []
134
125
  },
135
- {
136
- id: "Bandit_B111",
137
- category: "Security",
138
- severityLevel: "Warning",
139
- title: "Detect use of rootwrap running as root",
140
- enabled: true,
141
- languages: ["Python"],
142
- parameters: []
143
- },
144
126
  {
145
127
  id: "Bandit_B112",
146
128
  category: "Security",
@@ -252,8 +234,8 @@ var patterns_default = [
252
234
  {
253
235
  id: "Bandit_B309",
254
236
  category: "Security",
255
- severityLevel: "Warning",
256
- title: "Avoid Use of HTTPSConnection on Older Python Versions",
237
+ severityLevel: "High",
238
+ title: "Avoid usage of httplib.http.client HTTPSConnection on old Python versions",
257
239
  enabled: true,
258
240
  languages: ["Python"],
259
241
  parameters: []
@@ -351,8 +333,8 @@ var patterns_default = [
351
333
  {
352
334
  id: "Bandit_B320",
353
335
  category: "Security",
354
- severityLevel: "Warning",
355
- title: "Avoid Using Vulnerable lxml.etree XML Parsing Methods",
336
+ severityLevel: "High",
337
+ title: "Avoid unsafe lxml.etree usage",
356
338
  enabled: true,
357
339
  languages: ["Python"],
358
340
  parameters: []
@@ -370,8 +352,8 @@ var patterns_default = [
370
352
  id: "Bandit_B322",
371
353
  category: "Security",
372
354
  severityLevel: "High",
373
- title: "Avoid using input() in Python 2",
374
- enabled: false,
355
+ title: "Avoid use of input() in Python 2",
356
+ enabled: true,
375
357
  languages: ["Python"],
376
358
  parameters: []
377
359
  },
@@ -380,7 +362,7 @@ var patterns_default = [
380
362
  category: "Security",
381
363
  severityLevel: "Warning",
382
364
  title: "Avoid Using Unverified SSL Context",
383
- enabled: false,
365
+ enabled: true,
384
366
  languages: ["Python"],
385
367
  parameters: []
386
368
  },
@@ -389,16 +371,16 @@ var patterns_default = [
389
371
  category: "Security",
390
372
  severityLevel: "High",
391
373
  title: "Avoid Use of Insecure Hash Functions in hashlib",
392
- enabled: false,
374
+ enabled: true,
393
375
  languages: ["Python"],
394
376
  parameters: []
395
377
  },
396
378
  {
397
379
  id: "Bandit_B325",
398
380
  category: "Security",
399
- severityLevel: "Warning",
400
- title: "Avoid use of os.tempnam() and os.tmpnam()",
401
- enabled: false,
381
+ severityLevel: "High",
382
+ title: "Avoid use of os.tempnam/os.tmpnam",
383
+ enabled: true,
402
384
  languages: ["Python"],
403
385
  parameters: []
404
386
  },
@@ -486,8 +468,8 @@ var patterns_default = [
486
468
  {
487
469
  id: "Bandit_B410",
488
470
  category: "Security",
489
- severityLevel: "Warning",
490
- title: "Avoid Using Vulnerable XML Parsing Libraries (lxml)",
471
+ severityLevel: "High",
472
+ title: "Avoid importing lxml for untrusted XML parsing",
491
473
  enabled: true,
492
474
  languages: ["Python"],
493
475
  parameters: []
@@ -506,7 +488,7 @@ var patterns_default = [
506
488
  category: "Security",
507
489
  severityLevel: "High",
508
490
  title: "Avoid importing CGI handlers vulnerable to httpoxy",
509
- enabled: false,
491
+ enabled: true,
510
492
  languages: ["Python"],
511
493
  parameters: []
512
494
  },
@@ -515,7 +497,7 @@ var patterns_default = [
515
497
  category: "Security",
516
498
  severityLevel: "High",
517
499
  title: "Avoid Importing PyCrypto Library",
518
- enabled: false,
500
+ enabled: true,
519
501
  languages: ["Python"],
520
502
  parameters: []
521
503
  },
@@ -523,8 +505,17 @@ var patterns_default = [
523
505
  id: "Bandit_B414",
524
506
  category: "Security",
525
507
  severityLevel: "High",
526
- title: "Avoid Importing PyCryptodome Modules",
527
- enabled: false,
508
+ title: "Avoid importing pycryptodome (Cryptodome.*)",
509
+ enabled: true,
510
+ languages: ["Python"],
511
+ parameters: []
512
+ },
513
+ {
514
+ id: "Bandit_B415",
515
+ category: "Security",
516
+ severityLevel: "High",
517
+ title: "Avoid importing IPMI-related module (pyghmi)",
518
+ enabled: true,
528
519
  languages: ["Python"],
529
520
  parameters: []
530
521
  },
@@ -587,7 +578,7 @@ var patterns_default = [
587
578
  category: "Security",
588
579
  severityLevel: "High",
589
580
  title: "Avoid Disabling SSH Host Key Verification",
590
- enabled: false,
581
+ enabled: true,
591
582
  languages: ["Python"],
592
583
  parameters: []
593
584
  },
@@ -596,7 +587,7 @@ var patterns_default = [
596
587
  category: "Security",
597
588
  severityLevel: "Warning",
598
589
  title: "Avoid using insecure SNMP versions",
599
- enabled: false,
590
+ enabled: true,
600
591
  languages: ["Python"],
601
592
  parameters: []
602
593
  },
@@ -605,7 +596,7 @@ var patterns_default = [
605
596
  category: "Security",
606
597
  severityLevel: "Warning",
607
598
  title: "Avoid Weak SNMP Cryptography",
608
- enabled: false,
599
+ enabled: true,
609
600
  languages: ["Python"],
610
601
  parameters: []
611
602
  },
@@ -650,7 +641,7 @@ var patterns_default = [
650
641
  category: "Security",
651
642
  severityLevel: "Warning",
652
643
  title: "Avoid starting a process with a shell",
653
- enabled: false,
644
+ enabled: true,
654
645
  languages: ["Python"],
655
646
  parameters: []
656
647
  },
@@ -668,7 +659,7 @@ var patterns_default = [
668
659
  category: "Security",
669
660
  severityLevel: "Warning",
670
661
  title: "Avoid starting a process with a partial executable path",
671
- enabled: false,
662
+ enabled: true,
672
663
  languages: ["Python"],
673
664
  parameters: []
674
665
  },
@@ -695,7 +686,7 @@ var patterns_default = [
695
686
  category: "Security",
696
687
  severityLevel: "Warning",
697
688
  title: "Avoid Potential SQL Injection in Django extra() Function",
698
- enabled: false,
689
+ enabled: true,
699
690
  languages: ["Python"],
700
691
  parameters: []
701
692
  },
@@ -704,7 +695,7 @@ var patterns_default = [
704
695
  category: "Security",
705
696
  severityLevel: "Warning",
706
697
  title: "Avoid Use of RawSQL Function in Django",
707
- enabled: false,
698
+ enabled: true,
708
699
  languages: ["Python"],
709
700
  parameters: []
710
701
  },
@@ -713,10 +704,39 @@ var patterns_default = [
713
704
  category: "Security",
714
705
  severityLevel: "Warning",
715
706
  title: "Avoid insecure use of logging.config.listen",
716
- enabled: false,
707
+ enabled: true,
717
708
  languages: ["Python"],
718
709
  parameters: []
719
710
  },
711
+ {
712
+ id: "Bandit_B613",
713
+ category: "Security",
714
+ severityLevel: "High",
715
+ title: "Detect use of Unicode bidirectional (TrojanSource) control characters",
716
+ enabled: true,
717
+ languages: ["Python"],
718
+ parameters: []
719
+ },
720
+ {
721
+ id: "Bandit_B614",
722
+ category: "Security",
723
+ severityLevel: "High",
724
+ title: "Avoid unsafe PyTorch load",
725
+ enabled: true,
726
+ languages: ["Python"],
727
+ parameters: [],
728
+ tags: ["cwe502"]
729
+ },
730
+ {
731
+ id: "Bandit_B615",
732
+ category: "Security",
733
+ severityLevel: "Warning",
734
+ title: "Avoid unsafe Hugging Face Hub downloads (pin revisions)",
735
+ enabled: true,
736
+ languages: ["Python"],
737
+ parameters: [],
738
+ tags: ["huggingface", "supplychain"]
739
+ },
720
740
  {
721
741
  id: "Bandit_B701",
722
742
  category: "Security",
@@ -740,7 +760,16 @@ var patterns_default = [
740
760
  category: "Security",
741
761
  severityLevel: "Warning",
742
762
  title: "Avoid Potential XSS with django mark_safe Function",
743
- enabled: false,
763
+ enabled: true,
764
+ languages: ["Python"],
765
+ parameters: []
766
+ },
767
+ {
768
+ id: "Bandit_B704",
769
+ category: "Security",
770
+ severityLevel: "High",
771
+ title: "Avoid markupsafe.Markup on untrusted data",
772
+ enabled: true,
744
773
  languages: ["Python"],
745
774
  parameters: []
746
775
  }
@@ -768,7 +797,7 @@ var pattern_mappings_default = {
768
797
  var descriptor = {
769
798
  id: "Bandit",
770
799
  displayName: "Bandit",
771
- preferredVersion: "1.8.3",
800
+ preferredVersion: "1.9.4",
772
801
  languages: ["Python"],
773
802
  filePatterns: ["**/*.py"],
774
803
  supportedOS: ["linux", "darwin", "win32"],
@@ -780,7 +809,7 @@ var descriptor = {
780
809
  // src/adapter.ts
781
810
  var TOOL_ID = "Bandit";
782
811
  var ADAPTER_ID = "bandit-1";
783
- var PIP_PACKAGES = ["bandit==1.8.3"];
812
+ var PIP_PACKAGES = ["bandit==1.9.4"];
784
813
  var PYTHON_VERSION_RANGE = ">=3.8.0 <3.14.0";
785
814
  var PATTERN_META = new Map(
786
815
  patterns_default.map((p) => [
@@ -804,7 +833,14 @@ function mapConfidence(confidence) {
804
833
  return 1;
805
834
  }
806
835
  }
807
- var CONFIG_FILE_CANDIDATES = [".bandit", "bandit.yml", "pyproject.toml"];
836
+ var CONFIG_FILE_CANDIDATES = [
837
+ ".bandit",
838
+ "bandit.yml",
839
+ "pyproject.toml",
840
+ "bandit.yaml",
841
+ "bandit.toml",
842
+ "bandit.ini"
843
+ ];
808
844
  var PYPROJECT_BANDIT_SECTION = /^\[tool\.bandit(\.[\w-]+)*\]/m;
809
845
  async function pyprojectHasBanditSection(pyprojectPath) {
810
846
  try {
@@ -834,7 +870,7 @@ function buildMessage(result) {
834
870
  var adapter = {
835
871
  ...descriptor,
836
872
  patternsMetadata: patterns_default,
837
- compatibleVersions: ">=1.7.0",
873
+ compatibleVersions: ">=1.9.0",
838
874
  website: "https://bandit.readthedocs.io/",
839
875
  prerequisites: [
840
876
  {
@@ -851,7 +887,7 @@ var adapter = {
851
887
  * 1. Codacy-managed venv (`~/.codacy/runtimes/bandit-1/venv/bin/bandit`)
852
888
  * 2. Global PATH (`bandit`)
853
889
  *
854
- * Parses the version from `bandit --version` output like `bandit 1.8.3`.
890
+ * Parses the version from `bandit --version` output like `bandit 1.9.4`.
855
891
  */
856
892
  async checkAvailability(ctx) {
857
893
  ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
@@ -923,7 +959,7 @@ var adapter = {
923
959
  * Installs bandit into an isolated Python virtual environment.
924
960
  *
925
961
  * Uses findPython -> ensureVenv -> pipInstall to create a dedicated venv
926
- * at `~/.codacy/runtimes/bandit-1/venv/` and install `bandit==1.8.3`.
962
+ * at `~/.codacy/runtimes/bandit-1/venv/` and install `bandit==1.9.4`.
927
963
  */
928
964
  async install(ctx) {
929
965
  ctx.logger.info("Starting install", { toolId: TOOL_ID });
@@ -935,7 +971,7 @@ var adapter = {
935
971
  toolId: TOOL_ID,
936
972
  phase: "requirementCheck",
937
973
  kind: "MissingPrerequisite",
938
- message: `Python (${PYTHON_VERSION_RANGE}) could not be found or downloaded. Bandit 1.8.x is incompatible with Python 3.14+.`,
974
+ message: `Python (${PYTHON_VERSION_RANGE}) could not be found or downloaded. Bandit 1.9.x is incompatible with Python 3.14+.`,
939
975
  level: "error"
940
976
  }
941
977
  };
@@ -969,7 +1005,7 @@ var adapter = {
969
1005
  /**
970
1006
  * Checks for bandit configuration files in the repository root.
971
1007
  *
972
- * Looks for `.bandit`, `bandit.yml`, or `pyproject.toml` (in that order).
1008
+ * Looks for `.bandit`, `bandit.yml`, `bandit.yaml`, `bandit.toml`, `bandit.ini`, or `pyproject.toml` (in that order).
973
1009
  * `pyproject.toml` only counts if it actually has a `[tool.bandit]` table —
974
1010
  * unlike the other two candidates, its mere existence says nothing about
975
1011
  * whether Bandit is configured (see {@link pyprojectHasBanditSection}).
@@ -980,7 +1016,7 @@ var adapter = {
980
1016
  const candidatePath = import_path.default.join(ctx.repositoryRoot, candidate);
981
1017
  try {
982
1018
  await import_promises.default.access(candidatePath);
983
- if (candidate === "pyproject.toml" && !await pyprojectHasBanditSection(candidatePath)) {
1019
+ if ((candidate === "pyproject.toml" || candidate === "bandit.toml") && !await pyprojectHasBanditSection(candidatePath)) {
984
1020
  continue;
985
1021
  }
986
1022
  ctx.logger.debug("Found local config", { toolId: TOOL_ID, path: candidatePath });
@@ -1023,7 +1059,7 @@ var adapter = {
1023
1059
  const useLocal = codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile;
1024
1060
  if (useLocal) {
1025
1061
  const configPath = codacyConfig.localConfigurationFile;
1026
- if (configPath.endsWith(".bandit")) {
1062
+ if (configPath.endsWith(".bandit") || configPath.endsWith(".ini")) {
1027
1063
  args.push("--ini", configPath);
1028
1064
  } else {
1029
1065
  args.push("-c", configPath);
package/dist/metadata.js CHANGED
@@ -46,7 +46,7 @@ var pattern_mappings_default = {
46
46
  var descriptor = {
47
47
  id: "Bandit",
48
48
  displayName: "Bandit",
49
- preferredVersion: "1.8.3",
49
+ preferredVersion: "1.9.4",
50
50
  languages: ["Python"],
51
51
  filePatterns: ["**/*.py"],
52
52
  supportedOS: ["linux", "darwin", "win32"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-bandit-1",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Bandit adapter — CLI-mode Python security linter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
- "@codacy/tooling": "0.19.0"
11
+ "@codacy/tooling": "0.20.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",