Skip to content

[FSSDK-13470] Fix Arnica findings: allowlist JSON library reflection, bump quickstart Jackson - #645

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

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

Conversation

@esrakartalOpt

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

Copy link
Copy Markdown
Contributor

Summary

  • Add JsonLibraryDetector, which only calls Class.forName for an allowlist of the four supported JSON library classes (Gson, Jackson, org.json, json-simple). It loads classes without initializing them, so no static initializer of the probed class runs.
  • Use it in DefaultConfigParser, JsonParserProvider and DefaultJsonSerializer, replacing their direct Class.forName(className) calls (Arnica CWE-470 unsafe reflection findings).
  • Bump java-quickstart Jackson to 2.23.0 (jackson-core, jackson-databind) and 2.23 (jackson-annotations, which drops the patch version since Jackson 2.20). This fixes the SCA findings for jackson-core@2.17.0 and jackson-databind@2.17.0.

The three reflection findings were low risk: the class names come from hardcoded enum constants or string literals, never from user input. The allowlist makes that guarantee explicit and keeps one Class.forName call, which carries a nosemgrep comment. Arnica may still flag it on the next scan. If so, dismiss it there with the allowlist as the reason.

jackson-databind 2.23.0 only fixes 75% of its known vulnerabilities, per Arnica, so re-scan after merge.

Test plan

  • Added JsonLibraryDetectorTest: the four allowlisted libraries are detected, and non-allowlisted names (for example java.lang.Runtime), null, empty and unknown names are rejected.
  • ./gradlew :core-api:test :core-httpclient-impl:test pass.
  • ./gradlew :core-api:spotbugsMain and the license check pass.
  • ./gradlew :java-quickstart:compileJava passes, and the runtime classpath resolves Jackson to 2.23.0 / 2.23.

Issues

🤖 Generated with Claude Code

… bump quickstart Jackson

- Add JsonLibraryDetector: Class.forName is only called for an allowlist of
  supported JSON library classes and without initializing the class. Use it in
  DefaultConfigParser, JsonParserProvider and DefaultJsonSerializer
  (Arnica CWE-470 unsafe reflection findings).
- Bump java-quickstart Jackson to 2.23.0 (jackson-annotations 2.23) to fix
  jackson-core and jackson-databind SCA findings.

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

Copy link
Copy Markdown
Contributor

Approved. Two small non-blocking suggestions:

  1. nosemgrep placement (JsonLibraryDetector.java): Semgrep only honours nosemgrep on the same line as the finding or the line directly above it. Right now the explanation comment sits between them, so the suppression probably doesn't apply. Put the explanation first and // nosemgrep: java.lang.security.audit.unsafe-reflection.unsafe-reflection directly above Class.forName(...), or move it to the end of that line.

  2. Allowlist drift guard: the four class names are now duplicated in JsonLibraryDetector.ALLOWED_CLASS_NAMES, DefaultConfigParser.ConfigParserSupplier, JsonParserProvider and DefaultJsonSerializer. If someone later adds a parser to an enum and forgets the allowlist, isPresent quietly returns false and the library looks absent. A test that loops over ConfigParserSupplier.values() and JsonParserProvider.values() and checks that each className is allowlisted would catch that. It needs a package-visible accessor or an isAllowed(String) helper.

… guard

- Put the nosemgrep comment directly above Class.forName so Semgrep honours it.
- Add JsonLibraryDetector.isAllowed and tests that check every
  ConfigParserSupplier and JsonParserProvider class name is allowlisted.

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