diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index 151d080f3..3f0f8970d 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -170,7 +170,7 @@ module JavaSink = struct taint_nth 0 Intent site ~report_reachable:true | "android.app.Activity", ("startActivityFromChild" | "startActivityFromFragment") -> taint_nth 1 Intent site ~report_reachable:true - | "android.util.Log", ("d" | "e" | "i" | "println" | "v" | "w" | "wtf") -> + | "android.util.Log", ("e" | "println" | "w" | "wtf") -> taint_all pname Logging site ~report_reachable:true | "com.facebook.infer.builtins.InferTaint", "inferSensitiveSink" -> [Sink.make_sink_param (make Other site) 0 ~report_reachable:false] diff --git a/infer/tests/codetoanalyze/java/quandary/LoggingPrivateData.java b/infer/tests/codetoanalyze/java/quandary/LoggingPrivateData.java index 364da133a..d1c208fd1 100644 --- a/infer/tests/codetoanalyze/java/quandary/LoggingPrivateData.java +++ b/infer/tests/codetoanalyze/java/quandary/LoggingPrivateData.java @@ -17,11 +17,11 @@ import android.util.Log; public class LoggingPrivateData { public void logSharedPreferencesDataBad(SharedPreferences prefs) { - Log.d("tag", prefs.getString("some", "data")); + Log.e("tag", prefs.getString("some", "data")); } public void logSharedPreferencesDataInTagBad(SharedPreferences prefs) { - Log.d(prefs.getString("some", "data"), "value"); + Log.e(prefs.getString("some", "data"), "value"); } static class StringWrapper extends Throwable { @@ -40,7 +40,7 @@ public class LoggingPrivateData { } public void logDataOk(SharedPreferences prefs) { - Log.d("tag", "value"); + Log.e("tag", "value"); } private native int rand(); @@ -73,7 +73,7 @@ public class LoggingPrivateData { public void logAllSourcesBad(Location l, TelephonyManager t) { String source = returnAllSources(l, t); - Log.d("tag", source); + Log.e("tag", source); } } diff --git a/infer/tests/codetoanalyze/java/quandary/issues.exp b/infer/tests/codetoanalyze/java/quandary/issues.exp index 4f5f49a8e..36a8b621c 100644 --- a/infer/tests/codetoanalyze/java/quandary/issues.exp +++ b/infer/tests/codetoanalyze/java/quandary/issues.exp @@ -103,19 +103,19 @@ Interprocedural.java:221: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferT Interprocedural.java:232: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 230]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 232]) via { } Interprocedural.java:244: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 244]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 240]) via { void Interprocedural.callSinkVariadic(java.lang.Object[]) at [line 244] } Interprocedural.java:255: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 253]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 255]) via { } -LoggingPrivateData.java:20: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String SharedPreferences.getString(String,String) at [line 20]) -> Logging(int Log.d(String,String) at [line 20]) via { } -LoggingPrivateData.java:24: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String SharedPreferences.getString(String,String) at [line 24]) -> Logging(int Log.d(String,String) at [line 24]) via { } +LoggingPrivateData.java:20: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String SharedPreferences.getString(String,String) at [line 20]) -> Logging(int Log.e(String,String) at [line 20]) via { } +LoggingPrivateData.java:24: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String SharedPreferences.getString(String,String) at [line 24]) -> Logging(int Log.e(String,String) at [line 24]) via { } LoggingPrivateData.java:39: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String SharedPreferences.getString(String,String) at [line 38]) -> Logging(int Log.w(String,Throwable) at [line 39]) via { } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getDeviceId() at [line 61]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getLine1Number() at [line 63]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getSimSerialNumber() at [line 65]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getSubscriberId() at [line 67]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getVoiceMailNumber() at [line 69]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getAltitude() at [line 51]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getLatitude() at [line 55]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getLongitude() at [line 57]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(float Location.getBearing() at [line 53]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } -LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(float Location.getSpeed() at [line 59]) -> Logging(int Log.d(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getDeviceId() at [line 61]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getLine1Number() at [line 63]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getSimSerialNumber() at [line 65]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getSubscriberId() at [line 67]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(String TelephonyManager.getVoiceMailNumber() at [line 69]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getAltitude() at [line 51]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getLatitude() at [line 55]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(double Location.getLongitude() at [line 57]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(float Location.getBearing() at [line 53]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } +LoggingPrivateData.java:76: ERROR: QUANDARY_TAINT_ERROR Error: PrivateData(float Location.getSpeed() at [line 59]) -> Logging(int Log.e(String,String) at [line 76]) via { String LoggingPrivateData.returnAllSources(Location,TelephonyManager) at [line 75] } Recursion.java:26: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 26]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 21]) via { void Recursion.callSinkThenDiverge(Object) at [line 26] } Recursion.java:36: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 36]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 31]) via { void Recursion.safeRecursionCallSink(int,Object) at [line 36] } Recursion.java:42: ERROR: QUANDARY_TAINT_ERROR Error: Other(Object InferTaint.inferSecretSource() at [line 42]) -> Other(void InferTaint.inferSensitiveSink(Object) at [line 41]) via { void Recursion.recursionBad(int,Object) at [line 42] }