am bdd33184: am d5b79c97: am 9f7b511f: Don\'t leak sensitive information when logging cookies.
Merge commit 'bdd331840a37ca37136f6c030ad557750372d53f' into dalvik-dev
* commit 'bdd331840a37ca37136f6c030ad557750372d53f':
Don't leak sensitive information when logging cookies.
diff --git a/src/org/apache/http/client/protocol/ResponseProcessCookies.java b/src/org/apache/http/client/protocol/ResponseProcessCookies.java
index 0689e93..5b76550 100644
--- a/src/org/apache/http/client/protocol/ResponseProcessCookies.java
+++ b/src/org/apache/http/client/protocol/ResponseProcessCookies.java
@@ -124,13 +124,17 @@
cookieStore.addCookie(cookie);
if (this.log.isDebugEnabled()) {
+ // BEGIN android-changed
this.log.debug("Cookie accepted: \""
- + cookie + "\". ");
+ + cookieToString(cookie) + "\". ");
+ // END android-changed
}
} catch (MalformedCookieException ex) {
if (this.log.isWarnEnabled()) {
+ // BEGIN android-changed
this.log.warn("Cookie rejected: \""
- + cookie + "\". " + ex.getMessage());
+ + cookieToString(cookie) + "\". " + ex.getMessage());
+ // END android-changed
}
}
}
@@ -142,5 +146,19 @@
}
}
}
-
+
+ // BEGIN android-added
+ /**
+ * Don't log the cookie's value; that's potentially sensitive information.
+ */
+ private String cookieToString(Cookie cookie) {
+ return cookie.getClass().getSimpleName()
+ + "[version=" + cookie.getVersion()
+ + ",name=" + cookie.getName()
+ + ",domain=" + cookie.getDomain()
+ + ",path=" + cookie.getPath()
+ + ",expiry=" + cookie.getExpiryDate()
+ + "]";
+ }
+ // END android-added
}