fix: Catch multiple leak occurrences in same string #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main change
Example:
AbstractMaskedLogger
and instead logic is placed into a independent functionmask_string
. This allow + flexible usage of the codebase. For example, in my use case I want to have access to this function to cleanup a string outside of logging context, but since logic is currently hidden insideAbstractMaskedLogger._mask_sensitive_data
and the argument is aLogRecord
we cannot use this logic for more generic cases. By abstracting away the logic to an independentmask_string
method we can use this code base into other use-cases. Retro-compatibility is ensured by callingmask_string
insideAbstractMaskedLogger._mask_sensitive_data
.Example use case:
Additional
generic-api-key
to allow common chars that are used in passwords/api keys, and reduce minimum length to 8 instead of 10, as it's very common for passwords to have 8 as required minimum chars