You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2023/11/14 12:52:03 UTC
[PR] Switch Basic Authentication encoding to UTF-8 (logging-log4j2)
ppkarwasz opened a new pull request, #1970:
URL: https://github.com/apache/logging-log4j2/pull/1970
[RFC 7617](https://datatracker.ietf.org/doc/html/rfc7617) introduces a new `charset` parameter for the Basic authentication scheme with a single allowed value "UTF-8".
Clients that comply to this RFC should encode the user name and password using UTF-8 if the parameter is present. Clients that **always** use UTF-8 obviously comply to this rule.
Up until now Log4j used the system encoding for Basic authentication. This PR:
- switches the default encoding to UTF-8,
- adds a `log4j2.configurationAuthorizationEncoding` property to overwrite the default value.
This problem was detected by Error Prone in #1961.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Switch Basic Authentication encoding to UTF-8 (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #1970:
URL: https://github.com/apache/logging-log4j2/pull/1970#discussion_r1395778245
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicAuthorizationProvider.java:
##########
@@ -35,6 +38,11 @@ public class BasicAuthorizationProvider implements AuthorizationProvider {
public static final String CONFIG_USER_NAME = "log4j2.configurationUserName";
public static final String CONFIG_PASSWORD = "log4j2.configurationPassword";
public static final String PASSWORD_DECRYPTOR = "log4j2.passwordDecryptor";
+ /*
+ * Properties used to specify the encoding in HTTP Basic Authentication
+ */
+ private static final String BASIC_AUTH_ENCODING = "log4j2.configurationAuthorizationEncoding";
+ private static final String SPRING_BASIC_AUTH_ENCODING = "logging.auth.encoding";
Review Comment:
I think these property are transitional, because:
- most password are ASCII anyway, since you need sometimes to type them on a keyboard of an OS without advanced input methods,
- most modern OSes use `UTF-8` as system encoding anyway (Windows is the exception),
- using system encodings is obsolete (besides the system encoding of the client and server might differ).
I will **drop** these configuration properties in `3.x` and leave `UTF-8` as only encoding.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Switch Basic Authentication encoding to UTF-8 (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy merged PR #1970:
URL: https://github.com/apache/logging-log4j2/pull/1970
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Switch Basic Authentication encoding to UTF-8 (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on code in PR #1970:
URL: https://github.com/apache/logging-log4j2/pull/1970#discussion_r1395752043
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicAuthorizationProvider.java:
##########
@@ -35,6 +38,11 @@ public class BasicAuthorizationProvider implements AuthorizationProvider {
public static final String CONFIG_USER_NAME = "log4j2.configurationUserName";
public static final String CONFIG_PASSWORD = "log4j2.configurationPassword";
public static final String PASSWORD_DECRYPTOR = "log4j2.passwordDecryptor";
+ /*
+ * Properties used to specify the encoding in HTTP Basic Authentication
+ */
+ private static final String BASIC_AUTH_ENCODING = "log4j2.configurationAuthorizationEncoding";
+ private static final String SPRING_BASIC_AUTH_ENCODING = "logging.auth.encoding";
Review Comment:
I am not happy with
1. having `configuration` in a property name (isn't everything has something to do with some _configuration_?)
2. adding Spring-specific functionality to a Spring-agnostic product
But... The rest of the class has already embraced these wrong conventions. Hence, you successfully have mirrored it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org