계: Code Quality

코드 품질이 낮으면 예측할 수 없는 동작이 발생합니다. 사용자 입장에서는 사용 편의성이 떨어지는 것으로 나타나는 경우가 많습니다. 공격자에게는 예상치 못한 방법으로 시스템에 부담을 줄 수 있는 기회가 됩니다.

Code Correctness: Class Implements ICloneable

Abstract
ICloneable 인터페이스는 해당 Clone 메서드에 대해 약한 약정을 지정하므로 피해야 합니다.
Explanation
ICloneable 인터페이스는 복제되면 정상적으로 작동하지 않을 수 있는 클래스의 완전한 복제(deep cloning)를 보장하지 않습니다. ICloneable을 구현하고 다른 개체에 대한 기존의 참조를 포함하는 개체만 복사하는 단순 복제(shallow-cloning)만을 구현하는 클래스는 비정상적으로 작동할 수 있습니다. 개체 및 모든 참조된 개체를 복제하는 완전한 복제(deep cloning)가 clone 메서드의 일반적으로 예상되는 작동이므로 ICloneable 인터페이스를 사용하면 오류가 발생할 가능성이 크고 따라서 사용을 피해야 합니다.
References
[1] Krzysztof Cwalina, Brad Abrams Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries. Chapter 8: Usage Guidelines Addison-Wesley
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 398
desc.structural.dotnet.code_correctness_class_implements_icloneable