Skip to content

Check for hardcoded passwords in class attributes#766

Merged
ericwb merged 4 commits into
PyCQA:masterfrom
noliverio:B105-add-check-for-class-attributes
Feb 8, 2022
Merged

Check for hardcoded passwords in class attributes#766
ericwb merged 4 commits into
PyCQA:masterfrom
noliverio:B105-add-check-for-class-attributes

Conversation

@noliverio
Copy link
Copy Markdown
Contributor

B105:hardcoded_password_string currently throws an error for string
literal variables, dictionary keys, and comparisons which look like
passwords, but does not create an error for class attributes which look
like passwords.

For example password = "mypassword" and password == "mypassword"
would create an error, but my_object.password = "mypassword",
and my_object.password == "mypassword" would not.
This behavior is unintuitive.

Resolves #759

B105:hardcoded_password_string currently throws an error for string
literal variables, dictionary keys, and comparisons which look like
passwords, but does not create an error for class attributes which look
like passwords.

For example password = "mypassword" and password == "mypassword"
would create an error, but my_object.password = "mypassword",
and my_object.password == "mypassword" would not.
This behavior is unintuitive.

Resolves PyCQA#759
Copy link
Copy Markdown
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no tests here that validate that this will not regress or that this works in the first place.

@noliverio
Copy link
Copy Markdown
Contributor Author

Shoot, sorry about that. d038529 Adds tests for the new functionality.

Copy link
Copy Markdown
Member

@ericwb ericwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ericwb
Copy link
Copy Markdown
Member

ericwb commented Feb 8, 2022

@sigmavirus24 The included additional tests look good to me. Wanna take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check B105:hardcoded_password_string for class attributes

3 participants