Skip to content

Commit

Permalink
Merge pull request #400 from Iterable/MOB-3703-Iterable-Logging-Senst…
Browse files Browse the repository at this point in the history
…ive-Data

[MOB - 3703] - Sensitive log information
  • Loading branch information
Ayyanchira authored Nov 18, 2021
2 parents 290200a + 64b4243 commit 834b1a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public void queueExpirationRefresh(String encodedJWT) {
if (triggerExpirationRefreshTime > 0) {
scheduleAuthTokenRefresh(triggerExpirationRefreshTime);
} else {
IterableLogger.w(TAG, "The expiringAuthTokenRefreshPeriod has already passed for the current JWT " + encodedJWT);
IterableLogger.w(TAG, "The expiringAuthTokenRefreshPeriod has already passed for the current JWT");
}
} catch (Exception e) {
IterableLogger.e(TAG, "Error while parsing JWT for the expiration: " + encodedJWT, e);
IterableLogger.e(TAG, "Error while parsing JWT for the expiration", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,19 @@ private static String buildHeaderString(HttpURLConnection urlConnection) {
Iterator<?> headerKeys = urlConnection.getRequestProperties().keySet().iterator();
while (headerKeys.hasNext()) {
String key = (String) headerKeys.next();
headerString.append(key + " : " + urlConnection.getRequestProperties().get(key) + "\n");
if (isSensitive(key)) {
continue;
}
headerString.append(key).append(" : ").append(urlConnection.getRequestProperties().get(key)).append("\n");
}
headerString.append("}");
return headerString.toString();
}

private static boolean isSensitive(String key) {
return (key.equals(IterableConstants.HEADER_API_KEY)) || key.equals(IterableConstants.HEADER_SDK_AUTHORIZATION);
}

@Override
protected void onPostExecute(IterableApiResponse response) {
boolean retryRequest = !response.success && response.responseCode >= 500;
Expand Down

0 comments on commit 834b1a2

Please sign in to comment.