question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider removing PyCryptodome from blacklist

See original GitHub issue

As the maintainer of PyCryptodome, I have reservations on the library being blacklisted (B414).

Can you help me understand why you think it “has not fully addressed the issues inherent in PyCrypto”?

It shares none of the bugs, and it broke API compatibility with it by dropping the most dangerous ones (such as having ECB as the default cipher mode).

You can certainly shoot yourself in the foot with the low-level primitives, but the same can be achieved with cryptography (which is a great project, no doubts about it).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
Legrandincommented, Sep 11, 2018

Old algorithms are still useful to access, verify and/or import old data (which would be lost otherwise) or interface with old system (say, not so recent embedded hardware).

So, even though I would also like to see only the latest and greatest algorithms being used, I find that approach only works in environments where code updates are cheap and data somewhat volatile (like web services, etc).

Additionally, the threat of people selecting outdated algorithms is probably one order of magnitude less serious than incorrect key generation and management (like using fixed keys and passwords, using bad RNG, storing keys in the clear or not wiping them) or unsafe compositions of otherwise safe algorithms, which are unfortunately more difficult to detect.

All in all, I think it would be more fair for bandit to blacklist individual modules in pycryptodome you feel strongly against (like Crypto.Cipher.DES), as opposed to entire packages. I also just noticed that cryptography too gives you access to weak algorithms (ECB mode, RSAES-PKCS1-v1_5, MD5, SHA1, TDES, etc) but bandit does not warn the user in that case, so that is certainly not showing consistency.

7reactions
Plazmazcommented, Sep 28, 2018

+1. I don’t see why you would blacklist the entire module vs specific unsafe methods and algorithms. Pycryptodome is vastly improved compared to pycrypto, and is an easy transition for systems using pycrypto. Most encryption libraries have some form of support for legacy algorithms, which is just part of the reality of supporting older or legacy systems (as well as migrations from them). It’s definitely worth flagging insecure function usage, but flagging the entire library is an unnecessarily nuclear approach.

EDIT: Also, as related but different isuse, pycryptodome triggers the pycrypto alert when using the Crypto imports (which makes sense)

Read more comments on GitHub >

github_iconTop Results From Across the Web

blacklist_imports — Bandit documentation - Read the Docs
This import blacklist has been removed. The information here has been left for historical purposes. pycryptodome is a direct fork of pycrypto that...
Read more >
Bandit Documentation - Read the Docs
This import blacklist has been removed. The information here has been left for historical purposes. pycryptodome is a direct fork of pycrypto ...
Read more >
blacklist href in python to remove junk sites - Stack Overflow
I want it to print every site that isnt blacklisted(how the code looks so far) but it doesnt work if you change the...
Read more >
Wno-unused-result in _sysconfigdata__darwin_darwin.py ...
I think the question might be how could py3x-cchardet be using the ancient gcc-4.2 and let's fix ... Port: python39 py-pycryptodome added; python36...
Read more >
SUSE Manager Server 4.0
susemanager-doc-indexes: Added new section for bootstrap repository for end of life products in Client Configuration Guide. Remove old certs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found