Skip to content

Commit c6aee2b

Browse files
redact BCIT secrets from logs
1 parent b9f3561 commit c6aee2b

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/inapp-e2e-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ jobs:
190190
ITERABLE_SERVER_API_KEY: ${{ secrets.BCIT_ITERABLE_SERVER_API_KEY }}
191191
ITERABLE_TEST_USER_EMAIL: ${{ secrets.BCIT_ITERABLE_TEST_USER_EMAIL }}
192192

193+
# SDK-170: do NOT upload integration-tests/build/outputs/ — that path contains the
194+
# built APKs which embed BuildConfig.ITERABLE_API_KEY and BuildConfig.ITERABLE_SERVER_API_KEY
195+
# as compile-time string constants. On a public repo, anyone who can download the
196+
# artifact could `strings`/`apktool` the APK and recover both keys.
193197
- name: Upload E2E diagnostics
194198
if: always()
195199
uses: actions/upload-artifact@v4
@@ -198,7 +202,6 @@ jobs:
198202
path: |
199203
integration-tests/build/diagnostics/
200204
integration-tests/build/reports/
201-
integration-tests/build/outputs/
202205
if-no-files-found: warn
203206
retention-days: 7
204207

integration-tests/src/androidTest/java/com/iterable/integration/tests/InAppMessageIntegrationTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ class InAppMessageIntegrationTest : BaseIntegrationTest() {
130130
Assert.assertTrue("User should be signed in", userSignedIn)
131131
Log.d(TAG, "✅ User signed in successfully: ${TestConstants.TEST_USER_EMAIL}")
132132

133-
// Step 2: Debug API key configuration
134-
Log.d(TAG, "🔍 Debug: ITERABLE_API_KEY = ${BuildConfig.ITERABLE_API_KEY}")
135-
Log.d(TAG, "🔍 Debug: ITERABLE_SERVER_API_KEY = ${BuildConfig.ITERABLE_SERVER_API_KEY}")
136-
Log.d(TAG, "🔍 Debug: ITERABLE_TEST_USER_EMAIL = ${BuildConfig.ITERABLE_TEST_USER_EMAIL}")
133+
// SDK-170: log presence/length only (never values) — these end up in CI logcat artifacts.
134+
Log.d(TAG, "API key configured: length=${BuildConfig.ITERABLE_API_KEY.length}")
135+
Log.d(TAG, "Server API key configured: length=${BuildConfig.ITERABLE_SERVER_API_KEY.length}")
136+
Log.d(TAG, "Test user email configured: length=${BuildConfig.ITERABLE_TEST_USER_EMAIL.length}")
137137

138138
// Step 3: Try to trigger campaign via API (but don't fail if it doesn't work)
139139
Log.d(TAG, "🎯 Step 3: Attempting to trigger campaign via API...")

integration-tests/src/main/java/com/iterable/integration/tests/MainActivity.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,16 @@ class MainActivity : AppCompatActivity() {
8989
}
9090

9191
private fun setupUI() {
92-
// Set API key text
93-
findViewById<android.widget.TextView>(R.id.tvApiKey).text = "API Key: ${BuildConfig.ITERABLE_API_KEY}"
92+
// SDK-170: never render the full API key into the view hierarchy — the integration
93+
// tests CI captures hierarchy.xml and screenshot.png as artifacts on a public repo.
94+
// Show only enough to confirm a non-empty key was loaded.
95+
val apiKey = BuildConfig.ITERABLE_API_KEY
96+
val keyDisplay = when {
97+
apiKey.isEmpty() -> "API Key: (empty)"
98+
apiKey.length < 8 -> "API Key: (length=${apiKey.length})"
99+
else -> "API Key: ****${apiKey.takeLast(4)} (length=${apiKey.length})"
100+
}
101+
findViewById<android.widget.TextView>(R.id.tvApiKey).text = keyDisplay
94102

95103
findViewById<android.widget.Button>(R.id.btnPushNotifications).setOnClickListener {
96104
startActivity(Intent(this@MainActivity, PushNotificationTestActivity::class.java))

0 commit comments

Comments
 (0)