CWE一覧に戻る
CWE-582

配列のパブリック宣言、ファイナル宣言、スタティック宣言

Array Declared Public, Final, and Static
脆弱性 レビュー中
JA

この製品は配列をpublic、final、staticと宣言しているが、配列の内容が変更されるのを防ぐには十分ではない。

配列は変更可能なオブジェクトであるため、最後の制約は、配列オブジェクト自体は一度だけ代入されることを要求しますが、配列要素の値については何の保証もしません。配列はパブリックなので、悪意のあるプログラムは配列に格納された値を変更することができます。そのため、ほとんどの場合、public、final、staticと宣言された配列はバグです。

EN

The product declares an array public, final, and static, which is not sufficient to prevent the array's contents from being modified.

Because arrays are mutable objects, the final constraint requires that the array object itself be assigned only once, but makes no guarantees about the values of the array elements. Since the array is public, a malicious program can change the values stored in the array. As such, in most cases an array declared public, final and static is a bug.

Scope: Integrity / Impact: Modify Application Data
In most situations the array should be made private.
MITRE公式ページ — CWE-582