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

Need a selective way to skip sensitive arguments from being logged #414

Open
samarthya-gupta1 opened this issue Feb 14, 2025 · 0 comments
Open

Comments

@samarthya-gupta1
Copy link

samarthya-gupta1 commented Feb 14, 2025

Feature Request: Masking Specific Arguments in @loggable

Summary:
Currently, @loggable supports skipArgs = true to exclude all arguments from logging. However, there is no way to selectively mask sensitive arguments (e.g., passwords, tokens) while keeping others visible.

Proposed Enhancement:

Add a new parameter maskArgs (e.g., @loggable(maskArgs = {"password", "token"})).
If a method argument matches any value in maskArgs, replace its value with "****" in logs.
Keep other arguments unchanged.
Use Case Example:

@Loggable(maskArgs = {"password", "token"})
public void processUser(String username, String password, String token) {
    // Business logic
}
Expected Log Output:


processUser(username=user123, password=****, token=****)

Benefits:

Helps improve security and compliance by preventing sensitive data leaks in logs.
Avoids the need for workarounds like overriding toString() or using custom aspects.

Using Java 8

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

No branches or pull requests

1 participant