InfoGrab DocsInfoGrab Docs

Import/Export 개발 문서

GitLab Import/Export 기능의 개발 가이드라인, 보안, 버전 관리, 코드 구조, 테스트 픽스처에 대해 설명합니다.

새로 추가되는 관계(relation)는 버그 및 성능 이슈 도입 위험을 줄이기 위해 기능 플래그 뒤에 배치해야 합니다. Import/Export 기능 에 대한 일반 개발 가이드라인과 팁입니다. 이 문서는 원래 YouTube에서 제공되는 Import/Export 201 프레젠테이션 을 기반으로 작성되었습니다. 더 많은 맥락을 위해 YouTube의 Import/Export 개발 심층 분석 을 시청할 수 있습니다. Import/Export 개발 문서 # 보안 # Import/Export 기능은 지속적으로 업데이트(새로운 내보내기 항목 추가)되고 있습니다. 그러나 코드는 오랫동안 리팩토링되지 않았습니다. 동적인 특성으로 인해 보안 우려 사항의 수가 증가하지 않도록 코드 감사를 수행해야 합니다. GitLab 팀원은 이 비공개 이슈에서 자세한 정보를 확인할 수 있습니다: https://gitlab.com/gitlab-org/gitlab/-/issues/20720 . 코드 내 보안 # 다음 클래스들 중 일부는 Import/Export에 보안 레이어를 제공합니다. AttributeCleaner 는 금지된 키를 제거합니다: # AttributeCleaner # Removes all `_ids` and other prohibited keys class AttributeCleaner ALLOWED_REFERENCES = RelationFactory::PROJECT_REFERENCES + RelationFactory::USER_REFERENCES + ['group_id'] def clean @relation_hash.reject do |key, _value| prohibited_key?(key) || !@relation_class.attribute_method?(key) || excluded_key?(key) end.except('id') end ... AttributeConfigurationSpec 은 새 칼럼 추가를 확인하고 검증합니다: # AttributeConfigurationSpec <<-MSG It looks like #{relation_class}, which is exported using the project Import/Export, has new attributes: Please add the attribute(s) to SAFE_MODEL_ATTRIBUTES if they can be exported. Please denylist the attribute(s) in IMPORT_EXPORT_CONFIG by adding it to its corresponding model in the +excluded_attributes+ section. SAFE_MODEL_ATTRIBUTES: #{File.expand_path(safe_attributes_file)} IMPORT_EXPORT_CONFIG: #{Gitlab::ImportExport.config_file} MSG ModelConfigurationSpec 은 새 모델 추가