1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Do not log Authorization header

This commit is contained in:
Abel García de Prada 2020-10-28 09:17:27 +01:00
parent 5e86e9f0e4
commit 2b64b83b89

View File

@ -23,6 +23,7 @@
*/ */
package com.owncloud.android.lib.common.http package com.owncloud.android.lib.common.http
import com.owncloud.android.lib.common.http.HttpConstants.AUTHORIZATION_HEADER
import com.owncloud.android.lib.common.http.HttpConstants.OC_X_REQUEST_ID import com.owncloud.android.lib.common.http.HttpConstants.OC_X_REQUEST_ID
import com.owncloud.android.lib.common.http.LogBuilder.logHttp import com.owncloud.android.lib.common.http.LogBuilder.logHttp
import com.owncloud.android.lib.common.http.NetworkNode.BODY import com.owncloud.android.lib.common.http.NetworkNode.BODY
@ -72,7 +73,12 @@ class LogInterceptor : Interceptor {
private fun logHeaders(requestId: String?, headers: Headers, networkPetition: NetworkPetition) { private fun logHeaders(requestId: String?, headers: Headers, networkPetition: NetworkPetition) {
headers.forEach { header -> headers.forEach { header ->
logHttp(networkPetition, HEADER, requestId, "${header.first}: ${header.second}") val headerValue: String = if (header.first.equals(AUTHORIZATION_HEADER, true)) {
"[redacted]"
} else {
header.second
}
logHttp(networkPetition, HEADER, requestId, "${header.first}: $headerValue")
} }
} }