Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 2b64b83

Browse files
committed
Do not log Authorization header
1 parent 5e86e9f commit 2b64b83

File tree

1 file changed

+7
-1
lines changed
  • owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http

1 file changed

+7
-1
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/LogInterceptor.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
package com.owncloud.android.lib.common.http
2525

26+
import com.owncloud.android.lib.common.http.HttpConstants.AUTHORIZATION_HEADER
2627
import com.owncloud.android.lib.common.http.HttpConstants.OC_X_REQUEST_ID
2728
import com.owncloud.android.lib.common.http.LogBuilder.logHttp
2829
import com.owncloud.android.lib.common.http.NetworkNode.BODY
@@ -72,7 +73,12 @@ class LogInterceptor : Interceptor {
7273

7374
private fun logHeaders(requestId: String?, headers: Headers, networkPetition: NetworkPetition) {
7475
headers.forEach { header ->
75-
logHttp(networkPetition, HEADER, requestId, "${header.first}: ${header.second}")
76+
val headerValue: String = if (header.first.equals(AUTHORIZATION_HEADER, true)) {
77+
"[redacted]"
78+
} else {
79+
header.second
80+
}
81+
logHttp(networkPetition, HEADER, requestId, "${header.first}: $headerValue")
7682
}
7783
}
7884

0 commit comments

Comments
 (0)