Metrics:
Total lines of code: 8885
Total lines skipped (#nosec): 32

Skipped files:

examples/new_candidates-none.py reason: syntax error while parsing AST from file
examples/nonsense.py reason: syntax error while parsing AST from file
examples/nonsense2.py reason: syntax error while parsing AST from file

assert_used: Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Test ID: B101
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: examples/assert.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/plugins/b101_assert_used.html
1	assert True
hardcoded_bind_all_interfaces: Possible binding to all interfaces.
Test ID: B104
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-605
File: examples/binding.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b104_hardcoded_bind_all_interfaces.html
3	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
4	s.bind(('0.0.0.0', 31137))
5	s.bind(('192.168.0.1', 8080))
blacklist: Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.
Test ID: B305
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/cipher-modes.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
5	# Insecure mode
6	mode = ECB(iv)
7	
blacklist: The pyCrypto library and its module ARC2 are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
1	from Crypto.Cipher import ARC2 as pycrypto_arc2
2	from Crypto.Cipher import ARC4 as pycrypto_arc4
3	from Crypto.Cipher import Blowfish as pycrypto_blowfish
blacklist: The pyCrypto library and its module ARC4 are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
1	from Crypto.Cipher import ARC2 as pycrypto_arc2
2	from Crypto.Cipher import ARC4 as pycrypto_arc4
3	from Crypto.Cipher import Blowfish as pycrypto_blowfish
blacklist: The pyCrypto library and its module Blowfish are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
2	from Crypto.Cipher import ARC4 as pycrypto_arc4
3	from Crypto.Cipher import Blowfish as pycrypto_blowfish
4	from Crypto.Cipher import DES as pycrypto_des
blacklist: The pyCrypto library and its module DES are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
3	from Crypto.Cipher import Blowfish as pycrypto_blowfish
4	from Crypto.Cipher import DES as pycrypto_des
5	from Crypto.Cipher import XOR as pycrypto_xor
blacklist: The pyCrypto library and its module XOR are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
4	from Crypto.Cipher import DES as pycrypto_des
5	from Crypto.Cipher import XOR as pycrypto_xor
6	from Cryptodome.Cipher import ARC2 as pycryptodomex_arc2
blacklist: The pyCrypto library and its module SHA are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
10	from Cryptodome.Cipher import XOR as pycryptodomex_xor
11	from Crypto.Hash import SHA
12	from Crypto import Random
blacklist: The pyCrypto library and its module Random are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
11	from Crypto.Hash import SHA
12	from Crypto import Random
13	from Crypto.Util import Counter
blacklist: The pyCrypto library and its module Counter are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
12	from Crypto import Random
13	from Crypto.Util import Counter
14	from cryptography.hazmat.primitives.ciphers import Cipher
blacklist: Use of insecure cipher Crypto.Cipher.ARC2.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
21	iv = Random.new().read(pycrypto_arc2.block_size)
22	cipher = pycrypto_arc2.new(key, pycrypto_arc2.MODE_CFB, iv)
23	msg = iv + cipher.encrypt(b'Attack at dawn')
blacklist: Use of insecure cipher Cryptodome.Cipher.ARC2.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
23	msg = iv + cipher.encrypt(b'Attack at dawn')
24	cipher = pycryptodomex_arc2.new(key, pycryptodomex_arc2.MODE_CFB, iv)
25	msg = iv + cipher.encrypt(b'Attack at dawn')
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
28	nonce = Random.new().read(16)
29	tempkey = SHA.new(key+nonce).digest()
30	cipher = pycrypto_arc4.new(tempkey)
blacklist: Use of insecure cipher Crypto.Cipher.ARC4.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
29	tempkey = SHA.new(key+nonce).digest()
30	cipher = pycrypto_arc4.new(tempkey)
31	msg = nonce + cipher.encrypt(b'Open the pod bay doors, HAL')
blacklist: Use of insecure cipher Cryptodome.Cipher.ARC4.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
31	msg = nonce + cipher.encrypt(b'Open the pod bay doors, HAL')
32	cipher = pycryptodomex_arc4.new(tempkey)
33	msg = nonce + cipher.encrypt(b'Open the pod bay doors, HAL')
blacklist: Use of insecure cipher Crypto.Cipher.Blowfish.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 42
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
41	bs = pycrypto_blowfish.block_size
42	cipher = pycrypto_blowfish.new(key, pycrypto_blowfish.MODE_CBC, iv)
43	msg = iv + cipher.encrypt(plaintext + padding)
blacklist: Use of insecure cipher Cryptodome.Cipher.Blowfish.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 45
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
44	bs = pycryptodomex_blowfish.block_size
45	cipher = pycryptodomex_blowfish.new(key, pycryptodomex_blowfish.MODE_CBC, iv)
46	msg = iv + cipher.encrypt(plaintext + padding)
blacklist: Use of insecure cipher Crypto.Cipher.DES.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 52
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
51	ctr = Counter.new(pycrypto_des.block_size*8/2, prefix=nonce)
52	cipher = pycrypto_des.new(key, pycrypto_des.MODE_CTR, counter=ctr)
53	msg = nonce + cipher.encrypt(plaintext)
blacklist: Use of insecure cipher Cryptodome.Cipher.DES.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 56
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
55	ctr = Counter.new(pycryptodomex_des.block_size*8/2, prefix=nonce)
56	cipher = pycryptodomex_des.new(key, pycryptodomex_des.MODE_CTR, counter=ctr)
57	msg = nonce + cipher.encrypt(plaintext)
blacklist: Use of insecure cipher Crypto.Cipher.XOR.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 61
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
60	plaintext = b'Encrypt me'
61	cipher = pycrypto_xor.new(key)
62	msg = cipher.encrypt(plaintext)
blacklist: Use of insecure cipher Cryptodome.Cipher.XOR.new. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 63
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
62	msg = cipher.encrypt(plaintext)
63	cipher = pycryptodomex_xor.new(key)
64	msg = cipher.encrypt(plaintext)
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.ARC4. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 66
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
65	
66	cipher = Cipher(algorithms.ARC4(key), mode=None, backend=default_backend())
67	encryptor = cipher.encryptor()
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.Blowfish. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 70
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
69	
70	cipher = Cipher(algorithms.Blowfish(key), mode=None, backend=default_backend())
71	encryptor = cipher.encryptor()
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.CAST5. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 74
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
73	
74	cipher = Cipher(algorithms.CAST5(key), mode=None, backend=default_backend())
75	encryptor = cipher.encryptor()
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.IDEA. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 78
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
77	
78	cipher = Cipher(algorithms.IDEA(key), mode=None, backend=default_backend())
79	encryptor = cipher.encryptor()
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.SEED. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 82
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
81	
82	cipher = Cipher(algorithms.SEED(key), mode=None, backend=default_backend())
83	encryptor = cipher.encryptor()
blacklist: Use of insecure cipher cryptography.hazmat.primitives.ciphers.algorithms.TripleDES. Replace with a known secure cipher such as AES.
Test ID: B304
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ciphers.py
Line number: 86
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b304-b305-ciphers-and-modes
85	
86	cipher = Cipher(algorithms.TripleDES(key), mode=None, backend=default_backend())
87	encryptor = cipher.encryptor()
blacklist: The pyCrypto library and its module MD2 are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
1	from cryptography.hazmat.primitives import hashes
2	from Crypto.Hash import MD2 as pycrypto_md2
3	from Crypto.Hash import MD4 as pycrypto_md4
blacklist: The pyCrypto library and its module MD4 are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
2	from Crypto.Hash import MD2 as pycrypto_md2
3	from Crypto.Hash import MD4 as pycrypto_md4
4	from Crypto.Hash import MD5 as pycrypto_md5
blacklist: The pyCrypto library and its module MD5 are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
3	from Crypto.Hash import MD4 as pycrypto_md4
4	from Crypto.Hash import MD5 as pycrypto_md5
5	from Crypto.Hash import SHA as pycrypto_sha
blacklist: The pyCrypto library and its module SHA are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
4	from Crypto.Hash import MD5 as pycrypto_md5
5	from Crypto.Hash import SHA as pycrypto_sha
6	from Cryptodome.Hash import MD2 as pycryptodomex_md2
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
12	
13	hashlib.md5(1)
14	hashlib.md5(1).hexdigest()
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
13	hashlib.md5(1)
14	hashlib.md5(1).hexdigest()
15	
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
15	
16	abc = str.replace(hashlib.md5("1"), "###")
17	
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
17	
18	print(hashlib.md5("1"))
19	
hashlib: Use of weak SHA1 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 20
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
19	
20	hashlib.sha1(1)
21	
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
23	
24	pycrypto_md2.new()
25	pycrypto_md4.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 25
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
24	pycrypto_md2.new()
25	pycrypto_md4.new()
26	pycrypto_md5.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
25	pycrypto_md4.new()
26	pycrypto_md5.new()
27	pycrypto_sha.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
26	pycrypto_md5.new()
27	pycrypto_sha.new()
28	
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
28	
29	pycryptodomex_md2.new()
30	pycryptodomex_md4.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
29	pycryptodomex_md2.new()
30	pycryptodomex_md4.new()
31	pycryptodomex_md5.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
30	pycryptodomex_md4.new()
31	pycryptodomex_md5.new()
32	pycryptodomex_sha.new()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
31	pycryptodomex_md5.new()
32	pycryptodomex_sha.new()
33	
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 34
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
33	
34	hashes.MD5()
35	hashes.SHA1()
blacklist: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Test ID: B303
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 35
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b303-md5
34	hashes.MD5()
35	hashes.SHA1()
36	
hashlib: Use of insecure crypt.METHOD_CRYPT hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
36	
37	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_CRYPT)
38	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_MD5)
hashlib: Use of insecure crypt.METHOD_MD5 hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
37	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_CRYPT)
38	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_MD5)
39	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_BLOWFISH)
hashlib: Use of insecure crypt.METHOD_BLOWFISH hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 39
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
38	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_MD5)
39	crypt.crypt("asdfasdfasdfasdf", salt=crypt.METHOD_BLOWFISH)
40	crypt.crypt("asdfasdfasdfasdf")
hashlib: Use of insecure crypt.METHOD_CRYPT hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 44
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
43	
44	crypt.mksalt(crypt.METHOD_CRYPT)
45	crypt.mksalt(crypt.METHOD_MD5)
hashlib: Use of insecure crypt.METHOD_MD5 hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 45
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
44	crypt.mksalt(crypt.METHOD_CRYPT)
45	crypt.mksalt(crypt.METHOD_MD5)
46	crypt.mksalt(crypt.METHOD_BLOWFISH)
hashlib: Use of insecure crypt.METHOD_BLOWFISH hash function.
Test ID: B324
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-327
File: examples/crypto-md5.py
Line number: 46
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
45	crypt.mksalt(crypt.METHOD_MD5)
46	crypt.mksalt(crypt.METHOD_BLOWFISH)
47	crypt.mksalt()
blacklist: Consider possible security implications associated with dill module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/dill.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	import dill
2	import io
3	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/dill.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
5	pick = dill.dumps({'a': 'b', 'c': 'd'})
6	print(dill.loads(pick))
7	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/dill.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
10	file_obj.seek(0)
11	print(dill.load(file_obj))
12	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/dill.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
13	file_obj.seek(0)
14	print(dill.Unpickler(file_obj).load())
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
11	
12	User.objects.filter(username='admin').extra(dict(could_be='insecure'))
13	User.objects.filter(username='admin').extra(select=dict(could_be='insecure'))
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
12	User.objects.filter(username='admin').extra(dict(could_be='insecure'))
13	User.objects.filter(username='admin').extra(select=dict(could_be='insecure'))
14	query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --'
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
14	query = '"username") AS "username", * FROM "auth_user" WHERE 1=1 OR "username"=? --'
15	User.objects.filter(username='admin').extra(select={'test': query})
16	User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'})
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
15	User.objects.filter(username='admin').extra(select={'test': query})
16	User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'})
17	User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')})
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
16	User.objects.filter(username='admin').extra(select={'test': '%secure' % 'nos'})
17	User.objects.filter(username='admin').extra(select={'test': '{}secure'.format('nos')})
18	
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 20
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
19	where_var = ['1=1) OR 1=1 AND (1=1']
20	User.objects.filter(username='admin').extra(where=where_var)
21	where_str = '1=1) OR 1=1 AND (1=1'
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
21	where_str = '1=1) OR 1=1 AND (1=1'
22	User.objects.filter(username='admin').extra(where=[where_str])
23	User.objects.filter(username='admin').extra(where=['%secure' % 'nos'])
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
22	User.objects.filter(username='admin').extra(where=[where_str])
23	User.objects.filter(username='admin').extra(where=['%secure' % 'nos'])
24	User.objects.filter(username='admin').extra(where=['{}secure'.format('no')])
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
23	User.objects.filter(username='admin').extra(where=['%secure' % 'nos'])
24	User.objects.filter(username='admin').extra(where=['{}secure'.format('no')])
25	
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
26	tables_var = ['django_content_type" WHERE "auth_user"."username"="admin']
27	User.objects.all().extra(tables=tables_var).distinct()
28	tables_str = 'django_content_type" WHERE "auth_user"."username"="admin'
django_extra_used: Use of extra potential SQL attack vector.
Test ID: B610
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_extra.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/plugins/b610_django_extra_used.html
28	tables_str = 'django_content_type" WHERE "auth_user"."username"="admin'
29	User.objects.all().extra(tables=[tables_str]).distinct()
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
4	User.objects.annotate(val=RawSQL('secure', []))
5	User.objects.annotate(val=RawSQL('%secure' % 'nos', []))
6	User.objects.annotate(val=RawSQL('{}secure'.format('no'), []))
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
5	User.objects.annotate(val=RawSQL('%secure' % 'nos', []))
6	User.objects.annotate(val=RawSQL('{}secure'.format('no'), []))
7	raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --'
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
7	raw = '"username") AS "val" FROM "auth_user" WHERE "username"="admin" --'
8	User.objects.annotate(val=RawSQL(raw, []))
9	raw = '"username") AS "val" FROM "auth_user"' \
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
10	      ' WHERE "username"="admin" OR 1=%s --'
11	User.objects.annotate(val=RawSQL(raw, [0]))
12	User.objects.annotate(val=RawSQL(sql='{}secure'.format('no'), params=[]))
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
11	User.objects.annotate(val=RawSQL(raw, [0]))
12	User.objects.annotate(val=RawSQL(sql='{}secure'.format('no'), params=[]))
13	User.objects.annotate(val=RawSQL(params=[], sql='{}secure'.format('no')))
django_rawsql_used: Use of RawSQL potential SQL attack vector.
Test ID: B611
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/django_sql_injection_raw.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b611_django_rawsql_used.html
12	User.objects.annotate(val=RawSQL(sql='{}secure'.format('no'), params=[]))
13	User.objects.annotate(val=RawSQL(params=[], sql='{}secure'.format('no')))
blacklist: Use of possibly insecure function - consider using safer ast.literal_eval.
Test ID: B307
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-78
File: examples/eval.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b307-eval
2	
3	print(eval("1+1"))
4	print(eval("os.getcwd()"))
blacklist: Use of possibly insecure function - consider using safer ast.literal_eval.
Test ID: B307
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-78
File: examples/eval.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b307-eval
3	print(eval("1+1"))
4	print(eval("os.getcwd()"))
5	print(eval("os.chmod('%s', 0777)" % 'test.txt'))
blacklist: Use of possibly insecure function - consider using safer ast.literal_eval.
Test ID: B307
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-78
File: examples/eval.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b307-eval
4	print(eval("os.getcwd()"))
5	print(eval("os.chmod('%s', 0777)" % 'test.txt'))
6	
exec_used: Use of exec detected.
Test ID: B102
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-78
File: examples/exec.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/plugins/b102_exec_used.html
1	exec("do evil")
flask_debug_true: A Flask app appears to be run with debug=True, which exposes the Werkzeug debugger and allows the execution of arbitrary code.
Test ID: B201
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-94
File: examples/flask_debug.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b201_flask_debug_true.html
9	#bad
10	app.run(debug=True)
11	
blacklist: A FTP-related module is being imported. FTP is considered insecure. Use SSH/SFTP/SCP or some other encrypted protocol.
Test ID: B402
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/ftplib.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b402-import-ftplib
1	from ftplib import FTP
2	from ftplib import FTP_TLS
3	
blacklist: A FTP-related module is being imported. FTP is considered insecure. Use SSH/SFTP/SCP or some other encrypted protocol.
Test ID: B402
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/ftplib.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b402-import-ftplib
1	from ftplib import FTP
2	from ftplib import FTP_TLS
3	
blacklist: FTP-related functions are being called. FTP is considered insecure. Use SSH/SFTP/SCP or some other encrypted protocol.
Test ID: B321
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/ftplib.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b321-ftplib
5	# bad
6	ftp = FTP('ftp.debian.org')
7	ftp.login()
hardcoded_password_string: Possible hardcoded password: 'class_password'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
3	class SomeClass:
4	    password = "class_password"
5	
hardcoded_password_default: Possible hardcoded password: 'Admin'
Test ID: B107
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b107_hardcoded_password_default.html
7	# Severity: Low   Confidence: Medium
8	def someFunction(user, password="Admin"):
9	    print("Hi " + user)
10	
hardcoded_password_string: Possible hardcoded password: 'root'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
13	    # Severity: Low   Confidence: Medium
14	    if password == "root":
15	        print("OK, logged in")
hardcoded_password_string: Possible hardcoded password: ''
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 20
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
19	    # Severity: Low   Confidence: Medium
20	    if password == '':
21	        print("No password!")
hardcoded_password_string: Possible hardcoded password: 'ajklawejrkl42348swfgkg'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
25	    # Severity: Low   Confidence: Medium
26	    if password == "ajklawejrkl42348swfgkg":
27	        print("Nice password!")
hardcoded_password_string: Possible hardcoded password: 'this cool password'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 33
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
32	    # Severity: Low   Confidence: Medium
33	    if obj.password == "this cool password":
34	        print(obj.password)
hardcoded_password_default: Possible hardcoded password: 'blerg'
Test ID: B107
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b107_hardcoded_password_default.html
37	# Severity: Low   Confidence: Medium
38	def doLogin(password="blerg"):
39	    pass
40	
hardcoded_password_funcarg: Possible hardcoded password: 'blerg'
Test ID: B106
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 46
More info: https://bandit.readthedocs.io/en/X/plugins/b106_hardcoded_password_funcarg.html
45	# Severity: Low   Confidence: Medium
46	doLogin(password="blerg")
47	
hardcoded_password_string: Possible hardcoded password: 'blerg'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 50
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
49	# Severity: Low   Confidence: Medium
50	password = "blerg"
51	
hardcoded_password_string: Possible hardcoded password: 'blerg'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
53	# Severity: Low   Confidence: Medium
54	password["password"] = "blerg"
55	
hardcoded_password_string: Possible hardcoded password: 'secret'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 58
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
57	# Severity: Low   Confidence: Medium
58	EMAIL_PASSWORD = "secret"
59	
hardcoded_password_string: Possible hardcoded password: 'emails_secret'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 62
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
61	# Severity: Low   Confidence: Medium
62	email_pwd = 'emails_secret'
63	
hardcoded_password_string: Possible hardcoded password: 'd6s$f9g!j8mg7hw?n&2'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 66
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
65	# Severity: Low   Confidence: Medium
66	my_secret_password_for_email = 'd6s$f9g!j8mg7hw?n&2'
67	
hardcoded_password_string: Possible hardcoded password: '1234'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 70
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
69	# Severity: Low   Confidence: Medium
70	passphrase='1234'
71	
hardcoded_password_string: Possible hardcoded password: 'pass'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 94
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
93	# https://github.com/PyCQA/bandit/issues/313
94	log({"server": server, "password": 'pass', "user": user})
95	
hardcoded_password_string: Possible hardcoded password: '12345'
Test ID: B105
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/hardcoded-passwords.py
Line number: 102
More info: https://bandit.readthedocs.io/en/X/plugins/b105_hardcoded_password_string.html
101	# https://github.com/PyCQA/bandit/issues/1267
102	info = {"password": "12345"}
103	
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: examples/hardcoded-tmp.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/plugins/b108_hardcoded_tmp_directory.html
1	with open('/tmp/abc', 'w') as f:
2	    f.write('def')
3	
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: examples/hardcoded-tmp.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b108_hardcoded_tmp_directory.html
7	
8	with open('/var/tmp/123', 'w') as f:
9	    f.write('def')
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: examples/hardcoded-tmp.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b108_hardcoded_tmp_directory.html
10	
11	with open('/dev/shm/unit/test', 'w') as f:
12	    f.write('def')
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
2	
3	hashlib.new('md5')
4	
hashlib: Use of weak MD4 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
4	
5	hashlib.new('md4', b'test')
6	
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
6	
7	hashlib.new(name='md5', data=b'test')
8	
hashlib: Use of weak MD4 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
8	
9	hashlib.new('MD4', data=b'test')
10	
hashlib: Use of weak SHA1 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
10	
11	hashlib.new('sha1')
12	
hashlib: Use of weak SHA1 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
12	
13	hashlib.new('sha1', data=b'test')
14	
hashlib: Use of weak SHA hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
14	
15	hashlib.new('sha', data=b'test')
16	
hashlib: Use of weak SHA hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
16	
17	hashlib.new(name='SHA', data=b'test')
18	
hashlib: Use of weak SHA1 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/hashlib_new_insecure_functions.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
18	
19	hashlib.new('sha1', usedforsecurity=True)
20	
blacklist: Consider possible security implications associated with wsgiref.handlers.CGIHandler module.
Test ID: B412
Severity: HIGH
Confidence: HIGH
CWE: CWE-284
File: examples/httpoxy_cgihandler.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b412-import-httpoxy
9	if __name__ == '__main__':
10	    wsgiref.handlers.CGIHandler().run(application)
blacklist: Consider possible security implications associated with twisted.web.twcgi.CGIDirectory module.
Test ID: B412
Severity: HIGH
Confidence: HIGH
CWE: CWE-284
File: examples/httpoxy_twisted_directory.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b412-import-httpoxy
4	root = static.File("/root")
5	root.putChild("cgi-bin", twcgi.CGIDirectory("/var/www/cgi-bin"))
6	reactor.listenTCP(80, server.Site(root))
blacklist: Consider possible security implications associated with twisted.web.twcgi.CGIScript module.
Test ID: B412
Severity: HIGH
Confidence: HIGH
CWE: CWE-284
File: examples/httpoxy_twisted_script.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b412-import-httpoxy
4	root = static.File("/root")
5	root.putChild("login.cgi", twcgi.CGIScript("/var/www/cgi-bin/login.py"))
6	reactor.listenTCP(80, server.Site(root))
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
9	# Example #1: No revision (defaults to floating 'main')
10	unsafe_model_no_revision = AutoModel.from_pretrained("org/model_name")
11	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
12	# Example #2: Floating revision: 'main'
13	unsafe_model_main = AutoModel.from_pretrained(
14	    "org/model_name",
15	    revision="main"
16	)
17	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
18	# Example #3: Floating tag revision: 'v1.0.0'
19	unsafe_model_tag = AutoModel.from_pretrained(
20	    "org/model_name",
21	    revision="v1.0.0"
22	)
23	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 28
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
27	# Example #4: No revision
28	unsafe_tokenizer_no_revision = AutoTokenizer.from_pretrained("org/model_name")
29	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
30	# Example #5: Floating revision: 'main'
31	unsafe_tokenizer_main = AutoTokenizer.from_pretrained(
32	    "org/model_name",
33	    revision="main"
34	)
35	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
36	# Example #6: Floating tag revision: 'v1.0.0'
37	unsafe_tokenizer_tag = AutoTokenizer.from_pretrained(
38	    "org/model_name",
39	    revision="v1.0.0"
40	)
41	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in load_dataset()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 46
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
45	# Example #8: No revision
46	unsafe_dataset_no_revision = load_dataset("org_dataset")
47	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in load_dataset()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 49
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
48	# Example #9: Floating revision: 'main'
49	unsafe_dataset_main = load_dataset("org_dataset", revision="main")
50	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in load_dataset()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 52
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
51	# Example #10: Floating tag revision: 'v1.0.0'
52	unsafe_dataset_tag = load_dataset("org_dataset", revision="v1.0.0")
53	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in hf_hub_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 58
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
57	# Example #11: No revision
58	unsafe_file_no_revision = hf_hub_download(
59	    repo_id="org/model_name",
60	    filename="config.json"
61	)
62	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in hf_hub_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 64
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
63	# Example #12: Floating revision: 'main'
64	unsafe_file_main = hf_hub_download(
65	    repo_id="org/model_name",
66	    filename="config.json",
67	    revision="main"
68	)
69	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in hf_hub_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 71
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
70	# Example #13: Floating tag revision: 'v1.0.0'
71	unsafe_file_tag = hf_hub_download(
72	    repo_id="org/model_name",
73	    filename="config.json",
74	    revision="v1.0.0"
75	)
76	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in snapshot_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 81
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
80	# Example #14: No revision
81	unsafe_snapshot_no_revision = snapshot_download(repo_id="org/model_name")
82	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in snapshot_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 84
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
83	# Example #15: Floating revision: 'main'
84	unsafe_snapshot_main = snapshot_download(
85	    repo_id="org/model_name",
86	    revision="main"
87	)
88	
huggingface_unsafe_download: Unsafe Hugging Face Hub download without revision pinning in snapshot_download()
Test ID: B615
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-494
File: examples/huggingface_unsafe_download.py
Line number: 90
More info: https://bandit.readthedocs.io/en/X/plugins/b615_huggingface_unsafe_download.html
89	# Example #16: Floating tag revision: 'v1.0.0'
90	unsafe_snapshot_tag = snapshot_download(
91	    repo_id="org/model_name",
92	    revision="v1.0.0"
93	)
94	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-aliases.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	from subprocess import Popen as pop
2	import hashlib as h
3	import hashlib as hh
blacklist: Consider possible security implications associated with loads module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/imports-aliases.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
5	import hashlib as hhhh
6	from pickle import loads as lp
7	import pickle as p
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/imports-aliases.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
6	from pickle import loads as lp
7	import pickle as p
8	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-aliases.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
8	
9	pop('/bin/gcc --version', shell=True)
10	
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/imports-aliases.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
10	
11	h.md5('1')
12	hh.md5('2')
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/imports-aliases.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
11	h.md5('1')
12	hh.md5('2')
13	hhh.md5('3').hexdigest()
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/imports-aliases.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
12	hh.md5('2')
13	hhh.md5('3').hexdigest()
14	hhhh.md5('4')
hashlib: Use of weak MD5 hash for security. Consider usedforsecurity=False
Test ID: B324
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/imports-aliases.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b324_hashlib.html
13	hhh.md5('3').hexdigest()
14	hhhh.md5('4')
15	lp({'key': 'value'})
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/imports-aliases.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
14	hhhh.md5('4')
15	lp({'key': 'value'})
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-from.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	from subprocess import Popen
2	
3	from ..foo import sys
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-from.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
5	from .. import sys
6	from .. import subprocess
7	from ..subprocess import Popen
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-from.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
6	from .. import subprocess
7	from ..subprocess import Popen
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/imports-function.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	os = __import__("os")
2	pickle = __import__("pickle")
3	sys = __import__("sys")
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-function.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
3	sys = __import__("sys")
4	subprocess = __import__("subprocess")
5	
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/imports-with-importlib.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
2	a = importlib.import_module('os')
3	b = importlib.import_module('pickle')
4	c = importlib.__import__('sys')
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-with-importlib.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
4	c = importlib.__import__('sys')
5	d = importlib.__import__('subprocess')
6	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-with-importlib.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
12	g = importlib.import_module(name='sys')
13	h = importlib.__import__(name='subprocess')
14	i = importlib.import_module(name='subprocess', package='bar.baz')
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports-with-importlib.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
13	h = importlib.__import__(name='subprocess')
14	i = importlib.import_module(name='subprocess', package='bar.baz')
15	j = importlib.__import__(name='sys', package='bar.baz')
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/imports.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	import os
2	import pickle
3	import sys
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/imports.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
3	import sys
4	import subprocess
jinja2_autoescape_false: Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
Test ID: B701
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-94
File: examples/jinja2_templating.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b701_jinja2_autoescape_false.html
8	        loader=templateLoader )
9	Environment(loader=templateLoader, load=templateLoader, autoescape=something)
10	templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader )
jinja2_autoescape_false: Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
Test ID: B701
Severity: HIGH
Confidence: HIGH
CWE: CWE-94
File: examples/jinja2_templating.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b701_jinja2_autoescape_false.html
9	Environment(loader=templateLoader, load=templateLoader, autoescape=something)
10	templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader )
11	Environment(loader=templateLoader,
jinja2_autoescape_false: Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
Test ID: B701
Severity: HIGH
Confidence: HIGH
CWE: CWE-94
File: examples/jinja2_templating.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b701_jinja2_autoescape_false.html
10	templateEnv = jinja2.Environment(autoescape=False, loader=templateLoader )
11	Environment(loader=templateLoader,
12	            load=templateLoader,
13	            autoescape=False)
14	
jinja2_autoescape_false: By default, jinja2 sets autoescape to False. Consider using autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
Test ID: B701
Severity: HIGH
Confidence: HIGH
CWE: CWE-94
File: examples/jinja2_templating.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b701_jinja2_autoescape_false.html
14	
15	Environment(loader=templateLoader,
16	            load=templateLoader)
17	
jinja2_autoescape_false: Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
Test ID: B701
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-94
File: examples/jinja2_templating.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/plugins/b701_jinja2_autoescape_false.html
28	    return 'foobar'
29	Environment(loader=templateLoader, autoescape=fake_func())
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/jsonpickle.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
5	
6	print(jsonpickle.decode(pick))
7	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/jsonpickle.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
7	
8	print(jsonpickle.unpickler.decode(pick))
9	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/jsonpickle.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
9	
10	print(jsonpickle.unpickler.Unpickler().restore(pick))
logging_config_insecure_listen: Use of insecure logging.config.listen detected.
Test ID: B612
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-94
File: examples/logging_config_insecure_listen.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b612_logging_config_insecure_listen.html
2	
3	t = logging.config.listen(9999)
use_of_mako_templates: Mako templates allow HTML/JS rendering by default and are inherently open to XSS attacks. Ensure variables in all templates are properly sanitized via the 'n', 'h' or 'x' flags (depending on context). For example, to HTML escape the variable 'data' do ${ data |h }.
Test ID: B702
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mako_templating.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b702_use_of_mako_templates.html
5	
6	Template("hello")
7	
use_of_mako_templates: Mako templates allow HTML/JS rendering by default and are inherently open to XSS attacks. Ensure variables in all templates are properly sanitized via the 'n', 'h' or 'x' flags (depending on context). For example, to HTML escape the variable 'data' do ${ data |h }.
Test ID: B702
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mako_templating.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b702_use_of_mako_templates.html
9	# in for now so that if it gets fixed inadvertitently we know.
10	mako.template.Template("hern")
11	template.Template("hern")
use_of_mako_templates: Mako templates allow HTML/JS rendering by default and are inherently open to XSS attacks. Ensure variables in all templates are properly sanitized via the 'n', 'h' or 'x' flags (depending on context). For example, to HTML escape the variable 'data' do ${ data |h }.
Test ID: B702
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mako_templating.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b702_use_of_mako_templates.html
10	mako.template.Template("hern")
11	template.Template("hern")
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
3	mystr = '<b>Hello World</b>'
4	mystr = safestring.mark_safe(mystr)
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
9	my_insecure_str = insecure_function('insecure', cls='" onload="alert(\'xss\')')
10	safestring.mark_safe(my_insecure_str)
11	safestring.SafeText(my_insecure_str)
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
9	my_insecure_str = insecure_function('insecure', cls='" onload="alert(\'xss\')')
10	safestring.mark_safe(my_insecure_str)
11	safestring.SafeText(my_insecure_str)
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
10	safestring.mark_safe(my_insecure_str)
11	safestring.SafeText(my_insecure_str)
12	safestring.SafeUnicode(my_insecure_str)
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
11	safestring.SafeText(my_insecure_str)
12	safestring.SafeUnicode(my_insecure_str)
13	safestring.SafeString(my_insecure_str)
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
12	safestring.SafeUnicode(my_insecure_str)
13	safestring.SafeString(my_insecure_str)
14	safestring.SafeBytes(my_insecure_str)
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
13	safestring.SafeString(my_insecure_str)
14	safestring.SafeBytes(my_insecure_str)
15	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
21	        my_insecure_str = 'Secure'
22	    safestring.mark_safe(my_insecure_str)
23	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
21	        my_insecure_str = 'Secure'
22	    safestring.mark_safe(my_insecure_str)
23	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
29	        my_insecure_str = insecure_function('insecure', cls=cls)
30	    safestring.mark_safe(my_insecure_str)
31	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
29	        my_insecure_str = insecure_function('insecure', cls=cls)
30	    safestring.mark_safe(my_insecure_str)
31	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
40	        my_insecure_str = insecure_function('insecure', cls=cls)
41	    safestring.mark_safe(my_insecure_str)
42	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
40	        my_insecure_str = insecure_function('insecure', cls=cls)
41	    safestring.mark_safe(my_insecure_str)
42	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
53	        my_insecure_str = insecure_function('insecure', cls=cls)
54	    safestring.mark_safe(my_insecure_str)
55	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
53	        my_insecure_str = insecure_function('insecure', cls=cls)
54	    safestring.mark_safe(my_insecure_str)
55	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 59
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
58	    my_insecure_str = insecure_function('insecure', cls=cls)
59	    safestring.mark_safe('<b>{} {}</b>'.format(my_insecure_str, 'STR'))
60	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 59
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
58	    my_insecure_str = insecure_function('insecure', cls=cls)
59	    safestring.mark_safe('<b>{} {}</b>'.format(my_insecure_str, 'STR'))
60	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 64
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
63	    my_insecure_str = insecure_function('insecure', cls=cls)
64	    safestring.mark_safe('<b>{}</b>'.format(*[my_insecure_str]))
65	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 64
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
63	    my_insecure_str = insecure_function('insecure', cls=cls)
64	    safestring.mark_safe('<b>{}</b>'.format(*[my_insecure_str]))
65	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 69
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
68	    my_insecure_str = insecure_function('insecure', cls=cls)
69	    safestring.mark_safe('<b>{b}</b>'.format(b=my_insecure_str))
70	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 69
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
68	    my_insecure_str = insecure_function('insecure', cls=cls)
69	    safestring.mark_safe('<b>{b}</b>'.format(b=my_insecure_str))
70	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 74
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
73	    my_insecure_str = insecure_function('insecure', cls=cls)
74	    safestring.mark_safe('<b>{b}</b>'.format(**{'b': my_insecure_str}))
75	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 74
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
73	    my_insecure_str = insecure_function('insecure', cls=cls)
74	    safestring.mark_safe('<b>{b}</b>'.format(**{'b': my_insecure_str}))
75	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 79
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
78	    my_insecure_str = insecure_function('insecure', cls=cls)
79	    safestring.mark_safe('<b>%s</b>' % my_insecure_str)
80	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 79
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
78	    my_insecure_str = insecure_function('insecure', cls=cls)
79	    safestring.mark_safe('<b>%s</b>' % my_insecure_str)
80	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 84
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
83	    my_insecure_str = insecure_function('insecure', cls=cls)
84	    safestring.mark_safe('<b>%s %s</b>' % (my_insecure_str, 'b'))
85	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 84
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
83	    my_insecure_str = insecure_function('insecure', cls=cls)
84	    safestring.mark_safe('<b>%s %s</b>' % (my_insecure_str, 'b'))
85	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 89
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
88	    my_insecure_str = insecure_function('insecure', cls=cls)
89	    safestring.mark_safe('<b>%(b)s</b>' % {'b': my_insecure_str})
90	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 89
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
88	    my_insecure_str = insecure_function('insecure', cls=cls)
89	    safestring.mark_safe('<b>%(b)s</b>' % {'b': my_insecure_str})
90	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 94
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
93	    import sre_constants
94	    safestring.mark_safe(sre_constants.ANY)
95	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 94
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
93	    import sre_constants
94	    safestring.mark_safe(sre_constants.ANY)
95	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 99
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
98	    import sre_constants.ANY as any_str
99	    safestring.mark_safe(any_str)
100	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 99
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
98	    import sre_constants.ANY as any_str
99	    safestring.mark_safe(any_str)
100	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 104
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
103	    from sre_constants import ANY
104	    safestring.mark_safe(ANY)
105	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 104
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
103	    from sre_constants import ANY
104	    safestring.mark_safe(ANY)
105	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 109
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
108	    from sre_constants import ANY as any_str
109	    safestring.mark_safe(any_str)
110	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 109
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
108	    from sre_constants import ANY as any_str
109	    safestring.mark_safe(any_str)
110	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 114
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
113	    with open(path) as f:
114	        safestring.mark_safe(f.read())
115	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 114
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
113	    with open(path) as f:
114	        safestring.mark_safe(f.read())
115	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 119
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
118	    with open(path) as f:
119	        safestring.mark_safe(f)
120	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 119
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
118	    with open(path) as f:
119	        safestring.mark_safe(f)
120	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 126
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
125	        my_secure_str += insecure_function('insecure', cls='" onload="alert(\'xss\')')
126	    safestring.mark_safe(my_secure_str)
127	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 126
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
125	        my_secure_str += insecure_function('insecure', cls='" onload="alert(\'xss\')')
126	    safestring.mark_safe(my_secure_str)
127	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 133
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
132	        my_secure_str += insecure_function('insecure', cls='" onload="alert(\'xss\')')
133	    safestring.mark_safe(my_secure_str)
134	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 133
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
132	        my_secure_str += insecure_function('insecure', cls='" onload="alert(\'xss\')')
133	    safestring.mark_safe(my_secure_str)
134	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 143
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
142	        my_secure_str = 'Secure'
143	    safestring.mark_safe(my_secure_str)
144	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 143
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
142	        my_secure_str = 'Secure'
143	    safestring.mark_safe(my_secure_str)
144	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 149
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
148	def test_insecure_shadow():  # var assigned out of scope
149	    safestring.mark_safe(mystr)
150	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 149
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
148	def test_insecure_shadow():  # var assigned out of scope
149	    safestring.mark_safe(mystr)
150	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 153
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
152	def test_insecure(str_arg):
153	    safestring.mark_safe(str_arg)
154	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 153
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
152	def test_insecure(str_arg):
153	    safestring.mark_safe(str_arg)
154	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 159
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
158	        str_arg = 'could be insecure'
159	    safestring.mark_safe(str_arg)
160	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 159
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
158	        str_arg = 'could be insecure'
159	    safestring.mark_safe(str_arg)
160	
django_mark_safe: Potential XSS on mark_safe function.
Test ID: B703
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-80
File: examples/mark_safe_insecure.py
Line number: 167
More info: https://bandit.readthedocs.io/en/X/plugins/b703_django_mark_safe.html
166	    text, url = choice(HTML_CHOICES)
167	    safestring.mark_safe('<a href="{0}">{1}</a>'.format(url, text))
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_insecure.py
Line number: 167
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
166	    text, url = choice(HTML_CHOICES)
167	    safestring.mark_safe('<a href="{0}">{1}</a>'.format(url, text))
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
3	
4	safestring.mark_safe('<b>secure</b>')
5	safestring.SafeText('<b>secure</b>')
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
10	my_secure_str = '<b>Hello World</b>'
11	safestring.mark_safe(my_secure_str)
12	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
13	my_secure_str, _ = ('<b>Hello World</b>', '')
14	safestring.mark_safe(my_secure_str)
15	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
16	also_secure_str = my_secure_str
17	safestring.mark_safe(also_secure_str)
18	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
28	        my_secure_str = 'Secure'
29	    safestring.mark_safe(my_secure_str)
30	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 33
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
32	def format_secure():
33	    safestring.mark_safe('<b>{}</b>'.format('secure'))
34	    my_secure_str = 'secure'
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 35
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
34	    my_secure_str = 'secure'
35	    safestring.mark_safe('<b>{}</b>'.format(my_secure_str))
36	    safestring.mark_safe('<b>{} {}</b>'.format(my_secure_str, 'a'))
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 36
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
35	    safestring.mark_safe('<b>{}</b>'.format(my_secure_str))
36	    safestring.mark_safe('<b>{} {}</b>'.format(my_secure_str, 'a'))
37	    safestring.mark_safe('<b>{} {}</b>'.format(*[my_secure_str, 'a']))
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
36	    safestring.mark_safe('<b>{} {}</b>'.format(my_secure_str, 'a'))
37	    safestring.mark_safe('<b>{} {}</b>'.format(*[my_secure_str, 'a']))
38	    safestring.mark_safe('<b>{b}</b>'.format(b=my_secure_str))  # nosec TODO
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
40	    my_secure_str = '<b>{}</b>'.format(my_secure_str)
41	    safestring.mark_safe(my_secure_str)
42	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 45
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
44	def percent_secure():
45	    safestring.mark_safe('<b>%s</b>' % 'secure')
46	    my_secure_str = 'secure'
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 47
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
46	    my_secure_str = 'secure'
47	    safestring.mark_safe('<b>%s</b>' % my_secure_str)
48	    safestring.mark_safe('<b>%s %s</b>' % (my_secure_str, 'a'))
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 48
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
47	    safestring.mark_safe('<b>%s</b>' % my_secure_str)
48	    safestring.mark_safe('<b>%s %s</b>' % (my_secure_str, 'a'))
49	    safestring.mark_safe('<b>%(b)s</b>' % {'b': my_secure_str})  # nosec TODO
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
53	    with open(path) as f:
54	        safestring.mark_safe('Secure')
55	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 62
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
61	        my_secure_str += ' Secure'
62	    safestring.mark_safe(my_secure_str)
63	    while ord(os.urandom(1)) % 2 == 0:
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 65
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
64	        my_secure_str += ' Secure'
65	    safestring.mark_safe(my_secure_str)
66	
blacklist: Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Test ID: B308
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/mark_safe_secure.py
Line number: 75
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b308-mark-safe
74	        my_secure_str = 'Secure'
75	    safestring.mark_safe(my_secure_str)
markupsafe_markup_xss: Potential XSS with ``markupsafe.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
4	content = "<script>alert('Hello, world!')</script>"
5	Markup(f"unsafe {content}")  # B704
6	flask.Markup("unsafe {}".format(content))  # B704
markupsafe_markup_xss: Potential XSS with ``flask.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
5	Markup(f"unsafe {content}")  # B704
6	flask.Markup("unsafe {}".format(content))  # B704
7	Markup("safe {}").format(content)
markupsafe_markup_xss: Potential XSS with ``markupsafe.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
9	escape(content)
10	Markup(content)  # B704
11	flask.Markup("unsafe %s" % content)  # B704
markupsafe_markup_xss: Potential XSS with ``flask.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
10	Markup(content)  # B704
11	flask.Markup("unsafe %s" % content)  # B704
12	Markup(object="safe")
markupsafe_markup_xss: Potential XSS with ``markupsafe.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss_allowed_calls.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
4	content = "<script>alert('Hello, world!')</script>"
5	Markup(clean(content))
6	
markupsafe_markup_xss: Potential XSS with ``markupsafe.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss_allowed_calls.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
8	cleaned = clean(content)
9	Markup(cleaned)
markupsafe_markup_xss: Potential XSS with ``markupsafe.Markup`` detected. Do not use ``Markup`` on untrusted data.
Test ID: B704
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-79
File: examples/markupsafe_markup_xss_extend_markup_names.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b704_markupsafe_markup_xss.html
4	content = "<script>alert('Hello, world!')</script>"
5	Markup(f"unsafe {content}")
6	literal(f"unsafe {content}")
blacklist: Deserialization with the marshal module is possibly dangerous.
Test ID: B302
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/marshal_deserialize.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b302-marshal
5	serialized = marshal.dumps({'a': 1})
6	print(marshal.loads(serialized))
7	
blacklist: Deserialization with the marshal module is possibly dangerous.
Test ID: B302
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/marshal_deserialize.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b302-marshal
10	file_obj.seek(0)
11	print(marshal.load(file_obj))
12	file_obj.close()
blacklist: Use of insecure and deprecated function (mktemp).
Test ID: B306
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-377
File: examples/mktemp.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b306-mktemp-q
6	
7	mktemp(foo)
8	tempfile.mktemp('foo')
blacklist: Use of insecure and deprecated function (mktemp).
Test ID: B306
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-377
File: examples/mktemp.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b306-mktemp-q
7	mktemp(foo)
8	tempfile.mktemp('foo')
9	mt(foo)
blacklist: Use of insecure and deprecated function (mktemp).
Test ID: B306
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-377
File: examples/mktemp.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b306-mktemp-q
8	tempfile.mktemp('foo')
9	mt(foo)
10	tmp.mktemp(foo)
blacklist: Use of insecure and deprecated function (mktemp).
Test ID: B306
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-377
File: examples/mktemp.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b306-mktemp-q
9	mt(foo)
10	tmp.mktemp(foo)
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/multiline_statement.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	import subprocess
2	
3	subprocess.check_output("/some_command",
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/multiline_statement.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
4	                        "args",
5	                        shell=True,
6	                        universal_newlines=True)
7	
8	subprocess.check_output(
9	    "/some_command",
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/multiline_statement.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
10	    "args",
11	    shell=True,
12	    universal_newlines=True
13	)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/new_candidates-all.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
6	    # candidate #1
7	    subprocess.Popen('/bin/ls *', shell=True)
8	    # candidate #2
yaml_load: Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().
Test ID: B506
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/new_candidates-all.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b506_yaml_load.html
14	    # candidate #3
15	    y = yaml.load(temp_str)
16	    # candidate #4
blacklist: Using xml.sax.make_parser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.make_parser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/new_candidates-all.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
21	    # candidate #5
22	    xml.sax.make_parser()
23	    # candidate #6
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/new_candidates-some.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
6	    # candidate #1
7	    subprocess.Popen('/bin/ls *', shell=True)
8	    # candidate #2
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
5	ssh_client = client.SSHClient()
6	ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
7	ssh_client.set_missing_host_key_policy(client.WarningPolicy)
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
6	ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
7	ssh_client.set_missing_host_key_policy(client.WarningPolicy)
8	ssh_client.set_missing_host_key_policy(client.AutoAddPolicy())
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
7	ssh_client.set_missing_host_key_policy(client.WarningPolicy)
8	ssh_client.set_missing_host_key_policy(client.AutoAddPolicy())
9	ssh_client.set_missing_host_key_policy(client.WarningPolicy())
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
8	ssh_client.set_missing_host_key_policy(client.AutoAddPolicy())
9	ssh_client.set_missing_host_key_policy(client.WarningPolicy())
10	
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
10	
11	ssh_client.set_missing_host_key_policy(AutoAddPolicy)
12	ssh_client.set_missing_host_key_policy(WarningPolicy)
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
11	ssh_client.set_missing_host_key_policy(AutoAddPolicy)
12	ssh_client.set_missing_host_key_policy(WarningPolicy)
13	ssh_client.set_missing_host_key_policy(AutoAddPolicy())
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
12	ssh_client.set_missing_host_key_policy(WarningPolicy)
13	ssh_client.set_missing_host_key_policy(AutoAddPolicy())
14	ssh_client.set_missing_host_key_policy(WarningPolicy())
ssh_no_host_key_verification: Paramiko call with policy set to automatically trust the unknown host key.
Test ID: B507
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-295
File: examples/no_host_key_verification.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b507_ssh_no_host_key_verification.html
13	ssh_client.set_missing_host_key_policy(AutoAddPolicy())
14	ssh_client.set_missing_host_key_policy(WarningPolicy())
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/nosec.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b607_start_process_with_partial_path.html
8	                 shell=True)  #nosec (on the specific kwarg line)
9	subprocess.Popen('#nosec', shell=True)
10	subprocess.Popen('/bin/ls *', shell=True) # type: ... # nosec # noqa: E501 ; pylint: disable=line-too-long
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/nosec.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
8	                 shell=True)  #nosec (on the specific kwarg line)
9	subprocess.Popen('#nosec', shell=True)
10	subprocess.Popen('/bin/ls *', shell=True) # type: ... # nosec # noqa: E501 ; pylint: disable=line-too-long
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/nosec.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
10	subprocess.Popen('/bin/ls *', shell=True) # type: ... # nosec # noqa: E501 ; pylint: disable=line-too-long
11	subprocess.Popen('/bin/ls *', shell=True) # type: ... # nosec B607 # noqa: E501 ; pylint: disable=line-too-long
12	subprocess.Popen('/bin/ls *', shell=True)  #nosec subprocess_popen_with_shell_equals_true (on the line)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/nosec.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
16	subprocess.Popen('/bin/ls *', shell=True) # type: ... # noqa: E501 ; pylint: disable=line-too-long # nosec
17	subprocess.Popen('#nosec', shell=True) # nosec B607, B101
18	subprocess.Popen('#nosec', shell=True) # nosec B602, subprocess_popen_with_shell_equals_true
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/nosec.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b607_start_process_with_partial_path.html
17	subprocess.Popen('#nosec', shell=True) # nosec B607, B101
18	subprocess.Popen('#nosec', shell=True) # nosec B602, subprocess_popen_with_shell_equals_true
set_bad_file_permissions: Chmod setting a permissive mask 0o227 on file (/etc/passwd).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
5	
6	os.chmod('/etc/passwd', 0o227)
7	os.chmod('/etc/passwd', 0o7)
set_bad_file_permissions: Chmod setting a permissive mask 0o7 on file (/etc/passwd).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
6	os.chmod('/etc/passwd', 0o227)
7	os.chmod('/etc/passwd', 0o7)
8	os.chmod('/etc/passwd', 0o664)
set_bad_file_permissions: Chmod setting a permissive mask 0o664 on file (/etc/passwd).
Test ID: B103
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
7	os.chmod('/etc/passwd', 0o7)
8	os.chmod('/etc/passwd', 0o664)
9	os.chmod('/etc/passwd', 0o777)
set_bad_file_permissions: Chmod setting a permissive mask 0o777 on file (/etc/passwd).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
8	os.chmod('/etc/passwd', 0o664)
9	os.chmod('/etc/passwd', 0o777)
10	os.chmod('/etc/passwd', 0o770)
set_bad_file_permissions: Chmod setting a permissive mask 0o770 on file (/etc/passwd).
Test ID: B103
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
9	os.chmod('/etc/passwd', 0o777)
10	os.chmod('/etc/passwd', 0o770)
11	os.chmod('/etc/passwd', 0o776)
set_bad_file_permissions: Chmod setting a permissive mask 0o776 on file (/etc/passwd).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
10	os.chmod('/etc/passwd', 0o770)
11	os.chmod('/etc/passwd', 0o776)
12	os.chmod('/etc/passwd', 0o760)
set_bad_file_permissions: Chmod setting a permissive mask 0o760 on file (/etc/passwd).
Test ID: B103
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
11	os.chmod('/etc/passwd', 0o776)
12	os.chmod('/etc/passwd', 0o760)
13	os.chmod('~/.bashrc', 511)
set_bad_file_permissions: Chmod setting a permissive mask 0o777 on file (~/.bashrc).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
12	os.chmod('/etc/passwd', 0o760)
13	os.chmod('~/.bashrc', 511)
14	os.chmod('/etc/hosts', 0o777)
set_bad_file_permissions: Chmod setting a permissive mask 0o777 on file (/etc/hosts).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
13	os.chmod('~/.bashrc', 511)
14	os.chmod('/etc/hosts', 0o777)
15	os.chmod('/tmp/oh_hai', 0x0)
set_bad_file_permissions: Chmod setting a permissive mask 0o777 on file (/tmp/oh_hai).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
14	os.chmod('/etc/hosts', 0o777)
15	os.chmod('/tmp/oh_hai', 0x0)
16	os.chmod('/etc/passwd', stat.S_IRWXU)
hardcoded_tmp_directory: Probable insecure usage of temp file/directory.
Test ID: B108
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-377
File: examples/os-chmod.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b108_hardcoded_tmp_directory.html
14	os.chmod('/etc/hosts', 0o777)
15	os.chmod('/tmp/oh_hai', 0x0)
16	os.chmod('/etc/passwd', stat.S_IRWXU)
set_bad_file_permissions: Chmod setting a permissive mask 0o777 on file (keyfile).
Test ID: B103
Severity: HIGH
Confidence: HIGH
CWE: CWE-732
File: examples/os-chmod.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b103_set_bad_file_permissions.html
16	os.chmod('/etc/passwd', stat.S_IRWXU)
17	os.chmod(keyfile, 0o777)
18	os.chmod('~/hidden_exec', stat.S_IXGRP)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
2	
3	os.execl(path, arg0, arg1)
4	os.execle(path, arg0, arg1, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
3	os.execl(path, arg0, arg1)
4	os.execle(path, arg0, arg1, env)
5	os.execlp(file, arg0, arg1)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
4	os.execle(path, arg0, arg1, env)
5	os.execlp(file, arg0, arg1)
6	os.execlpe(file, arg0, arg1, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
5	os.execlp(file, arg0, arg1)
6	os.execlpe(file, arg0, arg1, env)
7	os.execv(path, args)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
6	os.execlpe(file, arg0, arg1, env)
7	os.execv(path, args)
8	os.execve(path, args, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
7	os.execv(path, args)
8	os.execve(path, args, env)
9	os.execvp(file, args)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
8	os.execve(path, args, env)
9	os.execvp(file, args)
10	os.execvpe(file, args, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-exec.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
9	os.execvp(file, args)
10	os.execvpe(file, args, env)
11	
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
5	
6	os.popen('/bin/uname -av')
7	popen('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
6	os.popen('/bin/uname -av')
7	popen('/bin/uname -av')
8	o.popen('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
7	popen('/bin/uname -av')
8	o.popen('/bin/uname -av')
9	pos('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
8	o.popen('/bin/uname -av')
9	pos('/bin/uname -av')
10	os.popen2('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
9	pos('/bin/uname -av')
10	os.popen2('/bin/uname -av')
11	os.popen3('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
10	os.popen2('/bin/uname -av')
11	os.popen3('/bin/uname -av')
12	os.popen4('/bin/uname -av')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
11	os.popen3('/bin/uname -av')
12	os.popen4('/bin/uname -av')
13	
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
13	
14	os.popen4('/bin/uname -av; rm -rf /')
15	os.popen4(some_var)
start_process_with_a_shell: Starting a process with a shell, possible injection detected, security issue.
Test ID: B605
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/os-popen.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
14	os.popen4('/bin/uname -av; rm -rf /')
15	os.popen4(some_var)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
2	
3	os.spawnl(mode, path)
4	os.spawnle(mode, path, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
3	os.spawnl(mode, path)
4	os.spawnle(mode, path, env)
5	os.spawnlp(mode, file)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
4	os.spawnle(mode, path, env)
5	os.spawnlp(mode, file)
6	os.spawnlpe(mode, file, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
5	os.spawnlp(mode, file)
6	os.spawnlpe(mode, file, env)
7	os.spawnv(mode, path, args)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
6	os.spawnlpe(mode, file, env)
7	os.spawnv(mode, path, args)
8	os.spawnve(mode, path, args, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
7	os.spawnv(mode, path, args)
8	os.spawnve(mode, path, args, env)
9	os.spawnvp(mode, file, args)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
8	os.spawnve(mode, path, args, env)
9	os.spawnvp(mode, file, args)
10	os.spawnvpe(mode, file, args, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-spawn.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
9	os.spawnvp(mode, file, args)
10	os.spawnvpe(mode, file, args, env)
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-startfile.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
2	
3	os.startfile('/bin/foo.docx')
4	os.startfile('/bin/bad.exe')
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-startfile.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
3	os.startfile('/bin/foo.docx')
4	os.startfile('/bin/bad.exe')
5	os.startfile('/bin/text.txt')
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/os-startfile.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
4	os.startfile('/bin/bad.exe')
5	os.startfile('/bin/text.txt')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/os_system.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
2	
3	os.system('/bin/echo hi')
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/pandas_read_pickle.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	import pickle
2	import pandas as pd
3	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pandas_read_pickle.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
11	
12	print(pd.read_pickle(pick))
paramiko_calls: Possible shell injection via Paramiko call, check inputs are properly sanitized.
Test ID: B601
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-78
File: examples/paramiko_injection.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b601_paramiko_calls.html
6	# this is not safe
7	client.exec_command('something; really; unsafe')
8	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	from subprocess import Popen as pop
2	
3	pop('gcc --version', shell=False)
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b607_start_process_with_partial_path.html
2	
3	pop('gcc --version', shell=False)
4	pop('/bin/gcc --version', shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
2	
3	pop('gcc --version', shell=False)
4	pop('/bin/gcc --version', shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
3	pop('gcc --version', shell=False)
4	pop('/bin/gcc --version', shell=False)
5	pop(var, shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
4	pop('/bin/gcc --version', shell=False)
5	pop(var, shell=False)
6	
start_process_with_partial_path: Starting a process with a partial executable path
Test ID: B607
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b607_start_process_with_partial_path.html
6	
7	pop(['ls', '-l'], shell=False)
8	pop(['/bin/ls', '-l'], shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
6	
7	pop(['ls', '-l'], shell=False)
8	pop(['/bin/ls', '-l'], shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
7	pop(['ls', '-l'], shell=False)
8	pop(['/bin/ls', '-l'], shell=False)
9	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
9	
10	pop('../ls -l', shell=False)
11	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
11	
12	pop('c:\\hello\\something', shell=False)
13	pop('c:/hello/something_else', shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/partial_path_process.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
12	pop('c:\\hello\\something', shell=False)
13	pop('c:/hello/something_else', shell=False)
blacklist: Consider possible security implications associated with pickle module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/pickle_deserialize.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	import io
2	import pickle
3	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pickle_deserialize.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
6	pick = pickle.dumps({'a': 'b', 'c': 'd'})
7	print(pickle.loads(pick))
8	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pickle_deserialize.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
11	file_obj.seek(0)
12	print(pickle.load(file_obj))
13	
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pickle_deserialize.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
14	file_obj.seek(0)
15	print(pickle.Unpickler(file_obj).load())
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
4	
5	print(commands.getstatusoutput('/bin/echo / | xargs ls'))
6	print(commands.getoutput('/bin/echo / | xargs ls'))
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
5	print(commands.getstatusoutput('/bin/echo / | xargs ls'))
6	print(commands.getoutput('/bin/echo / | xargs ls'))
7	
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
10	
11	print(popen2.popen2('/bin/echo / | xargs ls')[0].read())
12	print(popen2.popen3('/bin/echo / | xargs ls')[0].read())
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
11	print(popen2.popen2('/bin/echo / | xargs ls')[0].read())
12	print(popen2.popen3('/bin/echo / | xargs ls')[0].read())
13	print(popen2.popen4('/bin/echo / | xargs ls')[0].read())
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
12	print(popen2.popen3('/bin/echo / | xargs ls')[0].read())
13	print(popen2.popen4('/bin/echo / | xargs ls')[0].read())
14	print(popen2.Popen3('/bin/echo / | xargs ls').fromchild.read())
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
13	print(popen2.popen4('/bin/echo / | xargs ls')[0].read())
14	print(popen2.Popen3('/bin/echo / | xargs ls').fromchild.read())
15	print(popen2.Popen4('/bin/echo / | xargs ls').fromchild.read())
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/popen_wrappers.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
14	print(popen2.Popen3('/bin/echo / | xargs ls').fromchild.read())
15	print(popen2.Popen4('/bin/echo / | xargs ls').fromchild.read())
blacklist: The pyCrypto library and its module AES are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/pycrypto.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
1	from Crypto.Cipher import AES
2	from Crypto import Random
3	
blacklist: The pyCrypto library and its module Random are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/pycrypto.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
1	from Crypto.Cipher import AES
2	from Crypto import Random
3	
blacklist: An IPMI-related module is being imported. IPMI is considered insecure. Use an encrypted protocol.
Test ID: B415
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/pyghmi.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b415-import-pyghmi
1	from pyghmi.ipmi import command
2	
3	cmd = command.Command(bmc="bmc",
hardcoded_password_funcarg: Possible hardcoded password: 'ZjE4ZjI0NTE4YmI2NGJjZDliOGY3ZmJiY2UyN2IzODQK'
Test ID: B106
Severity: LOW
Confidence: MEDIUM
CWE: CWE-259
File: examples/pyghmi.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b106_hardcoded_password_funcarg.html
4	                      userid="userid",
5	                      password="ZjE4ZjI0NTE4YmI2NGJjZDliOGY3ZmJiY2UyN2IzODQK")
pytorch_load: Use of unsafe PyTorch load
Test ID: B614
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pytorch_load.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b614_pytorch_load.html
9	loaded_model = models.resnet18()
10	loaded_model.load_state_dict(torch.load('model_weights.pth'))
11	
pytorch_load: Use of unsafe PyTorch load
Test ID: B614
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pytorch_load.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b614_pytorch_load.html
17	unsafe_model = models.resnet18()
18	unsafe_model.load_state_dict(torch.load('model_weights.pth', weights_only=False))
19	
pytorch_load: Use of unsafe PyTorch load
Test ID: B614
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/pytorch_load.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/plugins/b614_pytorch_load.html
21	cpu_model = models.resnet18()
22	cpu_model.load_state_dict(torch.load('model_weights.pth', map_location='cpu'))
23	
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
4	
5	bad = random.Random()
6	bad = random.random()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
5	bad = random.Random()
6	bad = random.random()
7	bad = random.randrange()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
6	bad = random.random()
7	bad = random.randrange()
8	bad = random.randint()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
7	bad = random.randrange()
8	bad = random.randint()
9	bad = random.choice()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
8	bad = random.randint()
9	bad = random.choice()
10	bad = random.choices()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
9	bad = random.choice()
10	bad = random.choices()
11	bad = random.uniform()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
10	bad = random.choices()
11	bad = random.uniform()
12	bad = random.triangular()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
11	bad = random.uniform()
12	bad = random.triangular()
13	bad = random.randbytes()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
12	bad = random.triangular()
13	bad = random.randbytes()
14	bad = random.sample()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
13	bad = random.randbytes()
14	bad = random.sample()
15	bad = random.randrange()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
14	bad = random.sample()
15	bad = random.randrange()
16	bad = random.getrandbits()
blacklist: Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Test ID: B311
Severity: LOW
Confidence: HIGH
CWE: CWE-330
File: examples/random_module.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b311-random
15	bad = random.randrange()
16	bad = random.getrandbits()
17	
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
5	# Errors
6	requests.get('https://gmail.com')
7	requests.get('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
6	requests.get('https://gmail.com')
7	requests.get('https://gmail.com', timeout=None)
8	requests.post('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
7	requests.get('https://gmail.com', timeout=None)
8	requests.post('https://gmail.com')
9	requests.post('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
8	requests.post('https://gmail.com')
9	requests.post('https://gmail.com', timeout=None)
10	requests.put('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
9	requests.post('https://gmail.com', timeout=None)
10	requests.put('https://gmail.com')
11	requests.put('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
10	requests.put('https://gmail.com')
11	requests.put('https://gmail.com', timeout=None)
12	requests.delete('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
11	requests.put('https://gmail.com', timeout=None)
12	requests.delete('https://gmail.com')
13	requests.delete('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
12	requests.delete('https://gmail.com')
13	requests.delete('https://gmail.com', timeout=None)
14	requests.patch('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
13	requests.delete('https://gmail.com', timeout=None)
14	requests.patch('https://gmail.com')
15	requests.patch('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
14	requests.patch('https://gmail.com')
15	requests.patch('https://gmail.com', timeout=None)
16	requests.options('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
15	requests.patch('https://gmail.com', timeout=None)
16	requests.options('https://gmail.com')
17	requests.options('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
16	requests.options('https://gmail.com')
17	requests.options('https://gmail.com', timeout=None)
18	requests.head('https://gmail.com')
request_without_timeout: Call to requests without timeout
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
17	requests.options('https://gmail.com', timeout=None)
18	requests.head('https://gmail.com')
19	requests.head('https://gmail.com', timeout=None)
request_without_timeout: Call to requests with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
18	requests.head('https://gmail.com')
19	requests.head('https://gmail.com', timeout=None)
20	httpx.get('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 21
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
20	httpx.get('https://gmail.com')
21	httpx.get('https://gmail.com', timeout=None)
22	httpx.post('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
22	httpx.post('https://gmail.com')
23	httpx.post('https://gmail.com', timeout=None)
24	httpx.put('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 25
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
24	httpx.put('https://gmail.com')
25	httpx.put('https://gmail.com', timeout=None)
26	httpx.delete('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
26	httpx.delete('https://gmail.com')
27	httpx.delete('https://gmail.com', timeout=None)
28	httpx.patch('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
28	httpx.patch('https://gmail.com')
29	httpx.patch('https://gmail.com', timeout=None)
30	httpx.options('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
30	httpx.options('https://gmail.com')
31	httpx.options('https://gmail.com', timeout=None)
32	httpx.head('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 33
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
32	httpx.head('https://gmail.com')
33	httpx.head('https://gmail.com', timeout=None)
34	httpx.Client()
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 35
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
34	httpx.Client()
35	httpx.Client(timeout=None)
36	httpx.AsyncClient()
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
36	httpx.AsyncClient()
37	httpx.AsyncClient(timeout=None)
38	with httpx.Client() as client:
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 40
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
39	    client.get('https://gmail.com')
40	with httpx.Client(timeout=None) as client:
41	    client.get('https://gmail.com')
request_without_timeout: Call to httpx with timeout set to None
Test ID: B113
Severity: MEDIUM
Confidence: LOW
CWE: CWE-400
File: examples/requests-missing-timeout.py
Line number: 44
More info: https://bandit.readthedocs.io/en/X/plugins/b113_request_without_timeout.html
43	    await client.get('https://gmail.com')
44	async with httpx.AsyncClient(timeout=None) as client:
45	    await client.get('https://gmail.com')
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
5	requests.get('https://gmail.com', timeout=30, verify=True)
6	requests.get('https://gmail.com', timeout=30, verify=False)
7	requests.post('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
7	requests.post('https://gmail.com', timeout=30, verify=True)
8	requests.post('https://gmail.com', timeout=30, verify=False)
9	requests.put('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
9	requests.put('https://gmail.com', timeout=30, verify=True)
10	requests.put('https://gmail.com', timeout=30, verify=False)
11	requests.delete('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
11	requests.delete('https://gmail.com', timeout=30, verify=True)
12	requests.delete('https://gmail.com', timeout=30, verify=False)
13	requests.patch('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
13	requests.patch('https://gmail.com', timeout=30, verify=True)
14	requests.patch('https://gmail.com', timeout=30, verify=False)
15	requests.options('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
15	requests.options('https://gmail.com', timeout=30, verify=True)
16	requests.options('https://gmail.com', timeout=30, verify=False)
17	requests.head('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to requests with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
17	requests.head('https://gmail.com', timeout=30, verify=True)
18	requests.head('https://gmail.com', timeout=30, verify=False)
19	
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
21	httpx.request('GET', 'https://gmail.com', timeout=30, verify=True)
22	httpx.request('GET', 'https://gmail.com', timeout=30, verify=False)
23	httpx.get('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
23	httpx.get('https://gmail.com', timeout=30, verify=True)
24	httpx.get('https://gmail.com', timeout=30, verify=False)
25	httpx.options('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
25	httpx.options('https://gmail.com', timeout=30, verify=True)
26	httpx.options('https://gmail.com', timeout=30, verify=False)
27	httpx.head('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 28
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
27	httpx.head('https://gmail.com', timeout=30, verify=True)
28	httpx.head('https://gmail.com', timeout=30, verify=False)
29	httpx.post('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
29	httpx.post('https://gmail.com', timeout=30, verify=True)
30	httpx.post('https://gmail.com', timeout=30, verify=False)
31	httpx.put('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
31	httpx.put('https://gmail.com', timeout=30, verify=True)
32	httpx.put('https://gmail.com', timeout=30, verify=False)
33	httpx.patch('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 34
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
33	httpx.patch('https://gmail.com', timeout=30, verify=True)
34	httpx.patch('https://gmail.com', timeout=30, verify=False)
35	httpx.delete('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 36
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
35	httpx.delete('https://gmail.com', timeout=30, verify=True)
36	httpx.delete('https://gmail.com', timeout=30, verify=False)
37	httpx.stream('https://gmail.com', timeout=30, verify=True)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
37	httpx.stream('https://gmail.com', timeout=30, verify=True)
38	httpx.stream('https://gmail.com', timeout=30, verify=False)
39	httpx.Client(timeout=30)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 40
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
39	httpx.Client(timeout=30)
40	httpx.Client(timeout=30, verify=False)
41	httpx.AsyncClient(timeout=30)
request_with_no_cert_validation: Call to httpx with verify=False disabling SSL certificate checks, security issue.
Test ID: B501
Severity: HIGH
Confidence: HIGH
CWE: CWE-295
File: examples/requests-ssl-verify-disabled.py
Line number: 42
More info: https://bandit.readthedocs.io/en/X/plugins/b501_request_with_no_cert_validation.html
41	httpx.AsyncClient(timeout=30)
42	httpx.AsyncClient(timeout=30, verify=False)
blacklist: Consider possible security implications associated with shelve module.
Test ID: B403
Severity: LOW
Confidence: HIGH
CWE: CWE-502
File: examples/shelve_open.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b403-import-pickle
1	import os
2	import shelve
3	import tempfile
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/shelve_open.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
7	
8	    with shelve.open(filename) as db:
9	        db['spam'] = {'eggs': 'ham'}
blacklist: Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Test ID: B301
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-502
File: examples/shelve_open.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b301-pickle
10	
11	    with shelve.open(filename) as db:
12	        print(db['spam'])
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/skip.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
1	subprocess.call(["/bin/ls", "-l"])
2	subprocess.call(["/bin/ls", "-l"]) #noqa
3	subprocess.call(["/bin/ls", "-l"]) # noqa
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/skip.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
1	subprocess.call(["/bin/ls", "-l"])
2	subprocess.call(["/bin/ls", "-l"]) #noqa
3	subprocess.call(["/bin/ls", "-l"]) # noqa
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/skip.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
2	subprocess.call(["/bin/ls", "-l"]) #noqa
3	subprocess.call(["/bin/ls", "-l"]) # noqa
4	subprocess.call(["/bin/ls", "-l"]) # nosec
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/skip.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
4	subprocess.call(["/bin/ls", "-l"]) # nosec
5	subprocess.call(["/bin/ls", "-l"])
6	subprocess.call(["/bin/ls", "-l"]) #nosec
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/skip.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
6	subprocess.call(["/bin/ls", "-l"]) #nosec
7	subprocess.call(["/bin/ls", "-l"])
snmp_insecure_version_check: The use of SNMPv1 and SNMPv2 is insecure. You should use SNMPv3 if able.
Test ID: B508
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-319
File: examples/snmp.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b508_snmp_insecure_version_check.html
3	# SHOULD FAIL
4	a = CommunityData('public', mpModel=0)
5	# SHOULD FAIL
snmp_crypto_check: You should not use SNMPv3 without encryption. noAuthNoPriv & authNoPriv is insecure
Test ID: B509
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-319
File: examples/snmp.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b509_snmp_crypto_check.html
5	# SHOULD FAIL
6	insecure = UsmUserData("securityName")
7	# SHOULD FAIL
snmp_crypto_check: You should not use SNMPv3 without encryption. noAuthNoPriv & authNoPriv is insecure
Test ID: B509
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-319
File: examples/snmp.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b509_snmp_crypto_check.html
7	# SHOULD FAIL
8	auth_no_priv = UsmUserData("securityName","authName")
9	# SHOULD PASS
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
3	# bad
4	query = """SELECT *
5	FROM foo WHERE id = '%s'""" % identifier
6	query = """INSERT INTO foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
5	FROM foo WHERE id = '%s'""" % identifier
6	query = """INSERT INTO foo
7	VALUES ('a', 'b', '%s')""" % value
8	query = """DELETE FROM foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
7	VALUES ('a', 'b', '%s')""" % value
8	query = """DELETE FROM foo
9	WHERE id = '%s'""" % identifier
10	query = """UPDATE foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
9	WHERE id = '%s'""" % identifier
10	query = """UPDATE foo
11	SET value = 'b'
12	WHERE id = '%s'""" % identifier
13	query = """WITH cte AS (SELECT x FROM foo)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
12	WHERE id = '%s'""" % identifier
13	query = """WITH cte AS (SELECT x FROM foo)
14	SELECT x FROM cte WHERE x = '%s'""" % identifier
15	# bad alternate forms
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
15	# bad alternate forms
16	query = """SELECT *
17	FROM foo
18	WHERE id = '""" + identifier + "'"
19	query = """SELECT *
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
18	WHERE id = '""" + identifier + "'"
19	query = """SELECT *
20	FROM foo
21	WHERE id = '{}'""".format(identifier)
22	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
22	
23	query = f"""
24	SELECT *
25	FROM foo
26	WHERE id = {identifier}
27	"""
28	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
29	# bad
30	cur.execute("""SELECT *
31	FROM foo
32	WHERE id = '%s'""" % identifier)
33	cur.execute("""INSERT INTO foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 33
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
32	WHERE id = '%s'""" % identifier)
33	cur.execute("""INSERT INTO foo
34	VALUES ('a', 'b', '%s')""" % value)
35	cur.execute("""DELETE FROM foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 35
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
34	VALUES ('a', 'b', '%s')""" % value)
35	cur.execute("""DELETE FROM foo
36	WHERE id = '%s'""" % identifier)
37	cur.execute("""UPDATE foo
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
36	WHERE id = '%s'""" % identifier)
37	cur.execute("""UPDATE foo
38	SET value = 'b'
39	WHERE id = '%s'""" % identifier)
40	# bad alternate forms
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
40	# bad alternate forms
41	cur.execute("""SELECT *
42	FROM foo
43	WHERE id = '""" + identifier + "'")
44	cur.execute("""SELECT *
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 44
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
43	WHERE id = '""" + identifier + "'")
44	cur.execute("""SELECT *
45	FROM foo
46	WHERE id = '{}'""".format(identifier))
47	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 49
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
48	# bad with f-string
49	query = f"""
50	SELECT *
51	FROM foo
52	WHERE id = {identifier}
53	"""
54	query = f"""
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
53	"""
54	query = f"""
55	SELECT *
56	FROM foo
57	WHERE id = {identifier}
58	"""
59	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 60
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
59	
60	query = f"""
61	SELECT *
62	FROM foo
63	WHERE id = {identifier}"""
64	query = f"""
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 64
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
63	WHERE id = {identifier}"""
64	query = f"""
65	SELECT *
66	FROM foo
67	WHERE id = {identifier}"""
68	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 69
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
68	
69	cur.execute(f"""
70	SELECT
71	    {column_name}
72	FROM foo
73	WHERE id = 1""")
74	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 75
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
74	
75	cur.execute(f"""
76	SELECT
77	    {a + b}
78	FROM foo
79	WHERE id = 1""")
80	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 81
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
80	
81	cur.execute(f"""
82	INSERT INTO
83	    {table_name}
84	VALUES (1)""")
85	cur.execute(f"""
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 85
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
84	VALUES (1)""")
85	cur.execute(f"""
86	UPDATE {table_name}
87	SET id = 1""")
88	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 90
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
89	# implicit concatenation mixed with f-strings
90	cur.execute("SELECT "
91	            f"{column_name} "
92	            "FROM foo "
93	            "WHERE id = 1"
94	            )
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 95
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
94	            )
95	cur.execute("INSERT INTO "
96	            f"{table_name} "
97	            "VALUES (1)")
98	cur.execute(f"UPDATE {table_name} "
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 98
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
97	            "VALUES (1)")
98	cur.execute(f"UPDATE {table_name} "
99	            "SET id = 1")
100	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_multiline_statements.py
Line number: 122
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
121	
122	a()("""SELECT %s
123	FROM foo""" % val)
124	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
3	# bad
4	query = "SELECT * FROM foo WHERE id = '%s'" % identifier
5	query = "INSERT INTO foo VALUES ('a', 'b', '%s')" % value
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
4	query = "SELECT * FROM foo WHERE id = '%s'" % identifier
5	query = "INSERT INTO foo VALUES ('a', 'b', '%s')" % value
6	query = "INSERT INTO foo VALUES('a', 'b', '%s')" % value
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
5	query = "INSERT INTO foo VALUES ('a', 'b', '%s')" % value
6	query = "INSERT INTO foo VALUES('a', 'b', '%s')" % value
7	query = "DELETE FROM foo WHERE id = '%s'" % identifier
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
6	query = "INSERT INTO foo VALUES('a', 'b', '%s')" % value
7	query = "DELETE FROM foo WHERE id = '%s'" % identifier
8	query = "UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
7	query = "DELETE FROM foo WHERE id = '%s'" % identifier
8	query = "UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier
9	query = """WITH cte AS (SELECT x FROM foo)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
8	query = "UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier
9	query = """WITH cte AS (SELECT x FROM foo)
10	SELECT x FROM cte WHERE x = '%s'""" % identifier
11	# bad alternate forms
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
11	# bad alternate forms
12	query = "SELECT * FROM foo WHERE id = '" + identifier + "'"
13	query = "SELECT * FROM foo WHERE id = '{}'".format(identifier)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
12	query = "SELECT * FROM foo WHERE id = '" + identifier + "'"
13	query = "SELECT * FROM foo WHERE id = '{}'".format(identifier)
14	query = "SELECT * FROM foo WHERE id = '[VALUE]'".replace("[VALUE]", identifier)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
13	query = "SELECT * FROM foo WHERE id = '{}'".format(identifier)
14	query = "SELECT * FROM foo WHERE id = '[VALUE]'".replace("[VALUE]", identifier)
15	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
16	# bad
17	cur.execute("SELECT * FROM foo WHERE id = '%s'" % identifier)
18	cur.execute("INSERT INTO foo VALUES ('a', 'b', '%s')" % value)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
17	cur.execute("SELECT * FROM foo WHERE id = '%s'" % identifier)
18	cur.execute("INSERT INTO foo VALUES ('a', 'b', '%s')" % value)
19	cur.execute("INSERT INTO foo VALUES('a', 'b', '%s')" % value)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
18	cur.execute("INSERT INTO foo VALUES ('a', 'b', '%s')" % value)
19	cur.execute("INSERT INTO foo VALUES('a', 'b', '%s')" % value)
20	cur.execute("DELETE FROM foo WHERE id = '%s'" % identifier)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 20
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
19	cur.execute("INSERT INTO foo VALUES('a', 'b', '%s')" % value)
20	cur.execute("DELETE FROM foo WHERE id = '%s'" % identifier)
21	cur.execute("UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier)
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 21
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
20	cur.execute("DELETE FROM foo WHERE id = '%s'" % identifier)
21	cur.execute("UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier)
22	# bad alternate forms
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
22	# bad alternate forms
23	cur.execute("SELECT * FROM foo WHERE id = '" + identifier + "'")
24	cur.execute("SELECT * FROM foo WHERE id = '{}'".format(identifier))
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
23	cur.execute("SELECT * FROM foo WHERE id = '" + identifier + "'")
24	cur.execute("SELECT * FROM foo WHERE id = '{}'".format(identifier))
25	cur.execute("SELECT * FROM foo WHERE id = '[VALUE]'".replace("[VALUE]", identifier))
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 25
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
24	cur.execute("SELECT * FROM foo WHERE id = '{}'".format(identifier))
25	cur.execute("SELECT * FROM foo WHERE id = '[VALUE]'".replace("[VALUE]", identifier))
26	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 28
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
27	# bad f-strings
28	cur.execute(f"SELECT {column_name} FROM foo WHERE id = 1")
29	cur.execute(f"SELECT {a + b} FROM foo WHERE id = 1")
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
28	cur.execute(f"SELECT {column_name} FROM foo WHERE id = 1")
29	cur.execute(f"SELECT {a + b} FROM foo WHERE id = 1")
30	cur.execute(f"INSERT INTO {table_name} VALUES (1)")
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
29	cur.execute(f"SELECT {a + b} FROM foo WHERE id = 1")
30	cur.execute(f"INSERT INTO {table_name} VALUES (1)")
31	cur.execute(f"INSERT INTO {table_name} VALUES(1)")
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
30	cur.execute(f"INSERT INTO {table_name} VALUES (1)")
31	cur.execute(f"INSERT INTO {table_name} VALUES(1)")
32	cur.execute(f"UPDATE {table_name} SET id = 1")
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-89
File: examples/sql_statements.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
31	cur.execute(f"INSERT INTO {table_name} VALUES(1)")
32	cur.execute(f"UPDATE {table_name} SET id = 1")
33	
hardcoded_sql_expressions: Possible SQL injection vector through string-based query construction.
Test ID: B608
Severity: MEDIUM
Confidence: LOW
CWE: CWE-89
File: examples/sql_statements.py
Line number: 47
More info: https://bandit.readthedocs.io/en/X/plugins/b608_hardcoded_sql_expressions.html
46	
47	a()("SELECT %s FROM foo" % val)
48	
ssl_with_bad_version: ssl.wrap_socket call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
3	
4	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
5	SSL.Context(method=SSL.SSLv2_METHOD)
ssl_with_bad_version: SSL.Context call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
4	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
5	SSL.Context(method=SSL.SSLv2_METHOD)
6	SSL.Context(method=SSL.SSLv23_METHOD)
ssl_with_bad_version: SSL.Context call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
5	SSL.Context(method=SSL.SSLv2_METHOD)
6	SSL.Context(method=SSL.SSLv23_METHOD)
7	
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
7	
8	herp_derp(ssl_version=ssl.PROTOCOL_SSLv2)
9	herp_derp(method=SSL.SSLv2_METHOD)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
8	herp_derp(ssl_version=ssl.PROTOCOL_SSLv2)
9	herp_derp(method=SSL.SSLv2_METHOD)
10	herp_derp(method=SSL.SSLv23_METHOD)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
9	herp_derp(method=SSL.SSLv2_METHOD)
10	herp_derp(method=SSL.SSLv23_METHOD)
11	
ssl_with_bad_version: ssl.wrap_socket call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
12	# strict tests
13	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3)
14	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1)
ssl_with_bad_version: ssl.wrap_socket call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
13	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3)
14	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1)
15	SSL.Context(method=SSL.SSLv3_METHOD)
ssl_with_bad_version: SSL.Context call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
14	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1)
15	SSL.Context(method=SSL.SSLv3_METHOD)
16	SSL.Context(method=SSL.TLSv1_METHOD)
ssl_with_bad_version: SSL.Context call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
15	SSL.Context(method=SSL.SSLv3_METHOD)
16	SSL.Context(method=SSL.TLSv1_METHOD)
17	
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
17	
18	herp_derp(ssl_version=ssl.PROTOCOL_SSLv3)
19	herp_derp(ssl_version=ssl.PROTOCOL_TLSv1)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
18	herp_derp(ssl_version=ssl.PROTOCOL_SSLv3)
19	herp_derp(ssl_version=ssl.PROTOCOL_TLSv1)
20	herp_derp(method=SSL.SSLv3_METHOD)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 20
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
19	herp_derp(ssl_version=ssl.PROTOCOL_TLSv1)
20	herp_derp(method=SSL.SSLv3_METHOD)
21	herp_derp(method=SSL.TLSv1_METHOD)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 21
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
20	herp_derp(method=SSL.SSLv3_METHOD)
21	herp_derp(method=SSL.TLSv1_METHOD)
22	
ssl_with_bad_version: ssl.wrap_socket call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
22	
23	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1_1)
24	SSL.Context(method=SSL.TLSv1_1_METHOD)
ssl_with_bad_version: SSL.Context call with insecure SSL/TLS protocol version identified, security issue.
Test ID: B502
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
23	ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1_1)
24	SSL.Context(method=SSL.TLSv1_1_METHOD)
25	
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
25	
26	herp_derp(ssl_version=ssl.PROTOCOL_TLSv1_1)
27	herp_derp(method=SSL.TLSv1_1_METHOD)
ssl_with_bad_version: Function call with insecure SSL/TLS protocol identified, possible security issue.
Test ID: B502
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/plugins/b502_ssl_with_bad_version.html
26	herp_derp(ssl_version=ssl.PROTOCOL_TLSv1_1)
27	herp_derp(method=SSL.TLSv1_1_METHOD)
28	
ssl_with_no_version: ssl.wrap_socket call with no SSL/TLS protocol version specified, the default SSLv23 could be insecure, possible security issue.
Test ID: B504
Severity: LOW
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b504_ssl_with_no_version.html
29	
30	ssl.wrap_socket()
31	
ssl_with_bad_defaults: Function definition identified with insecure SSL/TLS protocol version by default, possible security issue.
Test ID: B503
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/plugins/b503_ssl_with_bad_defaults.html
31	
32	def open_ssl_socket(version=ssl.PROTOCOL_SSLv2):
33	    pass
34	
ssl_with_bad_defaults: Function definition identified with insecure SSL/TLS protocol version by default, possible security issue.
Test ID: B503
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 35
More info: https://bandit.readthedocs.io/en/X/plugins/b503_ssl_with_bad_defaults.html
34	
35	def open_ssl_socket(version=SSL.SSLv2_METHOD):
36	    pass
37	
ssl_with_bad_defaults: Function definition identified with insecure SSL/TLS protocol version by default, possible security issue.
Test ID: B503
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b503_ssl_with_bad_defaults.html
37	
38	def open_ssl_socket(version=SSL.SSLv23_METHOD):
39	    pass
40	
ssl_with_bad_defaults: Function definition identified with insecure SSL/TLS protocol version by default, possible security issue.
Test ID: B503
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-327
File: examples/ssl-insecure-version.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/plugins/b503_ssl_with_bad_defaults.html
40	
41	def open_ssl_socket(version=SSL.TLSv1_1_METHOD):
42	    pass
43	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	import subprocess
2	from subprocess import Popen as pop
3	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	import subprocess
2	from subprocess import Popen as pop
3	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
10	
11	pop('/bin/gcc --version', shell=True)
12	Popen('/bin/gcc --version', shell=True)
any_other_function_with_shell_equals_true: Function call with shell=True parameter identified, possible security issue.
Test ID: B604
Severity: MEDIUM
Confidence: LOW
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b604_any_other_function_with_shell_equals_true.html
11	pop('/bin/gcc --version', shell=True)
12	Popen('/bin/gcc --version', shell=True)
13	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
13	
14	subprocess.Popen('/bin/gcc --version', shell=True)
15	subprocess.Popen(['/bin/gcc', '--version'], shell=False)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 15
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
14	subprocess.Popen('/bin/gcc --version', shell=True)
15	subprocess.Popen(['/bin/gcc', '--version'], shell=False)
16	subprocess.Popen(['/bin/gcc', '--version'])
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
15	subprocess.Popen(['/bin/gcc', '--version'], shell=False)
16	subprocess.Popen(['/bin/gcc', '--version'])
17	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
17	
18	subprocess.call(["/bin/ls",
19	                 "-l"
20	                 ])
21	subprocess.call('/bin/ls -l', shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 21
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
20	                 ])
21	subprocess.call('/bin/ls -l', shell=True)
22	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
22	
23	subprocess.check_call(['/bin/ls', '-l'], shell=False)
24	subprocess.check_call('/bin/ls -l', shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
23	subprocess.check_call(['/bin/ls', '-l'], shell=False)
24	subprocess.check_call('/bin/ls -l', shell=True)
25	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
25	
26	subprocess.check_output(['/bin/ls', '-l'])
27	subprocess.check_output('/bin/ls -l', shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
26	subprocess.check_output(['/bin/ls', '-l'])
27	subprocess.check_output('/bin/ls -l', shell=True)
28	subprocess.check_output([], stdout=None)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 28
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
27	subprocess.check_output('/bin/ls -l', shell=True)
28	subprocess.check_output([], stdout=None)
29	
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
29	
30	subprocess.getoutput('/bin/ls -l')
31	subprocess.getstatusoutput('/bin/ls -l')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
30	subprocess.getoutput('/bin/ls -l')
31	subprocess.getstatusoutput('/bin/ls -l')
32	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 33
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
32	
33	subprocess.run(['/bin/ls', '-l'])
34	subprocess.run('/bin/ls -l', shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 34
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
33	subprocess.run(['/bin/ls', '-l'])
34	subprocess.run('/bin/ls -l', shell=True)
35	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 36
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
35	
36	subprocess.Popen('/bin/ls *', shell=True)
37	subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 37
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
36	subprocess.Popen('/bin/ls *', shell=True)
37	subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
38	subprocess.Popen('/bin/ls {}'.format('something'), shell=True)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
37	subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
38	subprocess.Popen('/bin/ls {}'.format('something'), shell=True)
39	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 41
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
40	command = "/bin/ls" + unknown_function()
41	subprocess.Popen(command, shell=True)
42	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 43
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
42	
43	subprocess.Popen('/bin/ls && cat /etc/passwd', shell=True)
44	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 46
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
45	command = 'pwd'
46	subprocess.call(command, shell='True')
47	subprocess.call(command, shell='False')
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 47
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
46	subprocess.call(command, shell='True')
47	subprocess.call(command, shell='False')
48	subprocess.call(command, shell='None')
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 48
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
47	subprocess.call(command, shell='False')
48	subprocess.call(command, shell='None')
49	subprocess.call(command, shell=1)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 49
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
48	subprocess.call(command, shell='None')
49	subprocess.call(command, shell=1)
50	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 51
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
50	
51	subprocess.call(command, shell=Popen())
52	subprocess.call(command, shell=[True])
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 52
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
51	subprocess.call(command, shell=Popen())
52	subprocess.call(command, shell=[True])
53	subprocess.call(command, shell={'IS': 'True'})
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 53
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
52	subprocess.call(command, shell=[True])
53	subprocess.call(command, shell={'IS': 'True'})
54	subprocess.call(command, shell=command)
subprocess_popen_with_shell_equals_true: subprocess call with shell=True identified, security issue.
Test ID: B602
Severity: HIGH
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 54
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
53	subprocess.call(command, shell={'IS': 'True'})
54	subprocess.call(command, shell=command)
55	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 56
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
55	
56	subprocess.call(command, shell=False)
57	subprocess.call(command, shell=0)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 57
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
56	subprocess.call(command, shell=False)
57	subprocess.call(command, shell=0)
58	subprocess.call(command, shell=[])
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 58
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
57	subprocess.call(command, shell=0)
58	subprocess.call(command, shell=[])
59	subprocess.call(command, shell={})
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 59
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
58	subprocess.call(command, shell=[])
59	subprocess.call(command, shell={})
60	subprocess.call(command, shell=None)
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/subprocess_shell.py
Line number: 60
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
59	subprocess.call(command, shell={})
60	subprocess.call(command, shell=None)
tarfile_unsafe_members: tarfile.extractall used without any validation. Please check and discard dangerous members.
Test ID: B202
Severity: HIGH
Confidence: HIGH
CWE: CWE-22
File: examples/tarfile_extractall.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b202_tarfile_unsafe_members.html
7	    tar = tarfile.open(filename)
8	    tar.extractall(path=tempfile.mkdtemp())
9	    tar.close()
tarfile_unsafe_members: Usage of tarfile.extractall(members=function(tarfile)). Make sure your function properly discards dangerous members {'Function': 'members_filter'}).
Test ID: B202
Severity: LOW
Confidence: LOW
CWE: CWE-22
File: examples/tarfile_extractall.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b202_tarfile_unsafe_members.html
13	    tar = tarfile.open(filename)
14	    tar.extractall(path=tempfile.mkdtemp(), members=members_filter(tar))
15	    tar.close()
tarfile_unsafe_members: tarfile.extractall used without any validation. Please check and discard dangerous members.
Test ID: B202
Severity: HIGH
Confidence: HIGH
CWE: CWE-22
File: examples/tarfile_extractall.py
Line number: 26
More info: https://bandit.readthedocs.io/en/X/plugins/b202_tarfile_unsafe_members.html
25	    tar = tarfile.open(filename)
26	    tar.extractall(path=tempfile.mkdtemp(), filter="fully_trusted")
27	    tar.close()
tarfile_unsafe_members: Found tarfile.extractall(members=?) but couldn't identify the type of members. Check if the members were properly validated {'Other': }).
Test ID: B202
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-22
File: examples/tarfile_extractall.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/plugins/b202_tarfile_unsafe_members.html
31	    tar = tarfile.open(filename)
32	    tar.extractall(path=tempfile.mkdtemp(), members=[])
33	    tar.close()
tarfile_unsafe_members: Found tarfile.extractall(members=?) but couldn't identify the type of members. Check if the members were properly validated {'Other': 'tar'}).
Test ID: B202
Severity: MEDIUM
Confidence: MEDIUM
CWE: CWE-22
File: examples/tarfile_extractall.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b202_tarfile_unsafe_members.html
37	    tar = tarfile.open(filename)
38	    tarfile.extractall(path=tempfile.mkdtemp(), members=tar)
39	    tar.close()
blacklist: A telnet-related module is being imported. Telnet is considered insecure. Use SSH or some other encrypted protocol.
Test ID: B401
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/telnetlib.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b401-import-telnetlib
1	import telnetlib
2	import getpass
3	
blacklist: Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
Test ID: B312
Severity: HIGH
Confidence: HIGH
CWE: CWE-319
File: examples/telnetlib.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b312-telnetlib
7	password = getpass.getpass()
8	tn = telnetlib.Telnet(host)
9	
trojansource: A Python source file contains bidirectional control characters ('\u202e').
Test ID: B613
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-838
File: examples/trojansource.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b613_trojansource.html
3	access_level = "user"
4	if access_level != 'none‮⁦': # Check if admin ⁩⁦' and access_level != 'user
5	    print("You are an admin.\n")
try_except_continue: Try, Except, Continue detected.
Test ID: B112
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: examples/try_except_continue.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b112_try_except_continue.html
4	        a = i
5	    except:
6	        continue
7	
try_except_continue: Try, Except, Continue detected.
Test ID: B112
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: examples/try_except_continue.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b112_try_except_continue.html
12	        a = 1
13	    except Exception:
14	        continue
15	
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: examples/try_except_pass.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/plugins/b110_try_except_pass.html
3	    a = 1
4	except:
5	    pass
6	
try_except_pass: Try, Except, Pass detected.
Test ID: B110
Severity: LOW
Confidence: HIGH
CWE: CWE-703
File: examples/try_except_pass.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b110_try_except_pass.html
10	    a = 1
11	except Exception:
12	    pass
13	
blacklist: By default, Python will create a secure, verified ssl context for use in such classes as HTTPSConnection. However, it still allows using an insecure context via the _create_unverified_context that reverts to the previous behavior that does not validate certificates or perform hostname checks.
Test ID: B323
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-295
File: examples/unverified_context.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b323-unverified-context
6	# Incorrect: unverified context
7	context = ssl._create_unverified_context()
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 17
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
16	    # Python 3
17	    urllib.request.urlopen('file:///bin/ls')
18	    urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 18
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
17	    urllib.request.urlopen('file:///bin/ls')
18	    urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
19	    opener = urllib.request.URLopener()
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 19
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
18	    urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
19	    opener = urllib.request.URLopener()
20	    opener.open('file:///bin/ls')
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
21	    opener.retrieve('file:///bin/ls')
22	    opener = urllib.request.FancyURLopener()
23	    opener.open('file:///bin/ls')
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 27
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
26	    # Six
27	    six.moves.urllib.request.urlopen('file:///bin/ls')
28	    six.moves.urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 28
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
27	    six.moves.urllib.request.urlopen('file:///bin/ls')
28	    six.moves.urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
29	    opener = six.moves.urllib.request.URLopener()
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 29
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
28	    six.moves.urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2')
29	    opener = six.moves.urllib.request.URLopener()
30	    opener.open('file:///bin/ls')
blacklist: Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Test ID: B310
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-22
File: examples/urlopen.py
Line number: 32
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b310-urllib-urlopen
31	    opener.retrieve('file:///bin/ls')
32	    opener = six.moves.urllib.request.FancyURLopener()
33	    opener.open('file:///bin/ls')
blacklist: The pyCrypto library and its module DSA are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/weak_cryptographic_key_sizes.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
4	from cryptography.hazmat.primitives.asymmetric import rsa
5	from Crypto.PublicKey import DSA as pycrypto_dsa
6	from Crypto.PublicKey import RSA as pycrypto_rsa
blacklist: The pyCrypto library and its module RSA are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
Test ID: B413
Severity: HIGH
Confidence: HIGH
CWE: CWE-327
File: examples/weak_cryptographic_key_sizes.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b413-import-pycrypto
5	from Crypto.PublicKey import DSA as pycrypto_dsa
6	from Crypto.PublicKey import RSA as pycrypto_rsa
7	from Cryptodome.PublicKey import DSA as pycryptodomex_dsa
weak_cryptographic_key: DSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 38
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
37	# Incorrect: weak key sizes
38	dsa.generate_private_key(key_size=1024,
39	                         backend=backends.default_backend())
40	ec.generate_private_key(curve=ec.SECT163R2,
weak_cryptographic_key: EC key sizes below 224 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 40
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
39	                         backend=backends.default_backend())
40	ec.generate_private_key(curve=ec.SECT163R2,
41	                        backend=backends.default_backend())
42	rsa.generate_private_key(public_exponent=65537,
weak_cryptographic_key: RSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 42
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
41	                        backend=backends.default_backend())
42	rsa.generate_private_key(public_exponent=65537,
43	                         key_size=1024,
44	                         backend=backends.default_backend())
45	pycrypto_dsa.generate(bits=1024)
weak_cryptographic_key: DSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 45
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
44	                         backend=backends.default_backend())
45	pycrypto_dsa.generate(bits=1024)
46	pycrypto_rsa.generate(bits=1024)
weak_cryptographic_key: RSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 46
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
45	pycrypto_dsa.generate(bits=1024)
46	pycrypto_rsa.generate(bits=1024)
47	pycryptodomex_dsa.generate(bits=1024)
weak_cryptographic_key: DSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 47
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
46	pycrypto_rsa.generate(bits=1024)
47	pycryptodomex_dsa.generate(bits=1024)
48	pycryptodomex_rsa.generate(bits=1024)
weak_cryptographic_key: RSA key sizes below 2048 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 48
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
47	pycryptodomex_dsa.generate(bits=1024)
48	pycryptodomex_rsa.generate(bits=1024)
49	
weak_cryptographic_key: DSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 51
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
50	# Also incorrect: without keyword args
51	dsa.generate_private_key(512,
52	                         backends.default_backend())
53	ec.generate_private_key(ec.SECT163R2,
weak_cryptographic_key: EC key sizes below 224 bits are considered breakable.
Test ID: B505
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 53
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
52	                         backends.default_backend())
53	ec.generate_private_key(ec.SECT163R2,
54	                        backends.default_backend())
55	rsa.generate_private_key(3,
weak_cryptographic_key: RSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 55
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
54	                        backends.default_backend())
55	rsa.generate_private_key(3,
56	                         512,
57	                         backends.default_backend())
58	pycrypto_dsa.generate(512)
weak_cryptographic_key: DSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 58
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
57	                         backends.default_backend())
58	pycrypto_dsa.generate(512)
59	pycrypto_rsa.generate(512)
weak_cryptographic_key: RSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 59
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
58	pycrypto_dsa.generate(512)
59	pycrypto_rsa.generate(512)
60	pycryptodomex_dsa.generate(512)
weak_cryptographic_key: DSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 60
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
59	pycrypto_rsa.generate(512)
60	pycryptodomex_dsa.generate(512)
61	pycryptodomex_rsa.generate(512)
weak_cryptographic_key: RSA key sizes below 1024 bits are considered breakable.
Test ID: B505
Severity: HIGH
Confidence: HIGH
CWE: CWE-326
File: examples/weak_cryptographic_key_sizes.py
Line number: 61
More info: https://bandit.readthedocs.io/en/X/plugins/b505_weak_cryptographic_key.html
60	pycryptodomex_dsa.generate(512)
61	pycryptodomex_rsa.generate(512)
62	
blacklist: Consider possible security implications associated with the subprocess module.
Test ID: B404
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b404-import-subprocess
1	import os as o
2	import subprocess as subp
3	
linux_commands_wildcard_injection: Possible wildcard injection in call: os.system
Test ID: B609
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-155
File: examples/wildcard-injection.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b609_linux_commands_wildcard_injection.html
4	# Vulnerable to wildcard injection
5	o.system("/bin/tar xvzf *")
6	o.system('/bin/chown *')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 5
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
4	# Vulnerable to wildcard injection
5	o.system("/bin/tar xvzf *")
6	o.system('/bin/chown *')
linux_commands_wildcard_injection: Possible wildcard injection in call: os.system
Test ID: B609
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-155
File: examples/wildcard-injection.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b609_linux_commands_wildcard_injection.html
5	o.system("/bin/tar xvzf *")
6	o.system('/bin/chown *')
7	o.popen2('/bin/chmod *')
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 6
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
5	o.system("/bin/tar xvzf *")
6	o.system('/bin/chown *')
7	o.popen2('/bin/chmod *')
linux_commands_wildcard_injection: Possible wildcard injection in call: os.popen2
Test ID: B609
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-155
File: examples/wildcard-injection.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b609_linux_commands_wildcard_injection.html
6	o.system('/bin/chown *')
7	o.popen2('/bin/chmod *')
8	subp.Popen('/bin/chown *', shell=True)
start_process_with_a_shell: Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B605
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/plugins/b605_start_process_with_a_shell.html
6	o.system('/bin/chown *')
7	o.popen2('/bin/chmod *')
8	subp.Popen('/bin/chown *', shell=True)
linux_commands_wildcard_injection: Possible wildcard injection in call: subprocess.Popen
Test ID: B609
Severity: HIGH
Confidence: MEDIUM
CWE: CWE-155
File: examples/wildcard-injection.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b609_linux_commands_wildcard_injection.html
7	o.popen2('/bin/chmod *')
8	subp.Popen('/bin/chown *', shell=True)
9	
subprocess_popen_with_shell_equals_true: subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Test ID: B602
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 8
More info: https://bandit.readthedocs.io/en/X/plugins/b602_subprocess_popen_with_shell_equals_true.html
7	o.popen2('/bin/chmod *')
8	subp.Popen('/bin/chown *', shell=True)
9	
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
10	# Not vulnerable to wildcard injection
11	subp.Popen('/bin/rsync *')
12	subp.Popen("/bin/chmod *")
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 12
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
11	subp.Popen('/bin/rsync *')
12	subp.Popen("/bin/chmod *")
13	subp.Popen(['/bin/chown', '*'])
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 13
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
12	subp.Popen("/bin/chmod *")
13	subp.Popen(['/bin/chown', '*'])
14	subp.Popen(["/bin/chmod", sys.argv[1], "*"],
subprocess_without_shell_equals_true: subprocess call - check for execution of untrusted input.
Test ID: B603
Severity: LOW
Confidence: HIGH
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 14
More info: https://bandit.readthedocs.io/en/X/plugins/b603_subprocess_without_shell_equals_true.html
13	subp.Popen(['/bin/chown', '*'])
14	subp.Popen(["/bin/chmod", sys.argv[1], "*"],
15	                 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
16	o.spawnvp(os.P_WAIT, 'tar', ['tar', 'xvzf', '*'])
start_process_with_no_shell: Starting a process without a shell.
Test ID: B606
Severity: LOW
Confidence: MEDIUM
CWE: CWE-78
File: examples/wildcard-injection.py
Line number: 16
More info: https://bandit.readthedocs.io/en/X/plugins/b606_start_process_with_no_shell.html
15	                 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
16	o.spawnvp(os.P_WAIT, 'tar', ['tar', 'xvzf', '*'])
blacklist: Using xml.etree.cElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B405
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_celementtree.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b405-import-xml-etree
1	import xml.etree.cElementTree as badET
2	import defusedxml.cElementTree as goodET
3	
blacklist: Using xml.etree.cElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B313
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_celementtree.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-celementtree
6	# unsafe
7	tree = badET.fromstring(xmlString)
8	print(tree)
blacklist: Using xml.etree.cElementTree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B313
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_celementtree.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-celementtree
8	print(tree)
9	badET.parse('filethatdoesntexist.xml')
10	badET.iterparse('filethatdoesntexist.xml')
blacklist: Using xml.etree.cElementTree.iterparse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree.iterparse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B313
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_celementtree.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-celementtree
9	badET.parse('filethatdoesntexist.xml')
10	badET.iterparse('filethatdoesntexist.xml')
11	a = badET.XMLParser()
blacklist: Using xml.etree.cElementTree.XMLParser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree.XMLParser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B313
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_celementtree.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-celementtree
10	badET.iterparse('filethatdoesntexist.xml')
11	a = badET.XMLParser()
12	
blacklist: Using xml.etree.ElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B405
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_elementtree.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b405-import-xml-etree
1	import xml.etree.ElementTree as badET
2	import defusedxml.ElementTree as goodET
3	
blacklist: Using xml.etree.ElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B314
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_elementtree.py
Line number: 7
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
6	# unsafe
7	tree = badET.fromstring(xmlString)
8	print(tree)
blacklist: Using xml.etree.ElementTree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B314
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_elementtree.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
8	print(tree)
9	badET.parse('filethatdoesntexist.xml')
10	badET.iterparse('filethatdoesntexist.xml')
blacklist: Using xml.etree.ElementTree.iterparse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.iterparse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B314
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_elementtree.py
Line number: 10
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
9	badET.parse('filethatdoesntexist.xml')
10	badET.iterparse('filethatdoesntexist.xml')
11	a = badET.XMLParser()
blacklist: Using xml.etree.ElementTree.XMLParser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.XMLParser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B314
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_etree_elementtree.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
10	badET.iterparse('filethatdoesntexist.xml')
11	a = badET.XMLParser()
12	
blacklist: Using xml.dom.expatbuilder to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.expatbuilder with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B407
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_expatbuilder.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b407-import-xml-expat
1	import xml.dom.expatbuilder as bad
2	import defusedxml.expatbuilder as good
3	
blacklist: Using xml.dom.expatbuilder.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.expatbuilder.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B316
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_expatbuilder.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-expatbuilder
3	
4	bad.parse('filethatdoesntexist.xml')
5	good.parse('filethatdoesntexist.xml')
blacklist: Using xml.dom.expatbuilder.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.expatbuilder.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B316
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_expatbuilder.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-expatbuilder
8	
9	bad.parseString(xmlString)
10	good.parseString(xmlString)
blacklist: Using xml.sax.expatreader to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.expatreader with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B406
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_expatreader.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b406-import-xml-sax
1	import xml.sax.expatreader as bad
2	import defusedxml.expatreader as good
3	
blacklist: Using xml.sax.expatreader.create_parser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.expatreader.create_parser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B315
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_expatreader.py
Line number: 4
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-expatreader
3	
4	p = bad.create_parser()
5	b = good.create_parser()
blacklist: Using parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace parseString with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B408
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_minidom.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b408-import-xml-minidom
1	from xml.dom.minidom import parseString as badParseString
2	from defusedxml.minidom import parseString as goodParseString
3	a = badParseString("<myxml>Some data some more data</myxml>")
blacklist: Using xml.dom.minidom.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B318
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_minidom.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-minidom
2	from defusedxml.minidom import parseString as goodParseString
3	a = badParseString("<myxml>Some data some more data</myxml>")
4	print(a)
blacklist: Using parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace parse with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B408
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_minidom.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b408-import-xml-minidom
8	
9	from xml.dom.minidom import parse as badParse
10	from defusedxml.minidom import parse as goodParse
blacklist: Using xml.dom.minidom.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B318
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_minidom.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-minidom
10	from defusedxml.minidom import parse as goodParse
11	a = badParse("somfilethatdoesntexist.xml")
12	print(a)
blacklist: Using parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace parseString with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B409
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_pulldom.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b409-import-xml-pulldom
1	from xml.dom.pulldom import parseString as badParseString
2	from defusedxml.pulldom import parseString as goodParseString
3	a = badParseString("<myxml>Some data some more data</myxml>")
blacklist: Using xml.dom.pulldom.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.pulldom.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B319
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_pulldom.py
Line number: 3
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-pulldom
2	from defusedxml.pulldom import parseString as goodParseString
3	a = badParseString("<myxml>Some data some more data</myxml>")
4	print(a)
blacklist: Using parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace parse with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B409
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_pulldom.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b409-import-xml-pulldom
8	
9	from xml.dom.pulldom import parse as badParse
10	from defusedxml.pulldom import parse as goodParse
blacklist: Using xml.dom.pulldom.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.pulldom.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B319
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_pulldom.py
Line number: 11
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-pulldom
10	from defusedxml.pulldom import parse as goodParse
11	a = badParse("somfilethatdoesntexist.xml")
12	print(a)
blacklist: Using xml.sax to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B406
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b406-import-xml-sax
1	import xml.sax
2	from xml import sax
3	import defusedxml.sax
blacklist: Using sax to parse untrusted XML data is known to be vulnerable to XML attacks. Replace sax with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Test ID: B406
Severity: LOW
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 2
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b406-import-xml-sax
1	import xml.sax
2	from xml import sax
3	import defusedxml.sax
blacklist: Using xml.sax.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 21
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
20	    # bad
21	    xml.sax.parseString(xmlString, ExampleContentHandler())
22	    xml.sax.parse('notaxmlfilethatexists.xml', ExampleContentHandler())
blacklist: Using xml.sax.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
21	    xml.sax.parseString(xmlString, ExampleContentHandler())
22	    xml.sax.parse('notaxmlfilethatexists.xml', ExampleContentHandler())
23	    sax.parseString(xmlString, ExampleContentHandler())
blacklist: Using xml.sax.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 23
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
22	    xml.sax.parse('notaxmlfilethatexists.xml', ExampleContentHandler())
23	    sax.parseString(xmlString, ExampleContentHandler())
24	    sax.parse('notaxmlfilethatexists.xml', ExampleContentHandler)
blacklist: Using xml.sax.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 24
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
23	    sax.parseString(xmlString, ExampleContentHandler())
24	    sax.parse('notaxmlfilethatexists.xml', ExampleContentHandler)
25	
blacklist: Using xml.sax.make_parser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.make_parser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 30
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
29	    # bad
30	    xml.sax.make_parser()
31	    sax.make_parser()
blacklist: Using xml.sax.make_parser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.make_parser with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Test ID: B317
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/xml_sax.py
Line number: 31
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_calls.html#b313-b320-xml-bad-sax
30	    xml.sax.make_parser()
31	    sax.make_parser()
32	    print('nothing')
blacklist: Using xmlrpc to parse untrusted XML data is known to be vulnerable to XML attacks. Use defusedxml.xmlrpc.monkey_patch() function to monkey-patch xmlrpclib and mitigate XML vulnerabilities.
Test ID: B411
Severity: HIGH
Confidence: HIGH
CWE: CWE-20
File: examples/xml_xmlrpc.py
Line number: 1
More info: https://bandit.readthedocs.io/en/X/blacklists/blacklist_imports.html#b411-import-xmlrpclib
1	import xmlrpc
2	from SimpleXMLRPCServer import SimpleXMLRPCServer
3	
yaml_load: Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().
Test ID: B506
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/yaml_load.py
Line number: 9
More info: https://bandit.readthedocs.io/en/X/plugins/b506_yaml_load.html
8	    ystr = yaml.dump({'a': 1, 'b': 2, 'c': 3})
9	    y = yaml.load(ystr)
10	    yaml.dump(y)
yaml_load: Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().
Test ID: B506
Severity: MEDIUM
Confidence: HIGH
CWE: CWE-20
File: examples/yaml_load.py
Line number: 22
More info: https://bandit.readthedocs.io/en/X/plugins/b506_yaml_load.html
21	
22	yaml.load("{}", Loader=yaml.Loader)
23