Repository navigation
[FSSDK-13489] Fix Arnica findings: artipacked workflows, LGPL dependency, TLS context, manifest - #544
Open
Esra Kartal (esrakartalOpt) wants to merge 2 commits into
Open
Esra Kartal (esrakartalOpt) wants to merge 2 commits into
Esra Kartal (esrakartalOpt) wants to merge 2 commits into
Conversation
…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>
Alex Yong (alexjoeyyong)
left a comment
Contributor
There was a problem hiding this comment.
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: falseis safe. The onlygitin the Gradle build is the SCM URLs in the POM (build.gradle:344-346). The publish step uses Maven credentials from env vars.integration_testspassed with theci-helper-toolscheckout hardened.- The findbugs removal is exercised. The
buildjob runs:test-app:minifyDebugWithR8and:test-app:minifyReleaseWithR8and both pass. The only remaining references are the ProGuard-dontwarnand the twoexcludelines. - The new unit test runs in CI.
./gradlew buildruns:shared:testDebugUnitTest(testAllModulesonly runs:shared:connectedAndroidTest, so thebuildjob is the one that covers it). - "TLS" to "TLSv1.2" is equivalent here. Every socket is already pinned to TLSv1.2 by
enableTLSOnSocket.
Nits
TLSSocketFactoryTestprobably can't fail for the reason it names. It runs on the host JVM (CI uses Temurin 17), where anSSLContextof"TLSv1.2"likely already yields[TLSv1.2]as enabled protocols. The test would then pass even ifenableTLSOnSocketwere deleted. I couldn't run it. Please delete thesetEnabledProtocolscall 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-16now sits over gson alone, andminSdkVersionis 21. - The description says the factory is "used on API 21 and 22".
Client.javagates it onSDK_INT <= LOLLIPOP(21), so it's API 21 only. - Follow-up, not this PR:
build.ymlinterpolates${{ inputs.github_tag }}straight into arun: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-73also builds anSSLContextand 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
persist-credentials: falseto all 4actions/checkoutsteps:build.yml(1) andandroid.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 fromoptimizely/ci-helper-toolsthat only usecurlwith a token passed through env vars, and the Gradle publish step uses Maven credentials from env vars.com.google.code.findbugs:annotations:3.0.0(LGPL-2.1) fromtest-app/build.gradle. It was added for API-16, buttest-appnow hasminSdkVersion 21. The published modules already excludecom.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-dontwarnline. The stale// required by API-16comment abovegsonnow says whatgsonis for.TLSSocketFactory: useSSLContext.getInstance("TLSv1.2")instead of"TLS"(Arnica weak SSL context finding). Behavior is unchanged, because every socket the factory creates is already limited toTLSv1.2byenableTLSOnSocket, andClient.javaalready requests"TLSv1.2". The factory is only used on API 21:Client.javagates it onSDK_INT <= LOLLIPOP.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 thatenableTLSOnSocketpins the sockets by itself.test-app/src/main/AndroidManifest.xml: document and suppress the "Exported activity" finding.SplashScreenActivityis the launcher activity, and launcher activities must beexported="true"on Android 12+. It is a false positive. The suppression is a barenosemgrepbecause the full rule id was not visible, so if Arnica does not honor it, dismiss the finding there with that reason.Test plan
TLSSocketFactoryTesthas two tests. One checks the default factory only enablesTLSv1.2. The other builds the factory from a plain"TLS"context, which allows several protocols, and checks the sockets are still limited toTLSv1.2. The second test fails if thesetEnabledProtocolscall inenableTLSOnSocketis removed (checked by deleting that call and re-running). The first version of this test passed even without that call.buildjob runs them through:shared:testDebugUnitTest.test-appis covered by the CIbuildjob, which builds the test app.Issues
🤖 Generated with Claude Code