Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rules): improve S507 detection #7661

Merged

Commits on Sep 28, 2023

  1. fix(rules): detect policy instances in S507

    Applying the same fix as in `bandit`
    (PyCQA/bandit#1064). `paramiko` supports passing
    both a class and a class instance for the policy in
    `set_missing_host_key_policy`
    (https://github.com/paramiko/paramiko/blob/8e389c77660c5cdae3069b478665427d23012853/paramiko/client.py#L171-L191).
    mkniewallner committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    9b9d833 View commit details
    Browse the repository at this point in the history
  2. fix(rules): account for paramiko.* imports

    `AutoAddPolicy`, `WarningPolicy` and `SSHClient` are not only exposed in
    `paramiko.client`, but also in `paramiko`
    (https://github.com/paramiko/paramiko/blob/66117732de6de03914308f9a21b05b50a781d13c/paramiko/__init__.py#L121-L164).
    So we also have to account for that when resolving the import paths.
    mkniewallner committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    98d74c0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3fe2449 View commit details
    Browse the repository at this point in the history
  4. Use map_callable

    charliermarsh committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    27187e8 View commit details
    Browse the repository at this point in the history