mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00

## Summary Adds S503 rule for the [flake8-bandit](https://github.com/tylerwince/flake8-bandit) plugin port. Checks for function defs argument defaults which have an insecure ssl_version value. See also https://bandit.readthedocs.io/en/latest/_modules/bandit/plugins/insecure_ssl_tls.html#ssl_with_bad_defaults Some logic and the `const` can be shared with https://github.com/astral-sh/ruff/pull/9390. When one of the two is merged. ## Test Plan Fixture added ## Issue Link Refers: https://github.com/astral-sh/ruff/issues/1646
23 lines
344 B
Python
23 lines
344 B
Python
import ssl
|
|
from OpenSSL import SSL
|
|
from ssl import PROTOCOL_TLSv1
|
|
|
|
|
|
def func(version=ssl.PROTOCOL_SSLv2): # S503
|
|
pass
|
|
|
|
|
|
def func(protocol=SSL.SSLv2_METHOD): # S503
|
|
pass
|
|
|
|
|
|
def func(version=SSL.SSLv23_METHOD): # S503
|
|
pass
|
|
|
|
|
|
def func(protocol=PROTOCOL_TLSv1): # S503
|
|
pass
|
|
|
|
|
|
def func(version=SSL.TLSv1_2_METHOD): # OK
|
|
pass
|