Skip to content

Use sipHash128 instead of MD5 in test 05565_uniq_exact_variadic_chunked_keys - #130141

Merged
azat merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05565-fips-md5
Nov 8, 2026
Merged

azat merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05565-fips-md5

Conversation

@groeneai

@groeneai groeneai commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #129941

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Use sipHash128 instead of MD5 in the stateless test 05565_uniq_exact_variadic_chunked_keys, so it also passes when OpenSSL FIPS mode is enabled.

Description

05565_uniq_exact_variadic_chunked_keys (added in #129941) fingerprints every serialized uniqExact*State as hex(MD5(hex(state))). In FIPS mode MD5 throws Code: 344 ... Function MD5 is not available in FIPS mode. (SUPPORT_IS_DISABLED) at analysis, so the test fails at its first state query (query 12, line 42). The FIPS job runs only in the private CI (CH Inc sync), so I cannot link a public failing job.

The hash only compresses a long hex string into a 128-bit fingerprint. The change replaces MD5 with sipHash128 (no OpenSSL, also FixedString(16)) at all 69 call sites, the same substitution as #125750 and #125527, and keeps the test in the FIPS job instead of skipping it there. Only the fingerprint fields of the .reference change; I derived them from a run printing both hashes of each state, whose MD5 halves equal the old reference, so the new reference fingerprints the same states.

Validation: with FIPS mode turned on through OPENSSL_CONF (default_properties = fips=yes), master's test fails with the reported error and the fixed test passes 20/20 with randomized settings. This config does not load the FIPS provider module, so it is not a full FIPS build. Without FIPS the fixed test passes 50/50 with randomized settings, with unchanged run time.


Workflow [PR]
Sync PR [sync-upstream/pr/130141]

Version info

  • Merged into: 26.11.1.1671-master (included in 26.11 and later)

…ed_keys

The test fingerprints each serialized uniqExact*State as hex(MD5(hex(state))).
MD5 is refused in OpenSSL FIPS mode (FunctionMD5 throws SUPPORT_IS_DISABLED at
analysis), so in a FIPS build the test fails at its first state query
(query 12, line 42) and at every later one.

The digest is incidental: it only compresses a long hex string into a 128-bit
fingerprint. Replace MD5 with sipHash128 at all 69 call sites: it needs no
OpenSSL, exists in every build including Fast test, and returns
FixedString(16) like MD5, so the reference keeps its shape and size. Same
substitution as ClickHouse#125750 and ClickHouse#125527.

The new fingerprints were taken from a run printing both hashes of every
state: all 286 MD5 halves equal the old reference and the old-to-new mapping
is a bijection, so the reference still asserts the same states.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold review of the diff (0 findings).

# Sev Finding Verdict Evidence / action
- - No findings - Checked: the .sql diff is only MD5( -> sipHash128( (69 sites); in the .reference every non-fingerprint field is byte-identical and the old-to-new fingerprint mapping is a bijection over 109 distinct values.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Session id: cron:clickhouse-review-slot-9:20261108-120300

@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. With OPENSSL_CONF setting default_properties = fips=yes, master's test fails 3/3 through clickhouse local and 1/1 through clickhouse-test with Code: 344 ... Function MD5 is not available in FIPS mode. (SUPPORT_IS_DISABLED) (query 12, line 42).
b Root cause explained? Yes. SQL MD5 binds to FunctionMD5, whose constructor throws SUPPORT_IS_DISABLED when isFIPSEnabled() (src/Functions/FunctionMD5.cpp). The test calls MD5 at 69 sites, so every state query fails at analysis.
c Fix matches root cause? Yes. The incidental FIPS-refused digest is replaced by sipHash128 (no OpenSSL, same 128-bit width); no tag, no skip.
d Test intent preserved / new tests added? Yes. The same 14 state queries assert the same states. A run printing both hashes per state shows the MD5 halves equal the old reference and the old-to-new mapping is a bijection.
e Both directions demonstrated? Yes. Master text fails under FIPS; the fixed test passes 3/3 (clickhouse local) and 20/20 (clickhouse-test, randomized settings) under FIPS, and 50/50 without FIPS.
f Fix is general across code paths? Other stateless tests calling MD5/SHA1/MD4/RIPEMD160 are tagged no-openssl-fips, long, or use it only in a comment or data file; none is changed here.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change of an incidental digest).
h Backward compatible? (maintainer-approved exception only) Yes. No product code changes.
i Invariants and contracts preserved? Yes. Fingerprint width, line and field structure, and size of the reference are unchanged; the states are unchanged.

Session id: cron:clickhouse-impl-slot-7:20261108-114800

@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov, could you review this and add the can be tested label so CI runs? The test added in #129941 fingerprints states with MD5, which throws SUPPORT_IS_DISABLED when OpenSSL FIPS mode is on, so this swaps it for sipHash128 (same 128-bit width, no OpenSSL); only the fingerprint fields of the reference change.

@clickhouse-gh

clickhouse-gh Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bf5793d]

Summary: ✅


AI Review

Summary

PR #130141 replaces MD5 with sipHash128 in 05565_uniq_exact_variadic_chunked_keys so FIPS mode does not reject its state-fingerprint queries. No actionable findings. All 69 SQL substitutions are isolated; all non-fingerprint reference values remain unchanged, and the 286 fingerprint replacements preserve a bijection across 109 distinct values. The Fast test report confirms this test passed at the reviewed head.

Missing context / blind spots
  • ⚠️ A full FIPS-provider build was not independently tested. The PR documents repeated runs enabling the FIPS guard through OPENSSL_CONF; source inspection confirms sipHash128 has no OpenSSL dependency.
Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 8, 2026
@azat azat self-assigned this Nov 8, 2026
@azat
azat added this pull request to the merge queue Nov 8, 2026
Merged via the queue into ClickHouse:master with commit 7e1ef32 Nov 8, 2026
374 of 375 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 8, 2026
@clickhouse-gh clickhouse-gh Bot added comp-aggregate-functions Aggregate function implementations (sum, avg, count, quantile, combinators, etc.). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-aggregate-functions Aggregate function implementations (sum, avg, count, quantile, combinators, etc.). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants