Flag logging/printing of likely sensitive information

Aperta
#1,371 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

  • #1386 di @qualcuno — chiusa senza merge

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
security

Direzione di ricerca

Non sono identificati file sorgente, test o punti di ingresso. Inizia esaminando le discussioni esistenti nell’issue tracker su “sensitive” e sull’ambito delle chiamate di logging o printing, inclusi nomi di variabili come password e nomi di API-key, nonché API come keyring.get_password(...). Il lavoro sarebbe completo quando sarà disponibile una regola di rilevamento concordata e testata, con un comportamento accettabile rispetto ai falsi positivi.

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

Descrizione

enhancement

Is your feature request related to a problem? Please describe.

It is impossible to flag sensitive information leaks to console logs in the general case (e.g. the debugging call in #201 is just a generic kwargs printer, with no information available at static analysis time to indicate it might be exposed to sensitive information like basic auth passwords or API keys).

However, some information leaks are blatant enough that they do show up under static analysis, as in something like logging.debug("Password: %s", password).

Describe the solution you'd like

A call alert that flags situations where a logging or printing call appears to be directly referencing sensitive information (whether by accessing variables with names like password, credentials, api_key, private_key, etc, or by calling secret retrieval APIs like keyring.get_password(...)).

Describe alternatives you've considered

Brute force regex searches for suspicious looking patterns (this may actually be one of those cases where the additional structure of an AST makes pattern detection for problematic cases harder to formulate)

Additional context

My actual assumption is that this idea has previously been considered and discarded as being far too prone to false positives to be feasible to implement as a general rule outside a specific application or organisational context. I didn't see anything obvious along those lines when searching the issue tracker for "sensitive" though, in which case even a closed issue may serve as a searchable record of the reasoning for not including such a check.


Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

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.