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

## Summary Adds `S504` rule for the [flake8-bandit](https://github.com/tylerwince/flake8-bandit) plugin port. Checks for calls to `ssl.wrap_socket` which have no `ssl_version` argument set. See also https://bandit.readthedocs.io/en/latest/_modules/bandit/plugins/insecure_ssl_tls.html#ssl_with_no_version ## Test Plan Fixture added ## Issue Link Refers: https://github.com/astral-sh/ruff/issues/1646
15 lines
239 B
Python
15 lines
239 B
Python
import ssl
|
|
from ssl import wrap_socket
|
|
|
|
ssl.wrap_socket() # S504
|
|
wrap_socket() # S504
|
|
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1_2) # OK
|
|
|
|
|
|
class Class:
|
|
def wrap_socket(self):
|
|
pass
|
|
|
|
|
|
obj = Class()
|
|
obj.wrap_socket() # OK
|