JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
Potentially sensitive data is stored in a cache.
The following are considered sensitive system data.
| Class Name | Sensitive Data Cached (Java) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | security | ||||||||||||
| Mnemonic | JAVA.MISC.SD.CACHE | ||||||||||||
| Categories |
|
||||||||||||
| Availability | Available for Java only. Android Only. Warnings of this class will only be reported in Android code: that is, code that uses the Android API. |
||||||||||||
| Enabling | Checks for this warning class are
disabled by default. To enable them, add the following WARNING_FILTER
rule to the project configuration file.
WARNING_FILTER += allow class="Sensitive Data Cached (Java)" |
In the following example, an IMEI (International Mobile Equipment Identity) is cached in three different locations.
package com.juliasoft.julia.tests.checks.sensitiveDataCaching;
import java.util.Locale;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.Context;
import android.provider.UserDictionary;
import android.telephony.TelephonyManager;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
public class CacheLeak extends Activity {
public void MyMethod()
{
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(this.TELEPHONY_SERVICE);
String imei=telephonyManager.getDeviceId();
UserDictionary.Words.addWord(this, imei, 100, "imei" , Locale.ITALY); /* "Sensitive Data Cached (Java)"
* warning issued here: IMEI can be accessed through spellchecker and word suggestions.
*/
}
public void MyMethod2()
{
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(this.TELEPHONY_SERVICE);
String imei=telephonyManager.getDeviceId();
ClipboardManager cpManage = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cpManage.setText(imei); /* "Sensitive Data Cached (Java)"
* warning issued here: IMEI can be accessed by pasting from clipboard.
*/
}
public void MyMethod4()
{
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(this.TELEPHONY_SERVICE);
String imei=telephonyManager.getDeviceId();
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = sharedPref.edit();
editor.putString("key", imei); // "Sensitive Data Cached (Java)" warning issued here
* warning issued here: IMEI can be accessed preferences and the autocompiling fields.
*/
editor.commit();
}
}
The following configuration file parameters affect checks for this warning class.