[improve][misc] Replace MD5 NAR/archive checksums with SHA-256#26152
Merged
david-streamlio merged 2 commits intoJul 9, 2026
Conversation
These digests are change-detection checksums, not security controls, but MD5 is rejected outright by strict security providers (e.g. BC-FIPS in approved-only mode), which would break NAR extraction and connector/function archive reload on FIPS-configured JVMs. Switch to SHA-256 and rename the APIs to be algorithm-accurate. The NAR extraction directory name changes, causing a one-time re-extraction after upgrade; stale checksum-named directories from older versions are left behind in the extraction dir, matching existing behavior across NAR content changes.
david-streamlio
force-pushed
the
fips-qw-archive-checksums
branch
from
July 6, 2026 17:16
c049537 to
3da449e
Compare
This was referenced Jul 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Pulsar’s non-security checksum-based change-detection mechanisms to use SHA-256 instead of MD5, avoiding failures on FIPS-configured JVMs where weak digests can be rejected (e.g., MessageDigest.getInstance("md5") throwing under strict providers). The change affects NAR unpacking directory/lock naming and connector/function archive identity checks used for hot reload.
Changes:
- Replaced
FileUtils.calculateMd5sumwithFileUtils.calculateSha256sum(SHA-256; larger read buffer; clarified javadoc that it’s for change detection). - Updated
NarUnpackerto derive extraction directory and lockfile names from the SHA-256 checksum. - Renamed connector/function archive identity helpers and fields from “Md5” to generic “Checksum” and switched to SHA-256 hex.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/io/ConnectorUtils.java | Uses SHA-256 hex for connector archive identity during reload; renames helper to checksum-based name. |
| pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/io/Connector.java | Renames stored archive digest field/accessor to checksum and computes SHA-256 via updated utility. |
| pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functions/FunctionUtils.java | Uses SHA-256 hex for function archive identity during reload; renames helper to checksum-based name. |
| pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functions/FunctionArchive.java | Renames stored archive digest field/accessor to checksum and computes SHA-256 via updated utility. |
| pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarUnpacker.java | Switches unpack directory + lock naming from MD5 to SHA-256 checksum. |
| pulsar-common/src/main/java/org/apache/pulsar/common/nar/FileUtils.java | Implements SHA-256 checksum calculation and updates documentation accordingly. |
merlimat
approved these changes
Jul 8, 2026
Dream95
approved these changes
Jul 9, 2026
dao-jun
approved these changes
Jul 9, 2026
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.
Motivation
FileUtils.calculateMd5sumbacks two non-security change-detection mechanisms: the NAR extraction directory checksum (NarUnpacker) and the connector/function archive identity used for hot-reload (ConnectorUtils/FunctionUtils). MD5 is fine for change detection, but strict security providers reject it outright — under BC-FIPS in approved-only mode,MessageDigest.getInstance("md5")throws, which breaks NAR extraction (and therefore broker/worker startup with connectors) on FIPS-configured JVMs.This is one of a set of small preparatory cleanups for FIPS-restricted deployments; a broader PIP covering TLS provider wiring, packaging, and message-crypto algorithm migration is being drafted separately.
Modifications
FileUtils: replacedcalculateMd5sumwithcalculateSha256sum(SHA-256, larger read buffer); javadoc documents that the checksum is change detection, not a security control.NarUnpacker: uses the SHA-256 checksum for the extraction directory and lock-file names; local variable renamed accordingly.ConnectorUtils/FunctionUtils:computeArchiveMd5Hex→computeArchiveChecksumHex(SHA-256).Connector/FunctionArchive: field/accessor renames (getArchiveChecksumHex), javadoc updated.The archive checksum is only compared in-memory against values computed by the same JVM, so the algorithm change is not observable there. The NAR extraction directory name changes, causing a one-time re-extraction after upgrade; stale checksum-named directories from older versions are left behind in the extraction dir, matching existing behavior when NAR content changes.
Verifying this change
This change is already covered by existing tests:
NarUnpackerTest(extraction/locking against the new checksum naming),ConnectorUtilsReloadTestandFunctionUtilsReloadTest(archive-identity change detection).Does this pull request potentially affect one of the following parts: