mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Python: Add query for insecure SSH host key policies in Paramiko.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| paramiko_host_key.py:5:1:5:49 | ControlFlowNode for Attribute() | Setting missing host key policy to AutoAddPolicy may be unsafe. |
|
||||
| paramiko_host_key.py:7:1:7:49 | ControlFlowNode for Attribute() | Setting missing host key policy to WarningPolicy may be unsafe. |
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE-295/MissingHostKeyValidation.ql
|
||||
@@ -0,0 +1,7 @@
|
||||
from paramiko.client import AutoAddPolicy, WarningPolicy, RejectPolicy, SSHClient
|
||||
|
||||
client = SSHClient()
|
||||
|
||||
client.set_missing_host_key_policy(AutoAddPolicy) # bad
|
||||
client.set_missing_host_key_policy(RejectPolicy) # good
|
||||
client.set_missing_host_key_policy(WarningPolicy) # bad
|
||||
15
python/ql/test/query-tests/Security/lib/paramiko/client.py
Normal file
15
python/ql/test/query-tests/Security/lib/paramiko/client.py
Normal file
@@ -0,0 +1,15 @@
|
||||
class SSHClient(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def set_missing_host_key_policy(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
class AutoAddPolicy(object):
|
||||
pass
|
||||
|
||||
class WarningPolicy(object):
|
||||
pass
|
||||
|
||||
class RejectPolicy(object):
|
||||
pass
|
||||
Reference in New Issue
Block a user