-
Notifications
You must be signed in to change notification settings - Fork 5
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
[DPE-5324] Increase ruff rules #405
Changes from 6 commits
4437277
25c942a
7063dbb
28d59ec
0f0725d
7ed47db
7dbc5bb
4d58e16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ pythonpath = [ | |
# Formatting tools configuration | ||
[tool.black] | ||
line-length = 99 | ||
target-version = ["py38"] | ||
target-version = ["py310"] | ||
|
||
# Linting tools configuration | ||
[tool.ruff] | ||
|
@@ -109,7 +109,7 @@ line-length = 99 | |
|
||
[tool.ruff.lint] | ||
explicit-preview-rules = true | ||
select = ["A", "E", "W", "F", "C", "N", "D", "I001", "CPY001"] | ||
select = ["A", "E", "W", "F", "C", "N", "D", "I001", "B", "CPY", "RUF", "S", "SIM", "UP", "TCH"] | ||
extend-ignore = [ | ||
"D203", | ||
"D204", | ||
|
@@ -128,12 +128,19 @@ extend-ignore = [ | |
ignore = ["E501", "D107"] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"tests/*" = ["D100", "D101", "D102", "D103", "D104"] | ||
"tests/*" = [ | ||
"D100", "D101", "D102", "D103", "D104", | ||
# Asserts | ||
"B011", | ||
# Disable security checks for tests | ||
"S", | ||
] | ||
|
||
[tool.ruff.lint.flake8-copyright] | ||
# Check for properly formatted copyright header in each file | ||
author = "Canonical Ltd." | ||
notice-rgx = "Copyright\\s\\d{4}([-,]\\d{4})*\\s+" | ||
min-file-size = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't expect a copyright header for empty files. |
||
|
||
[tool.ruff.lint.mccabe] | ||
max-complexity = 10 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,17 @@ | |
|
||
METRICS_PORT = 9127 | ||
PGB_LOG_DIR = "/var/log/pgbouncer" | ||
MONITORING_PASSWORD_KEY = "monitoring_password" | ||
AUTH_FILE_DATABAG_KEY = "auth_file" | ||
CFG_FILE_DATABAG_KEY = "cfg_file" | ||
|
||
EXTENSIONS_BLOCKING_MESSAGE = "bad relation request - remote app requested extensions, which are unsupported. Please remove this relation." | ||
CONTAINER_UNAVAILABLE_MESSAGE = "PgBouncer container currently unavailable" | ||
|
||
SECRET_LABEL = "secret" | ||
SECRET_INTERNAL_LABEL = "internal-secret" | ||
SECRET_DELETED_LABEL = "None" | ||
# Labels are not confidential | ||
SECRET_LABEL = "secret" # noqa: S105 | ||
MONITORING_PASSWORD_KEY = "monitoring_password" # noqa: S105 | ||
SECRET_INTERNAL_LABEL = "internal-secret" # noqa: S105 | ||
SECRET_DELETED_LABEL = "None" # noqa: S105 | ||
Comment on lines
+32
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security checks will inevitably produce some false positives, so we will have to |
||
|
||
APP_SCOPE = "app" | ||
UNIT_SCOPE = "unit" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
Check failure
Code scanning / CodeQL
Use of a broken or weak cryptographic hashing algorithm on sensitive data High
Copilot Autofix AI 3 months ago
To fix the problem, we should replace the MD5 hashing algorithm with a stronger, modern cryptographic hash function. For password hashing, it is recommended to use algorithms like Argon2, bcrypt, or PBKDF2, which are designed to be computationally expensive and include a salt to protect against brute-force attacks.
The best way to fix this without changing existing functionality is to use the
argon2-cffi
library to hash the password. This library provides a secure and efficient way to hash passwords.Steps to fix:
argon2-cffi
library if it is not already installed.PasswordHasher
class from theargon2
module.PasswordHasher
class to hash the password.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only it were that easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so funny how it intentionally removes the
in the format postgresql expects
part