VariantDraft
CWE-495Private Data Structure Returned From A Public Method
Category: other
Description
The product has a method that is declared public, but returns a reference to a private data structure, which could then be modified in unexpected ways.
Common consequences· 1
- Integrity — Modify Application DataThe contents of the data structure can be modified from outside the intended scope.
Potential mitigations· 3
- [Implementation]Declare the method private.
- [Implementation]Clone the member data and keep an unmodified version of the data private to the object.
- [Implementation]Use public setter methods that govern how a private member can be modified.
References
Related by meaning· 6
Nearest entities by semantic similarity across the cs-graph corpus.