계: Encapsulation

캡슐화는 강력한 경계를 그리는 것입니다. 웹 브라우저에서는 사용자의 모바일 코드가 다른 모바일 코드에 의해 오용되지 않도록 하는 것을 의미합니다. 서버에서는 검증된 데이터와 검증되지 않은 데이터, 한 사용자의 데이터와 다른 사용자의 데이터, 데이터 사용자가 볼 수 있는 데이터와 볼 수 없는 데이터 간의 차별화를 의미할 수 있습니다.

Django Bad Practices: Attributes in Deny List

Abstract
응용 프로그램은 거부 목록을 사용하여 폼을 통해 노출되는 속성을 제어합니다. 개발자는 새 속성을 추가할 때 거부 목록을 업데이트하는 것을 잊어버릴 수 있을 뿐 아니라 민감한 필드를 실수로 공격자에게 노출할 수도 있습니다.
Explanation
응용 프로그램은 exclude 거부 목록을 사용합니다. 이는 관리하기가 어려울 뿐 아니라 오류에도 취약합니다. 개발자가 폼이나 폼을 백업하는 Model에 새 필드를 추가하는 상황에서 exclude 필터를 업데이트하는 것을 잊어버리는 경우 공격자에게 민감한 필드를 노출할 수도 있습니다. 공격자는 악의적인 데이터를 제외되지 않는 필드로 전송하고 바인딩할 수 있습니다.

예제 1: 다음 폼은 일부 User 속성을 노출하지만 사용자 id에 대한 거부 목록을 검사합니다.


from myapp.models import User
...
class UserForm(ModelForm):
class Meta:
model = User
exclude = ['id']
...
User 모델은 새 role 속성으로 업데이트되었지만 연결된 UserForm은 업데이트되지 않은 경우 폼에서 role 속성이 노출됩니다.
References
[1] Django Foundation Creating forms from models
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 3
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 2
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[7] Standards Mapping - OWASP API 2023 API3 Broken Object Property Level Authorization
[8] Standards Mapping - OWASP Mobile 2024 M8 Security Misconfiguration
desc.structural.python.django_bad_practices_attributes_in_deny_list