[NDGL-108] Build Variant 설정, API Key Interceptor 추가, 난독화 설정#31
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
워크스루앱 수준의 빌드 구성 파일에서 기본 URL과 API 키를 BuildConfig 필드로 이동하고, 릴리스 빌드를 위한 서명 설정을 추가했습니다. API 키 인터셉터를 통해 모든 요청에 API 키를 자동으로 주입하는 DI 모듈을 도입했으며, 모듈 수준의 ProGuard 규칙을 consumer 규칙으로 통합하고 중복 구성을 제거했습니다. 변경사항
예상 코드 검토 노력🎯 3 (Moderate) | ⏱️ ~20 분 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (5)
data/travel/consumer-rules.pro (1)
2-2:-keep interface→-keep class변경 권장
-keep interface는interface선언 타입만 보호하며, 같은 패키지 내class,enum,@interface(어노테이션 타입)는 난독화/제거 대상이 됩니다. 현재api패키지는 Retrofit 서비스 인터페이스(PlaceApi, TravelProgramApi, TravelTemplateApi, UserTravelApi)만 포함하고 있어 안전하지만, 향후 헬퍼 클래스나 어노테이션 타입이 추가될 경우 런타임 오류가 발생할 수 있습니다. 1번 줄과 일관성을 맞추기 위해서도-keep class사용을 권장합니다.♻️ 제안 수정
-keep class com.yapp.ndgl.data.travel.model.** { *; } --keep interface com.yapp.ndgl.data.travel.api.** { *; } +-keep class com.yapp.ndgl.data.travel.api.** { *; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@data/travel/consumer-rules.pro` at line 2, 현재 ProGuard/R8 규칙에서 사용된 "-keep interface com.yapp.ndgl.data.travel.api.** { *; }"는 인터페이스만 보호하므로 향후 같은 패키지에 추가될 수 있는 클래스·enum·어노테이션을 보호하지 못합니다; 규칙을 "-keep class" 형태로 바꿔서 com.yapp.ndgl.data.travel.api 패키지 전체(예: PlaceApi, TravelProgramApi, TravelTemplateApi, UserTravelApi와 향후 추가될 헬퍼/어노테이션 타입)를 난독화/제거 대상에서 제외하도록 수정하세요.app/proguard-rules.pro (1)
21-21: [선택 사항] 릴리즈 빌드의 크래시 리포트 가독성을 위해 두 속성을 함께 활성화하는 것을 고려하세요.현재
-renamesourcefileattribute SourceFile(Line 21)와-keepattributes SourceFile,LineNumberTable(Line 17) 모두 주석 처리된 상태로 일관성은 있습니다. 다만, Firebase Crashlytics 등의 크래시 리포팅 툴과 함께 사용하는 경우, 두 옵션을 함께 활성화하면 ProGuard mapping 파일을 통해 릴리즈 빌드 스택 트레이스를 역난독화할 수 있어 디버깅이 용이해집니다.-#-keepattributes SourceFile,LineNumberTable + -keepattributes SourceFile,LineNumberTable -#-renamesourcefileattribute SourceFile + -renamesourcefileattribute SourceFile🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/proguard-rules.pro` at line 21, Uncomment and enable both ProGuard directives to improve crash-report readability: remove the comment for "-renamesourcefileattribute SourceFile" and also ensure "-keepattributes SourceFile,LineNumberTable" is enabled so release-stack traces can be deobfuscated via the mapping file; reference the exact directives "-renamesourcefileattribute SourceFile" and "-keepattributes SourceFile,LineNumberTable" when making the change.navigation/consumer-rules.pro (1)
1-1: 네비게이션 모듈의 keep 규칙이 지나치게 넓습니다.
com.yapp.ndgl.navigation.**의 모든 클래스와 멤버를 유지하면 R8 최적화 효과가 감소합니다. 실제로 리플렉션이나 직렬화에 사용되는 클래스(예: route 정의, sealed class)만 keep하는 것이 좋습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@navigation/consumer-rules.pro` at line 1, The current ProGuard/R8 keep rule keeps the entire package com.yapp.ndgl.navigation.**, which is too broad; narrow it to only the types actually needed at runtime via reflection/serialization (e.g., route definitions and sealed classes). Replace the wildcard keep with targeted keeps for specific classes or subpackages (for example, keep the route definition classes and any sealed/ADT classes used by navigation) and avoid keeping all members of the whole package so R8 can optimize the rest; locate the rule referencing com.yapp.ndgl.navigation.** and change it to explicit keep rules for the concrete class names or subpackages that require preservation.app/build.gradle.kts (1)
34-40:all블록의proguardFiles설정이configureKotlinAndroid()와 중복될 수 있습니다.기존 학습 내용에 따르면,
configureKotlinAndroid()가 이미 release buildType에 ProGuard 파일을 구성합니다.all블록에서 다시proguardFiles()를 호출하면 모든 buildType(debug 포함)에 ProGuard 규칙이 중복 추가될 수 있습니다. debug에서는isMinifyEnabled = false이므로 실질적 영향은 없지만, 중복 설정 여부를 확인해 주세요.Based on learnings: "configureKotlinAndroid() already configures ProGuard files for the release buildType."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/build.gradle.kts` around lines 34 - 40, The proguardFiles call inside the all { ... } block duplicates configuration already applied by configureKotlinAndroid() and can add ProGuard rules to buildTypes unnecessarily; remove the proguardFiles(...) invocation from the all block (or move it into an explicit release buildType block) and keep only the buildConfigField("String", "NDGL_API_KEY", ...) there so configureKotlinAndroid() remains the sole place that configures ProGuard for release builds and you avoid duplicate proguardFiles declarations.data/core/src/main/java/com/yapp/ndgl/data/core/di/NetworkModule.kt (1)
104-114: [선택적 리팩토링] Qualifier 어노테이션을 별도 파일로 분리하는 것을 고려하세요.
AuthClient,BaseUrl,ApiKey세 개의 qualifier가 모두NetworkModule.kt에 정의되어 있습니다. 현재는 기존AuthClient패턴과 일관성이 있으나, qualifier가 늘어날수록NetworkModule의 책임이 과중해집니다. 별도 파일(예:di/NetworkQualifiers.kt또는annotations/패키지)로 분리하면 단일 책임 원칙에 부합하고 임포트 경로도 더 명시적이 됩니다.♻️ 예시: 별도 파일로 분리
data/core/src/main/java/com/yapp/ndgl/data/core/di/NetworkQualifiers.kt신규 생성:+package com.yapp.ndgl.data.core.di + +import javax.inject.Qualifier + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class AuthClient + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class BaseUrl + +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class ApiKey
NetworkModule.kt에서 제거:-@Qualifier -@Retention(AnnotationRetention.BINARY) -annotation class AuthClient - -@Qualifier -@Retention(AnnotationRetention.BINARY) -annotation class BaseUrl - -@Qualifier -@Retention(AnnotationRetention.BINARY) -annotation class ApiKey🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@data/core/src/main/java/com/yapp/ndgl/data/core/di/NetworkModule.kt` around lines 104 - 114, The three qualifier annotations AuthClient, BaseUrl, and ApiKey are declared inside NetworkModule and should be extracted into a dedicated file to reduce NetworkModule responsibility; create a new Kotlin file (e.g., NetworkQualifiers.kt or an annotations package) containing the three `@Qualifier/`@Retention declarations (retain the same annotation names and AnnotationRetention.BINARY), remove them from NetworkModule, and update imports/usages in NetworkModule and any other files to reference the moved annotations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/build.gradle.kts`:
- Line 46: The build injects NDGL_BASE_URL_DEBUG/NDGL_BASE_URL_RELEASE via
buildConfigField using localProperties.getProperty(...) which returns null when
the key is missing and results in the literal "null" string in BuildConfig;
update the build logic around buildConfigField("String", "NDGL_BASE_URL", ...)
to supply a safe default (e.g., empty string or a validated fallback URL) when
localProperties.getProperty(...) is null — do this for both the DEBUG and
RELEASE variants by using a null-coalescing or getProperty(key, default)
approach (or an explicit null check) so BuildConfig.NDGL_BASE_URL never becomes
the string "null".
- Around line 20-27: The signingConfigs block crashes when
localProperties.getProperty("KEYSTORE_PATH") returns null; update the
create("release") block to guard all localProperties.getProperty(...) calls and
avoid calling file(null): fetch each property into local variables (e.g.,
keystorePath, keystoreStorePassword, keystoreAlias, keystoreKeyPassword), check
keystorePath for null/blank and only call file(keystorePath) and assign
storeFile when non-null, otherwise skip setting storeFile (and optionally skip
the whole signing config or set safe defaults); ensure storePassword, keyAlias
and keyPassword are set conditionally (or use safe fallback values) so
signingConfigs.create("release") no longer calls file(null) and does not crash
in CI.
---
Nitpick comments:
In `@app/build.gradle.kts`:
- Around line 34-40: The proguardFiles call inside the all { ... } block
duplicates configuration already applied by configureKotlinAndroid() and can add
ProGuard rules to buildTypes unnecessarily; remove the proguardFiles(...)
invocation from the all block (or move it into an explicit release buildType
block) and keep only the buildConfigField("String", "NDGL_API_KEY", ...) there
so configureKotlinAndroid() remains the sole place that configures ProGuard for
release builds and you avoid duplicate proguardFiles declarations.
In `@app/proguard-rules.pro`:
- Line 21: Uncomment and enable both ProGuard directives to improve crash-report
readability: remove the comment for "-renamesourcefileattribute SourceFile" and
also ensure "-keepattributes SourceFile,LineNumberTable" is enabled so
release-stack traces can be deobfuscated via the mapping file; reference the
exact directives "-renamesourcefileattribute SourceFile" and "-keepattributes
SourceFile,LineNumberTable" when making the change.
In `@data/core/src/main/java/com/yapp/ndgl/data/core/di/NetworkModule.kt`:
- Around line 104-114: The three qualifier annotations AuthClient, BaseUrl, and
ApiKey are declared inside NetworkModule and should be extracted into a
dedicated file to reduce NetworkModule responsibility; create a new Kotlin file
(e.g., NetworkQualifiers.kt or an annotations package) containing the three
`@Qualifier/`@Retention declarations (retain the same annotation names and
AnnotationRetention.BINARY), remove them from NetworkModule, and update
imports/usages in NetworkModule and any other files to reference the moved
annotations.
In `@data/travel/consumer-rules.pro`:
- Line 2: 현재 ProGuard/R8 규칙에서 사용된 "-keep interface
com.yapp.ndgl.data.travel.api.** { *; }"는 인터페이스만 보호하므로 향후 같은 패키지에 추가될 수 있는
클래스·enum·어노테이션을 보호하지 못합니다; 규칙을 "-keep class" 형태로 바꿔서
com.yapp.ndgl.data.travel.api 패키지 전체(예: PlaceApi, TravelProgramApi,
TravelTemplateApi, UserTravelApi와 향후 추가될 헬퍼/어노테이션 타입)를 난독화/제거 대상에서 제외하도록 수정하세요.
In `@navigation/consumer-rules.pro`:
- Line 1: The current ProGuard/R8 keep rule keeps the entire package
com.yapp.ndgl.navigation.**, which is too broad; narrow it to only the types
actually needed at runtime via reflection/serialization (e.g., route definitions
and sealed classes). Replace the wildcard keep with targeted keeps for specific
classes or subpackages (for example, keep the route definition classes and any
sealed/ADT classes used by navigation) and avoid keeping all members of the
whole package so R8 can optimize the rest; locate the rule referencing
com.yapp.ndgl.navigation.** and change it to explicit keep rules for the
concrete class names or subpackages that require preservation.
c25c2c2 to
10e57a6
Compare
10e57a6 to
7306636
Compare
NDGL-108 Build Variant 및 네트워크 요청 검증 헤더 추가, 난독화 설정
연관 문서
변경사항
서버 Base URL을 Build Type별로 분리
BuildConfig.NDGL_BASE_URL로 주입
(BuildConfig 기반)
API Key Interceptor 추가
Proguard 설정 방식 변경 (refactor)
적용
테스트 체크 리스트
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선 사항
기타