Skip to content

[FSSDK-13489] Fix Arnica findings: artipacked workflows, LGPL dependency, TLS context, manifest - #544

Open
Esra Kartal (esrakartalOpt) wants to merge 2 commits into
masterfrom
esra/fssdk-13489-fix-arnica-findings
Open

Esra Kartal (esrakartalOpt) wants to merge 2 commits into
masterfrom
esra/fssdk-13489-fix-arnica-findings

Conversation

@esrakartalOpt

@esrakartalOpt Esra Kartal (esrakartalOpt) commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

  • Add persist-credentials: false to all 4 actions/checkout steps: build.yml (1) and android.yml (3). This stops the GitHub token being left in .git/config (Arnica artipacked findings). No later step needs git credentials: the integration step runs scripts from optimizely/ci-helper-tools that only use curl with a token passed through env vars, and the Gradle publish step uses Maven credentials from env vars.
  • Remove com.google.code.findbugs:annotations:3.0.0 (LGPL-2.1) from test-app/build.gradle. It was added for API-16, but test-app now has minSdkVersion 21. The published modules already exclude com.google.code.findbugs, so the test app now builds the way a real consumer app does. Nothing else in the repo uses it except a harmless ProGuard -dontwarn line. The stale // required by API-16 comment above gson now says what gson is for.
  • TLSSocketFactory: use SSLContext.getInstance("TLSv1.2") instead of "TLS" (Arnica weak SSL context finding). Behavior is unchanged, because every socket the factory creates is already limited to TLSv1.2 by enableTLSOnSocket, and Client.java already requests "TLSv1.2". The factory is only used on API 21: Client.java gates it on SDK_INT <= LOLLIPOP.
  • Add a package-private TLSSocketFactory(SSLContext) constructor (the public constructor calls it). It is only there so a test can pass a context that allows more than TLSv1.2 and check that enableTLSOnSocket pins the sockets by itself.
  • test-app/src/main/AndroidManifest.xml: document and suppress the "Exported activity" finding. SplashScreenActivity is the launcher activity, and launcher activities must be exported="true" on Android 12+. It is a false positive. The suppression is a bare nosemgrep because the full rule id was not visible, so if Arnica does not honor it, dismiss the finding there with that reason.

Test plan

  • TLSSocketFactoryTest has two tests. One checks the default factory only enables TLSv1.2. The other builds the factory from a plain "TLS" context, which allows several protocols, and checks the sockets are still limited to TLSv1.2. The second test fails if the setEnabledProtocols call in enableTLSOnSocket is removed (checked by deleting that call and re-running). The first version of this test passed even without that call.
  • I compiled and ran the tests with the JDK (Java 17) and JUnit 4.13.2, but not through Gradle, because there is no Android SDK on my machine. They run on a JVM, so they check the pinning logic and not behavior on a real API 21 device. The CI build job runs them through :shared:testDebugUnitTest.
  • Both workflow files and the manifest parse as valid YAML/XML.
  • The removal of the findbugs dependency in test-app is covered by the CI build job, which builds the test app.

Issues

  • FSSDK-13489

🤖 Generated with Claude Code

…ncy, TLS context, manifest

- Add persist-credentials: false to all actions/checkout steps in build.yml and
  android.yml so the GitHub token is not left in .git/config.
- Remove com.google.code.findbugs:annotations (LGPL-2.1) from test-app. It was
  added for API-16 and test-app now has minSdk 21; published modules already
  exclude it.
- Use SSLContext.getInstance("TLSv1.2") in TLSSocketFactory and add a unit test
  that sockets only enable TLSv1.2.
- Document and suppress the exported launcher activity finding in the test-app
  manifest (false positive: launcher activities must be exported on Android 12+).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@alexjoeyyong Alex Yong (alexjoeyyong) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: approve (with non-blocking nits). Posted as a comment review.

CI: all checks pass (lint, build, integration, the 28/33/36 emulator tests, compat suite). The Arnica check is NEUTRAL, so I can't see from it whether each finding cleared.

Checked myself:

  • persist-credentials: false is safe. The only git in the Gradle build is the SCM URLs in the POM (build.gradle:344-346). The publish step uses Maven credentials from env vars. integration_tests passed with the ci-helper-tools checkout hardened.
  • The findbugs removal is exercised. The build job runs :test-app:minifyDebugWithR8 and :test-app:minifyReleaseWithR8 and both pass. The only remaining references are the ProGuard -dontwarn and the two exclude lines.
  • The new unit test runs in CI. ./gradlew build runs :shared:testDebugUnitTest (testAllModules only runs :shared:connectedAndroidTest, so the build job is the one that covers it).
  • "TLS" to "TLSv1.2" is equivalent here. Every socket is already pinned to TLSv1.2 by enableTLSOnSocket.

Nits

  • TLSSocketFactoryTest probably can't fail for the reason it names. It runs on the host JVM (CI uses Temurin 17), where an SSLContext of "TLSv1.2" likely already yields [TLSv1.2] as enabled protocols. The test would then pass even if enableTLSOnSocket were deleted. I couldn't run it. Please delete the setEnabledProtocols call and re-run: if it still passes, assert something the factory alone guarantees.
  • Bare <!-- nosemgrep --> suppresses every rule on that element, and the PR is unsure Arnica honors it. Confirm the finding clears; otherwise dismiss it in Arnica with the launcher-activity reason.
  • Stale comment in test-app/build.gradle: // required by API-16 now sits over gson alone, and minSdkVersion is 21.
  • The description says the factory is "used on API 21 and 22". Client.java gates it on SDK_INT <= LOLLIPOP (21), so it's API 21 only.
  • Follow-up, not this PR: build.yml interpolates ${{ inputs.github_tag }} straight into a run: line. The callers pass constants, so it's low risk, but it is the template-injection pattern a hardening pass looks for. Client.java:72-73 also builds an SSLContext and discards it.

…, fix stale comment

- Add a package-private TLSSocketFactory(SSLContext) constructor so a test can pass
  a context that allows more than TLSv1.2. The new test fails if enableTLSOnSocket
  stops pinning sockets to TLSv1.2 (the old test passed even without it).
- Fix the stale "required by API-16" comment on gson in test-app/build.gradle.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants