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

Add log protection/redaction categories #129

Open
jamezp opened this issue Nov 20, 2024 · 0 comments
Open

Add log protection/redaction categories #129

jamezp opened this issue Nov 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jamezp
Copy link
Member

jamezp commented Nov 20, 2024

Migrated from: https://issues.redhat.com/browse/LOGTOOL-133

It is a requirement of some segments of the user population that certain pieces of information should be masked from the log.

We could solve the largest part of this problem as follows:

  • Introduce a new annotation @Protected(category) where category is a string, which applies to the parameters of the log methods. This could include categories such as:
    • credential
    • network-address
    • hostname
    • url
  • Introduce support for a system property jboss.logging.protected which could contain a comma-delimited list of categories, or the special category all
  • Generated logging interface implementations will initialize static boolean fields for each category referenced by a logging interface parameter
  • Generated logging code will check the field and if set, replace the given parameters with a generic redaction string (see [#example 1])
  • Add default protection categories for certain Java types:
    • InetAddress & SocketAddress and subtypes → network-address
    • URL & URIurl
    • java.security.Keycredential
    • etc.

Possible improvement/variation:

  • Give @Protected class retention, allow it to apply to classes as well so that for example Elytron Credential and Password could be annotated to get protection automatically in all use sites

Example 1

    final IllegalArgumentException result =
        new IllegalArgumentException(
            String.format(
                getLoggingLocale(),
                PROT_CREDENTIAL ? "????????" : credential
            )
        );

Notes:

  • Using a boolean constant allows the JIT to delete the unused code path
  • The redaction string should be constant and constant-length so that the length cannot be used to infer information about it
@jamezp jamezp added the enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant