Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ android {

defaultConfig {
applicationId = "com.sseotdabwa.buyornot"
versionCode = 7
versionName = "0.3.1"
versionCode = 8
versionName = "0.3.2"

buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"${localProperties.getProperty("kakao.nativeAppKey", "")}\"")
manifestPlaceholders["NATIVE_APP_KEY"] = localProperties.getProperty("kakao.nativeAppKey", "")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sseotdabwa.buyornot.ui

import android.util.Log
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue | ๐ŸŸ  Major | โšก Quick win

ViewModel์—์„œ userId ์ง์ ‘ ๋กœ๊น…์€ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

Line 36์˜ ๋กœ๊ทธ๋Š” ๊ฐœ์ธ ์‹๋ณ„์ž๋ฅผ ํ‰๋ฌธ์œผ๋กœ ๋‚จ๊น๋‹ˆ๋‹ค. analytics.identify(...) ํ˜ธ์ถœ๋งŒ์œผ๋กœ ๋ชฉ์ ์ด ๋‹ฌ์„ฑ๋˜๋ฏ€๋กœ ์ง์ ‘ ๋กœ๊ทธ๋Š” ๋นผ๋Š” ํŽธ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๐Ÿ”ง ์ œ์•ˆ ์ˆ˜์ •์•ˆ
-import android.util.Log
@@
             .distinctUntilChanged()
             .onEach { userId ->
-                Log.d("BuyOrNotViewModel", "userId: $userId")
                 analytics.identify(if (userId != 0L) userId.toString() else null)
             }.launchIn(viewModelScope)

Also applies to: 36-36

๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/sseotdabwa/buyornot/ui/BuyOrNotViewModel.kt` at line 3,
Remove the direct logging of the user's identifier: delete the Log usage that
prints userId (and remove the android.util.Log import) in BuyOrNotViewModel.kt,
and rely solely on the existing analytics.identify(...) call to record identity;
locate calls referencing userId and the Log class in the ViewModel (the logger
line around the analytics.identify(...) invocation) and remove that log
statement so PII is not written to logs.

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.sseotdabwa.buyornot.core.analytics.Analytics
Expand Down Expand Up @@ -32,6 +33,7 @@ class BuyOrNotViewModel @Inject constructor(
userPreferencesRepository.userId
.distinctUntilChanged()
.onEach { userId ->
Log.d("BuyOrNotViewModel", "userId: $userId")
analytics.identify(if (userId != 0L) userId.toString() else null)
}.launchIn(viewModelScope)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ package com.sseotdabwa.buyornot.core.analytics

import android.util.Log

class DebugAnalytics : Analytics {
class DebugAnalytics(
private val appVersion: String,
) : Analytics {
private var userId: String? = null

override fun track(event: AnalyticsEvent) {
Log.d("Analytics", event.toString())
val superProps = "platform=android, app_version=$appVersion, user_id=$userId"
Log.d("Analytics", "$event [$superProps]")
Comment on lines +11 to +12
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue | ๐ŸŸ  Major | โšก Quick win

userId ํ‰๋ฌธ ๋กœ๊ทธ๋Š” ๊ฐœ์ธ์ •๋ณด ๋…ธ์ถœ ์œ„ํ—˜์ด ์žˆ์Šต๋‹ˆ๋‹ค.

Line 11-12, Line 17์—์„œ ์‚ฌ์šฉ์ž ์‹๋ณ„์ž๊ฐ€ ๊ทธ๋Œ€๋กœ Logcat์— ๋‚จ์Šต๋‹ˆ๋‹ค. ๋””๋ฒ„๊ทธ ํ™˜๊ฒฝ์ด๋ผ๋„ ์™ธ๋ถ€ ๋ฐฐํฌ/๋กœ๊ทธ ์ˆ˜์ง‘ ์‹œ ์œ ์ถœ ๊ฒฝ๋กœ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์ตœ์†Œ ๋งˆ์Šคํ‚น ๋˜๋Š” ๋กœ๊ทธ ์ œ์™ธ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”ง ์ œ์•ˆ ์ˆ˜์ •์•ˆ
 class DebugAnalytics(
     private val appVersion: String,
 ) : Analytics {
     private var userId: String? = null

     override fun track(event: AnalyticsEvent) {
-        val superProps = "platform=android, app_version=$appVersion, user_id=$userId"
+        val maskedUserId = userId?.let { "***${it.takeLast(2)}" }
+        val superProps = "platform=android, app_version=$appVersion, user_id=$maskedUserId"
         Log.d("Analytics", "$event [$superProps]")
     }

     override fun identify(userId: String?) {
         this.userId = userId
-        Log.d("Analytics", "identify: userId=$userId")
+        Log.d("Analytics", "identify called")
     }
 }

Also applies to: 16-17

๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/analytics/src/main/java/com/sseotdabwa/buyornot/core/analytics/DebugAnalytics.kt`
around lines 11 - 12, ํ˜„์žฌ DebugAnalytics.kt์—์„œ superProps์— userId๋ฅผ ํ‰๋ฌธ์œผ๋กœ ํฌํ•จํ•ด
Log.d("Analytics", ...)์— ์ถœ๋ ฅํ•˜๊ณ  ์žˆ์–ด ๊ฐœ์ธ์ •๋ณด ์œ ์ถœ ์œ„ํ—˜์ด ์žˆ์Šต๋‹ˆ๋‹ค; ์ˆ˜์ • ๋ฐฉ๋ฒ•์€ Log ํ˜ธ์ถœ์—์„œ userId๋ฅผ ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜
์ตœ์†Œํ•œ ๋งˆ์Šคํ‚น ์ฒ˜๋ฆฌํ•˜์—ฌ ๋…ธ์ถœ์„ ์ฐจ๋‹จํ•˜๋Š” ๊ฒƒ์ด๋ฉฐ(์˜ˆ: ๊ตฌํ˜„๋œ maskUserId(userId: String): String ์‚ฌ์šฉ ๋˜๋Š” ์ƒˆ๋กœ
์ถ”๊ฐ€), superProps ์กฐ๋ฆฝ๋ถ€(๋ณ€์ˆ˜ superProps)์™€ ๋กœ๊ทธ ํ˜ธ์ถœ(Log.d)์—์„œ plain userId ๋Œ€์‹ 
maskUserId(userId) ๋˜๋Š” ์™„์ „ ์ œ๊ฑฐ๋œ ๊ฐ’์œผ๋กœ ๋Œ€์ฒดํ•˜๊ณ  ํ…Œ์ŠคํŠธ ๋กœ๊ทธ(๋˜๋Š” debug-only ๋นŒ๋“œ)์—์„œ๋„ ๋™์ผ ์ฒ˜๋ฆฌ๊ฐ€ ์ ์šฉ๋˜๋„๋ก
์ˆ˜์ •ํ•˜์„ธ์š”.

}

override fun identify(userId: String?) {
this.userId = userId
Log.d("Analytics", "identify: userId=$userId")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ object AnalyticsModule {
@Singleton
fun provideAnalytics(
@ApplicationContext context: Context,
): Analytics =
if (BuildConfig.DEBUG) {
DebugAnalytics()
): Analytics {
val appVersion =
context.packageManager
.getPackageInfo(context.packageName, 0)
.versionName
?: "unknown"
return if (BuildConfig.DEBUG) {
DebugAnalytics(appVersion)
} else {
val mixpanel =
MixpanelAPI.getInstance(
Expand All @@ -37,4 +42,5 @@ object AnalyticsModule {
?: "unknown"
MixpanelAnalytics(mixpanel, appVersion)
}
}
}
Loading