Skip to content

FIREFLY-1982 Fix high and critical CVEs in Firefly container image#1942

Merged
loitly merged 6 commits intodevfrom
FIREFLY-1982-fix-cve
Apr 23, 2026
Merged

FIREFLY-1982 Fix high and critical CVEs in Firefly container image#1942
loitly merged 6 commits intodevfrom
FIREFLY-1982-fix-cve

Conversation

@loitly
Copy link
Copy Markdown
Contributor

@loitly loitly commented Apr 20, 2026

Ticket: https://jira.ipac.caltech.edu/browse/FIREFLY-1982
Additional changes here: https://github.com/IPAC-SW/irsa-ife/pull/463

This PR addresses the HIGH and CRITICAL severity CVEs identified in the current Firefly container image to improve security and meet compliance requirements.

The work included scanning the image, identifying affected packages and dependencies, updating vulnerable components, rebuilding the image, and re-scanning to verify the fixes.

Report was generated with:

docker run --rm \
  -v /var/run/docker.sock:/var/run/docker.sock \
  aquasec/trivy:0.69.3 image ipac/firefly > report.txt

NOTE: The final scan report has been attached to the ticket as final.txt.

Changes included

Container / base image

  • Updated the Tomcat base runtime image
  • Reduced Ubuntu vulnerabilities significantly by moving to a newer runtime base

Dependency and library updates

  • Migrated ehcache from 2.10 to 3.11
    • required API-breaking code changes
    • removed reliance on old bundled Jackson libraries with known CVEs
  • Updated Jackson library to 2.21
  • Updated msgpack to 0.9.11
  • Updated reflections from 0.9.11 to 0.10.2
  • removed dependency on com.google.guava:guava, which carried additional CVEs
  • Updated log4j from 1.20.0 to 2.25.4
  • Updated nimbus-jose-jwt from 9.37.2 to 9.37.4
  • Updated jakarta.mail from 2.0.2 to 2.0.4
  • Updated commons-fileupload2-jakarta from 2.0.0-M1 to commons-fileupload2-jakarta-servlet6:2.0.0-M5
  • Updated s3-transfer-manager from 2.33.11 to 2.42.35

Code cleanup / removals

  • Replaced Spring JDBC with custom helper classes
  • Refactored JDBC access code
  • Refactored Format and FormatUtil
  • Removed the DuckDB magic extension
  • Added log4j-slf support

Results

Base image

  • Ubuntu CVEs: 206 → 23 (no HIGH/CRITICAL)

Java (jar)

  • Initial: LOW: 8, MEDIUM: 25, HIGH: 20, CRITICAL: 2
  • After base + ehcache: LOW: 6, MEDIUM: 22, HIGH: 16, CRITICAL: 1
  • After reflections + dependency updates: LOW: 1, MEDIUM: 6, HIGH: 5, CRITICAL: 1
  • After removing Spring JDBC(Final): LOW: 0, MEDIUM: 2, HIGH: 0, CRITICAL: 0

Regression testing is required to ensure everything continues to work as before:
https://fireflydev.ipac.caltech.edu/firefly-1982-fix-cve/firefly/
https://firefly-1982-fix-cve.irsakubedev.ipac.caltech.edu/irsaviewer/
https://firefly-1982-fix-cve.irsakubedev.ipac.caltech.edu/applications/spherex/

loitly added 5 commits April 20, 2026 15:54
- Reduce Ubuntu vulnerabilities from 206 to 23 (medium and low only).
- Reduce Java (LOW: 8, MEDIUM: 25, HIGH: 20, CRITICAL: 2) to (LOW: 6, MEDIUM: 22, HIGH: 16, CRITICAL: 1)
- no ehcache.xml.  many code changes
- The old ehcache bundled older versions of Jackson library that has CVE
update jackson library to 2.21
update msgpack to 0.9.11
remove ‘magic’ extension from duckdb
add log4j-slf support

Results:
ipac/firefly:loi (ubuntu 24.04)
===============================
Total: 23 (UNKNOWN: 0, LOW: 13, MEDIUM: 10, HIGH: 0, CRITICAL: 0)
Total: 11 (UNKNOWN: 0, LOW: 3, MEDIUM: 8, HIGH: 0, CRITICAL: 0)

Java (jar)
==========
Total: 45 (UNKNOWN: 0, LOW: 6, MEDIUM: 22, HIGH: 16, CRITICAL: 1)
Total: 25 (UNKNOWN: 0, LOW: 2, MEDIUM: 14, HIGH: 8, CRITICAL: 1)
- This remove dependency from com.google.guava:guava, which has 2 medium and 1 low CVE
Results:
Java (jar)
==========
Total: 25 (UNKNOWN: 0, LOW: 2, MEDIUM: 14, HIGH: 8, CRITICAL: 1)
Total: 22 (UNKNOWN: 0, LOW: 1, MEDIUM: 12, HIGH: 8, CRITICAL: 1)
       nimbus-jose-jwt:9.37.2 -> nimbus-jose-jwt:9.37.4
       jakarta.mail:2.0.2 -> jakarta.mail:2.0.4
       commons-fileupload2-jakarta:2.0.0-M1 -> commons-fileupload2-jakarta-servlet6:2.0.0-M5
       s3-transfer-manager:2.33.11 -> s3-transfer-manager:2.42.35

Results:
Java (jar)
==========
Total: 22 (UNKNOWN: 0, LOW: 1, MEDIUM: 12, HIGH: 8, CRITICAL: 1)
Total: 13 (UNKNOWN: 0, LOW: 1, MEDIUM: 6, HIGH: 5, CRITICAL: 1)
- Refactored JDBC access code
- Refactored Format and FormatUtil

Results:
Java (jar)
==========
Total: 13 (UNKNOWN: 0, LOW: 1, MEDIUM: 6, HIGH: 5, CRITICAL: 1)
Total: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 2, HIGH: 0, CRITICAL: 0)
@loitly loitly self-assigned this Apr 21, 2026
Copy link
Copy Markdown
Contributor

@robyww robyww left a comment

Choose a reason for hiding this comment

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

The code looks good to me. I will try to do more testing.

setHeader(HttpHeaders.USER_AGENT, VersionUtil.getUserAgentString());
setHeader(HttpHeaders.ACCEPT_ENCODING, "gzip");
setHeader("User-Agent", VersionUtil.getUserAgentString());
setHeader("Accept-Encoding", "gzip");
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.

should be use all lowercase. I think you brought this up a few months ago.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HTTP header names are case-insensitive, so it does not matter. This way improves readability.

final long finalVisHeapBytes = visHeapBytes;
CacheManager manager = CacheManagerBuilder.newCacheManagerBuilder()
.using(visStats)
.using(new CustomSizeOfEngine.Provider(Long.MAX_VALUE, Long.MAX_VALUE))
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.

I wish I remembered why we had to compute sizeof ourselves. Something was not working.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, some cached objects reference classes in private modules. This provides a way to short-circuit and return the object’s size without relying on reflection.

}

public void batchUpdate(String sql, List<Object[]> paramsList) {
if (paramsList == null || paramsList.isEmpty()) return;
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.

CollectionUtil.isEmpty()?

Copy link
Copy Markdown
Contributor

@kpuriIpac kpuriIpac left a comment

Choose a reason for hiding this comment

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

I tested all 3 apps, did all basic searches once and didn't find any new issues. I'll test some more tomorrow as well, but looks good to me so far.

@robyww robyww added this to the 2026.1 milestone Apr 22, 2026
@loitly loitly merged commit 37774b0 into dev Apr 23, 2026
@loitly loitly deleted the FIREFLY-1982-fix-cve branch April 23, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants