Skip to content

Commit

Permalink
Merge pull request DIRACGrid#7835 from aldbr/v8.0_FIX_sensitive-log-f…
Browse files Browse the repository at this point in the history
…ilter

fix(Resources): hide private key from the logs
  • Loading branch information
fstagni authored Oct 16, 2024
2 parents 773d412 + 361518f commit ab3e80b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit ab3e80b

Please sign in to comment.