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(Resources): hide private key from the logs #7835

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion release.notes
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FIX: (#7818) AREXCE returns an error if a queue is not found in the ARC instance

*TransformationSystem

NEW: (#7812)
NEW: (#7812)
CHANGE: (#7812) Improve getTransformationFiles performance

FIX: (#7811) SSHCE, Try python3 before unversioned python
Expand Down
1 change: 1 addition & 0 deletions src/DIRAC/Resources/LogFilters/SensitiveDataFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __filter(self, record):
# a list of sensitive words to replace
sensitiveData = [
r"-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----",
r"-----BEGIN PRIVATE KEY-----.*?-----END PRIVATE KEY-----",
]

# record.args can be a tuple
Expand Down
8 changes: 8 additions & 0 deletions src/DIRAC/Resources/LogFilters/test/Test_LogFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def test_pf(pf, record, result):
("blablabla ***REDACTED*** blablabla", "Variable message"),
# should not display the certificate
),
(
(
"blablabla -----BEGIN PRIVATE KEY-----\n12345\n45678\n-----END PRIVATE KEY----- blablabla",
"Variable message",
),
("blablabla ***REDACTED*** blablabla", "Variable message"),
# should not display the certificate
),
((5, ""), ("5", "")), # special case
(("", 5), ("", "5")), # special case
(({"ce": "test"}, ""), ("{'ce': 'test'}", "")), # special case
Expand Down
Loading