bandit version and documentation reference in pre-commit run

Aperta
#1,280 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia con la riproduzione in .pre-commit-config.yaml ed esegui Bandit sul codice Python che attiva B101. Traccia come viene generato l’URL “More Info” e verifica quale destinazione della documentazione esiste. Il lavoro è completato quando il link segnalato porta alla documentazione appropriata del plugin per la release installata oppure a un fallback valido.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Describe the bug

I use bandit via pre-commit:

  - repo: https://github.com/PyCQA/bandit
    rev: 1.8.5
    hooks:
      - id: bandit

Unfortunately, the help 'More Info: ...' is invalidly referenced (version number!), for example:

Test results:
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimized byte code.
   Severity: Low Confidence: High
   CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
   More Info: https://bandit.readthedocs.io/en/0.0.0/plugins/b101_assert_used.html
   Location: ...
...

Instead of https://bandit.readthedocs.io/en/0.0.0/plugins/b101_assert_used.html you could expect https://bandit.readthedocs.io/en/1.8.5/plugins/b101_assert_used.html here, but unfortunately this also leads to 404.

Reproduction steps
1. use bandit via pre-commit
2. and produce an issue in python code
Expected behavior

'More Info: ...' should link to the correct documentation:

  • Unfortunately there is no documentation for the actual release 1.8.5.
  • Unfortunately there is no documentation for release 1.8.4, too.
  • Linking to the latest documentation may also be an option.
Bandit version

1.8.3 (Default)

Python version

3.12

Additional context

Via .pre-commit-config.yaml I use bandit:

  - repo: https://github.com/PyCQA/bandit
    rev: 1.8.5
    hooks:
      - id: bandit

To get the installed version I run:

$ find ~/.cache/pre-commit/ -iname bandit
...
$ source ~/.cache/pre-commit/repoyk61p6e9/py_env-python3/bin/activate
$ bandit --version
bandit 0.0.0
  python version = 3.12.11 (main, Jun  9 2025, 08:58:11) [GCC 14.2.0]

But it is 1.8.5:

$ (cd ~/.cache/pre-commit/repo5otl2186 && git log | grep commit)
commit 23d269a665abd84597785fdf8fdda04ea89f59f3

Unfortunately I cannot select the bandit version 1.8.5 here.

Lingua principale
Python
Stelle
8.4k
Fork
893
Merge medio
6h 52m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PyCQA/bandit

Tutte le issue di PyCQA/bandit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.