What it is
Duplicate keys in associative lists can lead to non-unique keys being mistaken for an error.
Impact on systems
| Scope | Impact |
|---|---|
| Other | Quality Degradation, Varies by Context If an alist contains duplicate key entries, this introduces an ambiguity in which it cannot be predicted which key value will be selected. |
How to prevent it
Implementation
Use a hash table instead of an alist.
Implementation
Use an alist which checks the uniqueness of hash keys with each entry before inserting the entry.
Implementation
Duplicate key entries in an association list are not recommended and should not be allowed.
Source: MITRE CWE catalog · Official entry on the MITRE website