Skip to content

Feat/refactor/40#122

Open
YoungseoChoi23 wants to merge 15 commits intodevelopfrom
feat/refactor/40
Open

Feat/refactor/40#122
YoungseoChoi23 wants to merge 15 commits intodevelopfrom
feat/refactor/40

Conversation

@YoungseoChoi23
Copy link

🚀 [Feature] 멀티테넌트 시스템의 테넌트 격리 및 무결성 기능 구현

✅ Issue


✨ 작업 내용

10/19 추가 수정사항

TenantAwareEntity를 새로 생성하여 전역 기능과 테넌트별 기능이 각각 다른 엔티티를 상속받도록 수정

  • BaseEntity 수정 (tenant 필드 제거)
  • TenantAwareEntity 생성
  • BaseRepository 인터페이스 생성
  • 전역 기능이 TenantAwareRepository 대신 BaseRepository를 상속받도록 수정
    • FeatureFlag, CloudProviderRepository, PlatformConfigRepository, PlatformHealthRepository, LicenseRepository, FeatureFlagTargetRuleRepository, FeatureFlagRepository
  • 테넌트별 기능이 BaseRepository 대신 TenantAwareRepository를 상속받도록 수정
    • CloudResourceRepository
  • 테넌트별 기능이 BaseEntity 대신 TenantAwareEntity를 상속받도록 수정
    • User, Role, Permission, Organization, TenantConfig, TenantIsolation, TenantBilling, SecurityPolicy, ThreatDetection, Compliance, AuditLog, CloudResource

  • 멀티 테넌트 지원 시스템의 테넌트 격리 및 무결성 기능 구현
  1. TenantAware Repository 시스템 구현

    • TenantAwareRepository.java - 테넌트 인식 Repository 인터페이스
    • TenantAwareRepositoryImpl.java - 테넌트 인식 Repository 구현체
    • TenantAwareEntityListener.java - 테넌트 자동 주입 엔티티 리스너
  2. 핵심 기능 구현

    • 테넌트별 데이터 필터링: 모든 CRUD 작업에서 현재 테넌트 컨텍스트 자동 적용
    • 자동 테넌트 주입: 엔티티 생성/수정 시 현재 테넌트 정보 자동 설정
    • 보안 검증: 다른 테넌트 데이터 접근 시 예외 발생
    • 페이징 및 정렬: 테넌트 필터링과 함께 페이징/정렬 지원
    • Specification 지원: JPA Specification과 테넌트 필터링 결합
  3. 엔티티 수정

    • BaseEntity.java - tenant 필드 매핑 최적화 (insertable=false, updatable=false)
    • TenantCollectorConfig.java - tenant_id 컬럼 중복 매핑 문제 해결

🧪 테스트

  • 단위 테스트
    • BaseEntityTest.java (12개 테스트):

      • 테넌트 설정/조회/변경 테스트
      • JPA 매핑 및 지연로딩 검증
      • equals/hashCode/toString 테넌트 포함 확인
      • 엔티티 리스너 및 외래키 제약조건 검증
    • TenantAwareEntityListenerTest.java (12개 테스트):

      • 엔티티 생성/수정 시 테넌트 자동 설정 (성공/실패 케이스)
      • 테넌트 컨텍스트 없음 예외 처리
      • 이미 테넌트 설정된 경우 건너뛰기
      • BaseEntity가 아닌 객체/null 처리

🚀 다음 단계

  • 테넌트 격리 정책 오케스트레이션
    • 네트워크/데이터/컴퓨트/스토리지 격리 레벨별 자동 프로비저닝
    • 정책 변경 이벤트 (ex. SHARED->PRIVATE) 기반 재적용

✅ 체크리스트

  • 코드가 정상적으로 컴파일되나요?
  • mvn cleant test를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요? (feature/40 -> develop)
  • Label을 지정했나요? (feature)

@KwonSunJae KwonSunJae changed the base branch from main to develop October 24, 2025 17:17
@gitguardian
Copy link

gitguardian bot commented Oct 24, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
21859921 Triggered Generic High Entropy Secret 69a95f8 src/test/java/com/agenticcp/core/AgenticCpCoreApplicationTests.java View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant