GitHub user ppkarwasz added a comment to the discussion: CloudStack SBOM improvements
For the 71 native libraries hidden in `cloudstack.jar` there is also a better solution: stop shipping them! :wink: They come from a handful of JNI libraries: JNA, snappy-java, zstd-jni, lz4-java and Netty's native transports (which are based on APR, APR-util, Tomcat native, and an OpenSSL fork BoringSSL that doesn't issue CVEs). Several of these are packaged by GNU/Linux distributions, and the distribution versions are better suited to our use case. For example, on Debian 12: | Maven artifact | Debian package | Native part links against | |---|---|---| | `net.java.dev.jna:jna` | `libjna-java` + `libjna-jni` | `libffi8` | | `com.github.luben:zstd-jni` | `libzstd-jni-java` | `libzstd1` | | `org.lz4:lz4-java` | `liblz4-java` + `liblz4-jni` | `liblz4-1` | | `org.xerial.snappy:snappy-java` | `libsnappy-java` + `libsnappy-jni` | `libsnappy1v5` | The Maven JARs embed a static copy of the C library for every OS and CPU. The Debian ones contain no native code: they link to the system library, so a CVE in `libzstd` is fixed by the usual Debian security update, without a new CloudStack release. In short, the plan would be: 1. **Stop shading.** Shipping a single JAR may have been useful historically, but CloudStack binaries are now distributed as OS packages, and the management server already starts with `lib/*` on its classpath. 2. **Swap individual JARs for distribution packages.** Once every JAR is a separate file in `lib/`, the packaging scripts can replace, e.g., `lib/jna-5.x.jar` with a symlink `lib/jna.jar` → `/usr/share/java/jna.jar` and add `libjna-java` to the package's `Depends:`. In the SBOM, the embedded `pkg:maven/...` component becomes an external `pkg:deb/...` one. 3. **Get security fixes from the distribution.** Users would no longer need a new CloudStack release because a CVE was fixed in one of these libraries. Of course, this makes dependency management more complex: - The JAR and its native library must come from the same package, since the JNI code is bound to the Java classes it was built with. - The same `.deb` is installed on several Debian and Ubuntu releases, each with a different version of the library, so more testing is needed. - Distribution versions can also lag behind: Debian 12 ships snappy-java 1.1.8.3, while CloudStack uses 1.1.10.7. So this should be decided library by library, starting with JNA, which is used by the KVM agent. - On EL and SUSE, most of these packages are not available, so the RPMs would keep the Maven JARs. > [!NOTE] > Many of the JARs that contain native libraries also seem unnecessary, since > CloudStack does not use them in a way that needs the native code. For example: > > - `waffle-jna`, a Windows-only authentication library pulled in by the > MariaDB driver, is the only reason JNA is in `cloudstack-usage` and in the > system VMs; > - `zstd-jni` and `lz4-java` only come with `kafka-clients`, for the Kafka > event bus plugin; > - the Netty `kqueue` and macOS DNS resolver JARs cannot even load on Linux. > > Excluding them would make the SBOM slimmer, and reduce the churn caused by > new CVEs in components we ship but don't use, without having to write VEX > statements. It carries the same update and testing risks, though. GitHub link: https://github.com/apache/cloudstack/discussions/14657#discussioncomment-19516407 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
