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.2p0 CONFIDENTIAL CodeSecure Inc
Java


JAVA.MISC.SD.CACHE : Sensitive Data Cached (Java)

要旨

Potentially sensitive data is stored in a cache.

The following are considered sensitive system data.

プロパティ

クラス名 Sensitive Data Cached (Java)
日本語クラス名 Sensitive Data Cached (Java)
クラス分類 セキュリティ (security)
ニーモニック JAVA.MISC.SD.CACHE
カテゴリー
CWE CWE:524 Use of Cache Containing Sensitive Information
CERT-Java CERT-Java:DRD22 Do not cache sensitive information
OWASP-2017 OWASP-2017:A3 Sensitive data exposure
OWASP-2021 OWASP-2021:A1 Broken access control
OWASP-2025 OWASP-2025:A01 Broken Access Control
対応言語 Available for Java and Kotlin.
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
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();
  }
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。

 

To report problems with this documentation, please visit https://support.codesecure.com/.