File tree Expand file tree Collapse file tree
client/src/main/java/org/asynchttpclient Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 */
3131public final class HttpMessageFormatter {
3232
33- /** The value used in place of sensitive header values. */
34- public static final String REDACTED = SensitiveLoggingUtils .REDACTED ;
35-
3633 private HttpMessageFormatter () {
3734 }
3835
@@ -54,18 +51,8 @@ static String format(HttpResponse response) {
5451 private static StringBuilder appendHeaders (StringBuilder value , HttpHeaders headers ) {
5552 for (Map .Entry <String , String > header : headers ) {
5653 value .append ('\n' ).append (header .getKey ()).append (": " )
57- .append (isSensitiveHeader (header .getKey ()) ? REDACTED : header .getValue ());
54+ .append (SensitiveLoggingUtils . isSensitiveHeader (header .getKey ()) ? SensitiveLoggingUtils . REDACTED : header .getValue ());
5855 }
5956 return value ;
6057 }
61-
62- /**
63- * Returns whether a header value must be redacted from logs.
64- *
65- * @param name the header name
66- * @return {@code true} for authentication and cookie headers when sensitive logging is disabled
67- */
68- public static boolean isSensitiveHeader (CharSequence name ) {
69- return SensitiveLoggingUtils .isSensitiveHeader (name );
70- }
7158}
Original file line number Diff line number Diff line change 2121
2222import java .util .concurrent .atomic .AtomicIntegerFieldUpdater ;
2323
24+ // Deliberately no toString() override: NettyResponseFuture#toString renders this object via
25+ // Object.toString() so debug logs never include the wrapped httpRequest's headers. Adding a
26+ // toString() here that exposes httpRequest would leak Authorization/Cookie values into logs.
2427public final class NettyRequest {
2528
2629 @ SuppressWarnings ("rawtypes" )
Original file line number Diff line number Diff line change 2323 * Shared policy for rendering sensitive HTTP headers in logs. The policy is read once from the
2424 * {@code org.asynchttpclient.enableSensitiveLogging} system property or {@code AHC_ENABLE_SENSITIVE_LOGGING} environment
2525 * variable when this class is initialized.
26+ * <p>
27+ * Covers request credential headers only. {@code WWW-Authenticate} and {@code Proxy-Authenticate} response
28+ * challenge headers are logged unredacted, and request form/query/multipart/body values are out of scope since
29+ * they have no reliable generic sensitivity classification.
2630 */
2731public final class SensitiveLoggingUtils {
2832
You can’t perform that action at this time.
0 commit comments