Skip to content

Enforce single-component matching for SSL certificate wildcards - #108472

Merged
alexey-milovidov merged 5 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-ssl-cert-wildcard-single-label
Jun 27, 2026
Merged

alexey-milovidov merged 5 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-ssl-cert-wildcard-single-label

Conversation

@groeneai

@groeneai groeneai commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixed ssl_certificate user identification so a single * wildcard matches exactly one name component (RFC 6125 6.4.3). Previously a wildcard in a CN or DNS: SAN subject (for example *.corp.example.com) also matched multi-label names such as evil.deep.corp.example.com, letting a holder of a certificate for a deeper subdomain authenticate as the wildcard user. URI: SAN matching is unchanged.

Description

The ssl_certificate wildcard branch in checkSSLCertificateAuthentication constrained * only with an equal-slash-count check (comment: "* must not represent a / in URI"). CN and DNS: SAN subjects contain no slashes, so that check was always 0 == 0 and imposed no constraint: the match reduced to a prefix/suffix test. A user identified by *.corp.example.com was therefore matched by any subject ending in .corp.example.com, including multi-label names like evil.deep.corp.example.com. An attacker who can obtain a CA-signed certificate for a deeper subdomain could authenticate as the wildcard user.

Fix: make the separator type-aware. * must not span a separator in the matched component:

  • . for CN and DNS: SAN subjects (DNS label separator), so a wildcard matches exactly one label.
  • / for URI: SAN subjects (path separator), preserving existing behavior. "Matched span contains no /" is equivalent to the previous equal-slash-count guard, so URI SAN wildcard behavior is unchanged (URI path segments may still contain dots).

The candidate length is checked before computing the matched span, so its length cannot underflow when prefix and suffix overlap on a short candidate (for example pattern a*a, candidate a); this also removes a pre-existing overlap false positive.

Tests added to tests/integration/test_ssl_cert_authentication:

  • DNS SAN wildcard DNS:*.corp.example.com: single-label node1.corp.example.com authenticates; multi-label evil.deep.corp.example.com is rejected (the bypass), over both the native and HTTPS interfaces.
  • CN wildcard *.corp.example.com: same single-label positive and multi-label negative.
  • URI SAN whose matched path segment contains a dot (URI:spiffe://bar.com/foo/baz.qux/far against URI:spiffe://bar.com/foo/*/far): still matches (non-regression).

Verified both directions on a local debug build: the two new negative tests FAIL on the unpatched binary (the multi-label bypass succeeds) and PASS with the fix; the URI non-regression test and the existing test_x509_san_wildcard_support pass on both.

Note for reviewers: this is a security fix that intentionally stops accepting the previously-matched multi-label names, so it is technically a behavior change for wildcard ssl_certificate users. The previously-accepted behavior is the vulnerability and is non-compliant with RFC 6125, so no setting is added to restore it. Legitimate single-label wildcard matching is preserved. The wildcard * was introduced in 2068fbb.

Version info

  • Backported to: 26.6.2.7, 26.5.4.21, 26.4.5.77, 26.3.17.3, 25.8.26.3

A '*' in an ssl_certificate user subject was constrained only by an
equal-slash-count check ("'*' must not represent a '/' in URI"). For CN
and "DNS:" SAN subjects there are no slashes, so the check was always
0 == 0 and did nothing. A user identified by '*.corp.example.com' was
therefore matched by any subject ending in '.corp.example.com',
including multi-label names like 'evil.deep.corp.example.com'. An
attacker able to obtain a CA-signed certificate for a deeper subdomain
could authenticate as the wildcard user.

Per RFC 6125 6.4.3 a wildcard must match exactly one component.
Generalize the separator to be type-aware: '.' for CN and "DNS:" SANs
(DNS label separator), '/' for "URI:" SANs (path separator, preserving
the previous behavior exactly). The matched span between the fixed
prefix and suffix must not contain the separator.

The candidate length is checked before computing the matched span so
its length cannot underflow when the prefix and suffix overlap on a
short candidate (e.g. pattern 'a*a', candidate 'a'), which also removes
a pre-existing overlap false positive. For URI SANs, "matched span has
no '/'" is equivalent to the previous equal-slash-count guard, so
existing URI wildcard behavior is unchanged.

Add integration tests covering DNS and CN wildcards (single-label
positive, multi-label bypass rejected) and a URI SAN whose matched
segment contains a dot (non-regression).
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Both new negative integration tests fail on demand on the unpatched binary (multi-label evil.deep.corp.example.com authenticates against *.corp.example.com); a standalone reproduction of the old vs new matching logic over an input matrix also fails/passes deterministically.
b Root cause explained? Yes. The wildcard branch constrained * only with an equal-slash-count check. CN/DNS: subjects have no slashes, so the guard was always 0 == 0 and did nothing; the match reduced to prefix/suffix, so * spanned multiple DNS labels.
c Fix matches root cause? Yes. Replaces the no-op slash guard with a type-aware separator (. for CN/DNS, / for URI): the matched span must not contain the separator, constraining * to exactly one component.
d Test intent preserved / new tests added? Yes. Three new integration tests (DNS + CN single-label positive and multi-label-bypass negative, URI dot-in-segment non-regression); existing test_x509_san_wildcard_support unchanged and still passing.
e Both directions demonstrated? Yes. Unpatched debug binary: the two new negative tests FAIL (bypass succeeds). Patched binary: all 4 tests PASS. URI + existing tests pass on both binaries.
f Fix is general across code paths? Yes. checkSSLCertificateAuthentication is the single site that wildcard-matches certificate subjects (verified by grep across src/Access and src/Common/Crypto). The fix covers CN, DNS: SAN and URI: SAN in one place. Unrelated "wildcard" code (GRANT access-rights, AllowedClientHosts IP patterns) is a different mechanism.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes. Subjects are plain strings (no Nullable/LowCardinality wrappers apply). Covered the input matrix: CN, DNS: SAN, URI: SAN; single-label, multi-label, bare-apex, empty matched span, and the overlapping a*a/a boundary (length checked before the matched-span substr, so no size_t underflow).
h Backward compatible? Intentional, security-motivated behavior change: multi-label matches that the vulnerable code accepted are now rejected (RFC 6125 6.4.3). No setting is added to restore the bypass, since the old behavior is the vulnerability. Legitimate single-label wildcard matching and all URI: SAN matching are preserved unchanged. Flagged for reviewer awareness.
i Invariants and contracts preserved? Yes. Pure string-comparison function, no data-structure or concurrency invariants. For URI: SANs, "matched span has no /" is provably equivalent to the previous equal-slash-count guard (prefix/suffix already fix all other slashes), so URI behavior is unchanged. Function contract (return true iff a configured subject matches) upheld on all paths including the early-continue guards.

Session id: cron:clickhouse-worker-slot-18:20260625-113900

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @kcmannem @thevar1able — could you review this? It fixes an ssl_certificate authentication bypass: a * wildcard in a CN or DNS: SAN subject was only constrained by an equal-slash-count check, which is a no-op for dotted names (no slashes), so *.corp.example.com matched multi-label names like evil.deep.corp.example.com. The fix makes the wildcard separator type-aware (. for CN/DNS, / for URI SANs) so * matches exactly one component (RFC 6125 6.4.3); URI: SAN behavior is unchanged.

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Jun 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [17b4fda]

Summary: ✅


AI Review

Summary

This PR tightens ssl_certificate wildcard matching so CN and DNS: SAN wildcards cannot span DNS labels, rejects empty and slash-containing DNS-label spans, and keeps URI: matching constrained by path segments. I rechecked the prior bot-authored findings against the current head; they are addressed, and I did not find remaining correctness or security issues.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jun 25, 2026
Comment thread src/Access/Authentication.cpp Resolved
The single-component wildcard check accepted an empty matched span: for a
user subject DNS:*.corp.example.com and a (malformed) certificate SAN
DNS:.corp.example.com the matched span is empty and contains no separator,
so the wildcard user was authenticated even though no label was matched.
extractAllSubjects stores any non-empty dNSName, so such a name is not
rejected before authentication.

Require the matched span to be non-empty for the DNS/CN ('.'-separator)
case. RFC 6125 6.4.3 requires '*' to match exactly one non-empty label.
URI SAN path segments ('/'-separator) may legitimately be empty, so the
URI case keeps its prior behavior (the matched-span-has-no-'/' rule remains
equivalent to the original count('/') guard).

Add empty-label negative cases (cert client10, CN and DNS SAN
.corp.example.com) to both the DNS and CN wildcard integration tests.

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

Copy link
Copy Markdown
Collaborator Author

Fixed in 0141b64. The match now also requires the matched span to be non-empty for the DNS/CN (.-separator) case, so DNS:*.corp.example.com no longer accepts the empty-label SAN DNS:.corp.example.com. URI SANs keep the prior behavior: a path segment may legitimately be empty, and "matched span has no /" stays equivalent to the original count('/') guard.

Regression coverage: cert client10 (CN and DNS: SAN .corp.example.com) is added as a negative case to both wildcard tests; it is rejected with the fix and authenticates without it. Verified both directions on a local debug build — with the non-empty guard the DNS+CN empty-label assertions pass (4/4 wildcard tests green); reverting just that guard makes both fail (DID NOT RAISE) while the URI dot-in-segment case stays green.

Comment thread src/Access/Authentication.cpp Resolved
A SAN wildcard pattern configured without a recognized "DNS:"/"URI:" prefix
(for example a bare SAN '*') was routed to the DNS '.' separator by the
is_uri allow-list, because '.' was the default for everything that was not
URI-prefixed. As a result such a pattern matched a "URI:" certificate whose
matched span contains no '.', e.g. URI:spiffe://foo/bar, even though the
original slash-count guard rejected it (0 vs 3 slashes). That widened
URI SAN matching in this security-sensitive path.

Choose the '.' (DNS label) separator via an allow-list of exactly CN and
"DNS:" SANs, and keep every other SAN on the '/' separator. For the '/'
case, "no '/' in the matched span" is identical to the original
count('/', pattern) == count('/', candidate) guard, so URI and
unrecognized-prefix matching is provably unchanged. The non-empty-label
requirement remains scoped to the DNS label case.

Adds an integration regression case: a bare SAN '*' user must not match the
URI certificate URI:spiffe://foo/bar (client11).
Comment thread src/Access/Authentication.cpp Resolved
A DNS label or CN never contains a slash, but the single-label rule only
forbade '.' in the matched wildcard span. Since extractAllSubjects stores
raw non-empty dNSName/CN strings without validation, a configured subject
'DNS:*.corp.example.com' matched a certificate SAN 'DNS:foo/bar.corp.example.com'
(matched span 'foo/bar' has no '.'), and a slash-containing CN wildcard matched
a deeper name. The original slash-count guard rejected these; the single-label
rewrite had dropped that guard for the DNS/CN branch.

For a DNS label (a CN or a 'DNS:' SAN), the matched span must now be a single
non-empty component containing neither '.' nor '/'. Other SANs ('URI:' or
configured without a recognized prefix) keep the original rule (only '/'
forbidden), which is identical to the slash-count guard, so URI matching is
unchanged.

Adds regression certificate client12 (CN and DNS SAN both
'foo/bar.corp.example.com') and negative cases to the DNS and CN wildcard
single-label tests.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate — head 3dc6cb47ec2 (slash-in-span fix)

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Configured subject DNS:*.corp.example.com (or CN *.corp.example.com) vs certificate foo/bar.corp.example.com (cert client12, CN + DNS: SAN) authenticates deterministically on the prior binary.
b Root cause explained? The single-label rewrite forbade only . in the matched span for the DNS/CN branch and dropped the original slash-count guard. extractAllSubjects stores raw non-empty dNSName/CN strings unvalidated, so foo/bar (no .) passed → a slash-containing multi-label name bypassed the wildcard.
c Fix matches root cause? Yes. For a DNS label the matched span must be a single non-empty component with no . AND no /. Directly restores the slash rejection the guard provided, scoped to the DNS/CN branch.
d Test intent preserved / new tests added? Yes. Added negative cases to test_x509_dns_san_wildcard_single_label and test_x509_cn_wildcard_single_label (cert client12) asserting slash-in-span is rejected on both native and HTTPS. Existing positive single-label, empty-label, URI dot-in-segment, and unprefixed-SAN cases unchanged.
e Both directions demonstrated? Yes. Fixed binary (Build ID 20960dad): 5/5 wildcard tests PASS. Prior binary (833a30db, fix reverted + recompiled): dns + cn tests FAIL (client12 wrongly authenticates), URI dot-in-segment PASSES. Build IDs verified; restored fix rebuilt deterministically back to 20960dad.
f Fix is general across code paths? Yes. checkSSLCertificateAuthentication is the only cert-subject wildcard matcher (confirmed prior rounds). Both the CN and DNS: SAN paths share the is_dns_label branch, so both are covered by one change.
g Fix generalizes across inputs? Yes. Verified across the input matrix (standalone repro + integration): multi-label, empty-label, single dot-label, slash-in-span, URI dot-in-segment, unprefixed SAN, and the a*a overlap underflow case. The non-DNS / branch is proven equal to the original slash-count guard for all anchored candidates.
h Backward compatible? Yes. The non-DNS (URI:/unprefixed) branch keeps "only / forbidden", mathematically identical to the original count('/') guard, so valid URI/SPIFFE configs are unaffected. The DNS/CN branch only tightens an authentication bypass (no legitimate hostname contains /).
i Invariants and contracts preserved? Yes. The certificate_subject.size() < prefix.size()+suffix.size() guard before the substr is retained (no size_t underflow). Candidate SANs are always DNS:/URI: prefixed by extractAllSubjects; the matched-span semantics (single non-empty hostname label) match RFC 6125 6.4.3.

Session id: cron:clickhouse-worker-slot-9:20260625-153800

Comment thread src/Access/Authentication.cpp Resolved
A wildcard SAN subject configured without a recognized "DNS:"/"URI:" prefix
took the non-DNS branch, so '*' could absorb a candidate's type prefix and
span DNS labels: a bare SAN '*.corp.example.com' matched the certificate SAN
DNS:evil.deep.corp.example.com (matched span "DNS:evil.deep" has no '/').

Certificate SAN subjects are always stored with a "DNS:"/"URI:" prefix, so a
wildcard SAN pattern must carry one of those prefixes to align with a
candidate. Reject any unprefixed SAN wildcard up front (it matches nothing).
CN patterns (never prefixed) and properly prefixed DNS:/URI: SAN patterns are
unchanged.

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

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate for the unprefixed-SAN-wildcard fix (commit 17b4fda, addressing the residual DNS-label-spanning finding).

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. User wildcard_san_unprefixed_dns (SAN '*.corp.example.com', no prefix) vs cert SAN DNS:evil.deep.corp.example.com (client8) authenticates on the unfixed binary every time, on native + HTTPS. Standalone matching-logic repro is deterministic too.
b Root cause explained? is_dns_label was keyed off the configured pattern's prefix. An unprefixed SAN pattern gives is_dns_label == false, taking the /-only branch. Candidate SAN subjects are always stored prefixed (DNS:/URI:), so with an empty prefix the * absorbs the candidate's DNS: literal: matched == "DNS:evil.deep", which has no /, so a multi-label name authenticates.
c Fix matches root cause? Yes. Reject any SAN wildcard pattern lacking a recognized DNS:/URI: prefix up front (it cannot align with an always-prefixed candidate), so * can no longer absorb the prefix.
d Test intent preserved / new tests added? Yes. New regression test_x509_unprefixed_san_wildcard_does_not_span_dns_labels. All prior cases (single-label positive, multi-label/empty-label/slash-in-span negatives, URI dot-in-segment, unprefixed-vs-URI) unchanged and green.
e Both directions demonstrated? Yes. Unfixed binary (Build ID 20960dad): the new test FAILS ("DID NOT RAISE"). Fixed binary (fce95d75): full wildcard suite 6/6 PASS. Build IDs verified; restoring the fix returns the Build ID deterministically.
f Fix is general across code paths? Yes. checkSSLCertificateAuthentication is the only certificate-subject wildcard matcher in the tree (single site).
g Fix generalizes across inputs? Yes. Matrix covers unprefixed SAN vs DNS multi/single-label, bare * vs URI, prefixed DNS:/CN positives+negatives, URI dot-in-segment, empty-label, slash-in-span. The bypass is closed; every other case is preserved.
h Backward compatible? Yes. An unprefixed SAN wildcard never validly matched a real (always-prefixed) candidate; it only "matched" by absorbing the prefix, which is the bug. No legitimate config loses function. CN and properly prefixed DNS:/URI: patterns are untouched. No setting/format change.
i Invariants and contracts preserved? Yes. Candidate SAN subjects are always DNS:/URI: prefixed (X509Certificate::extractAllSubjects). The continue skips only the wildcard branch for that subject; the exact-match path is unaffected. Size-underflow guard retained. Upholds RFC 6125 6.4.3 (single non-empty component).

Session id: cron:clickhouse-worker-slot-3:20260625-164800

@clickhouse-gh

clickhouse-gh Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.40% 85.40% +0.00%
Functions 92.60% 92.60% +0.00%
Branches 77.60% 77.60% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 21/23 (91.30%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 17b4fda

CI is green. The Bugfix validation (integration tests) job is pass / SUCCESS at the job level (and Mergeable Check + PR + Finish Workflow all pass). The individual test_ssl_cert_authentication/test.py::* FAIL rows in CIDB are the expected output of Bugfix validation: it runs the PR's new regression tests against master HEAD (where the source fix is absent), so the new wildcard-rejection assertions are supposed to fail there. That is exactly how the job confirms the tests catch the bug, and the job reports green.

Check / test Reason Owner / fixing PR
Bugfix validation (integration tests) / test_ssl_cert_authentication::* (16 rows) expected — validation runs new tests against master HEAD without the fix; job is pass/SUCCESS N/A (validation working as designed; job green)

Session id: cron:our-pr-ci-monitor:20260625-220000

@alexey-milovidov alexey-milovidov self-assigned this Jun 27, 2026
@alexey-milovidov alexey-milovidov added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Jun 27, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 27, 2026
Merged via the queue into ClickHouse:master with commit 975ac09 Jun 27, 2026
167 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added pr-synced-to-cloud The PR is synced to the cloud repo pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Jun 27, 2026
alexey-milovidov added a commit that referenced this pull request Jun 28, 2026
Resolve conflicts for the #108472 backport (SSL certificate wildcard
single-component matching) onto 25.8.

`src/Access/Authentication.cpp` auto-merged: the 25.8 structure (`bool`
return types, inline password checks, no one-time-password support) is
kept and only the wildcard single-component fix from #108472 is applied
on top.

The test fixtures conflicted because master carries a separate,
un-backported session_log feature that 25.8 lacks. Resolution keeps only
what #108472 introduced:
- `certs/generate_certs.sh`: add the new client7-client12 generation and
  signing; drop the `client_far_future` lines (part of the session_log
  feature, not present in 25.8).
- `certs/ca-cert.srl`: take the serial consistent with the cherry-picked
  client7-client12 certificates.
- `test.py`: append the five new wildcard tests; drop the
  `test_session_log_certificate_*` tests (session_log feature, not in
  25.8).

`configs/session_log.xml` and the `client_far_future` certificate files
are correctly dropped by the merge for the same reason.
robot-ch-test-poll4 added a commit that referenced this pull request Jun 28, 2026
Cherry pick #108472 to 25.8: Enforce single-component matching for SSL certificate wildcards
robot-clickhouse added a commit that referenced this pull request Jun 28, 2026
alexey-milovidov pushed a commit that referenced this pull request Jun 28, 2026
alexey-milovidov pushed a commit that referenced this pull request Jun 28, 2026
alexey-milovidov pushed a commit that referenced this pull request Jun 28, 2026
robot-ch-test-poll added a commit that referenced this pull request Jun 28, 2026
Cherry pick #108472 to 26.3: Enforce single-component matching for SSL certificate wildcards
robot-clickhouse added a commit that referenced this pull request Jun 28, 2026
robot-ch-test-poll added a commit that referenced this pull request Jun 28, 2026
Cherry pick #108472 to 26.4: Enforce single-component matching for SSL certificate wildcards
robot-clickhouse added a commit that referenced this pull request Jun 28, 2026
robot-ch-test-poll added a commit that referenced this pull request Jun 28, 2026
Cherry pick #108472 to 26.5: Enforce single-component matching for SSL certificate wildcards
robot-clickhouse added a commit that referenced this pull request Jun 28, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 29, 2026
alexey-milovidov added a commit that referenced this pull request Jun 29, 2026
Backport #108472 to 26.4: Enforce single-component matching for SSL certificate wildcards
alexey-milovidov added a commit that referenced this pull request Jun 29, 2026
Backport #108472 to 26.5: Enforce single-component matching for SSL certificate wildcards
alexey-milovidov added a commit that referenced this pull request Jun 29, 2026
Backport #108472 to 26.3: Enforce single-component matching for SSL certificate wildcards
alexey-milovidov added a commit that referenced this pull request Jun 30, 2026
Backport #108472 to 25.8: Enforce single-component matching for SSL certificate wildcards
alexey-milovidov added a commit to evkuzin/ClickHouse that referenced this pull request Jul 2, 2026
Resolve conflicts in tests/integration/test_ssl_cert_authentication
caused by master's PR ClickHouse#108472 (SSL certificate SAN wildcard matching),
which regenerated the whole certificate set and renumbered clients up to
`client12` plus `client_far_future`, colliding with this branch's
`client7`.

Resolution:
- Take master's consistent certificate set as-is (all signed by master's
  CA) so the existing wildcard / session_log tests keep passing.
- Move this branch's EMAIL SAN certificate to a fresh `client13`
  (`EMAIL:[email protected]`), signed by master's CA, and update
  `generate_certs.sh` accordingly.
- Keep master's `users_with_ssl_auth.xml` users and add back the `alice`
  user that authenticates by `EMAIL:[email protected]`.
- Take master's `test.py` and re-append `test_x509_san_email_support`,
  switched from `client7` to `client13`.
- `src/Common/Crypto/X509Certificate.cpp` auto-merged: `extractAllSubjects`
  keeps the new `GEN_EMAIL` handling on top of master's changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@fm4v fm4v removed pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Jul 21, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Jul 21, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jul 21, 2026
@PedroTadim

Copy link
Copy Markdown
Member

@alexey-milovidov this PR introduced many certificate files, then many blobs to the repo. Was this a good idea?

@groeneai

groeneai commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Numbers for that call, since I wrote the change. Honest answer: following the directory's existing convention was defensible, committing the CSRs alongside it was not.

#108472 added 24 files under tests/integration/test_ssl_cert_authentication/certs/, 723 added lines / 41 KiB of text (six clients, each with cert, key, CSR and ext.cnf). That directory now holds 58 files / 112 KiB, and tests/ holds 223 committed cert and key files / 394 KiB across 46 integration test directories, so the pattern predates this PR. I did extend certs/generate_certs.sh in the same PR, so each new cert is reproducible from the script with its subject and extensions documented there.

The clearly unnecessary part: the 14 *-req.pem CSRs in that directory (23 KiB, 6 of them mine) are read by no test. test.py opens only ca-cert.pem, server-{cert,key}.pem and client*-{cert,key}.pem; the CSRs are named only by generate_certs.sh, which writes them itself. They can be deleted with no coverage change.

The fully generated shape already exists in the tree: test_postgresql_ssl/test.py and test_rabbitmq_malicious_broker/test.py build their CA, server and client certificates with openssl inside the fixture and commit nothing. Doing that here costs about 19 s per run (16 RSA-4096 keypairs plus 14 signings, measured three times locally), paid in each shard that receives one of the module's tests, and it has to move all 58 files together because generate_certs.sh regenerates the CA as well.

I am glad to do either one: delete just the unused CSRs, or convert the directory to fixture-time generation. It touches every test in the directory, so I would rather have that call from you than assume it.

zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…ert-wildcard-single-label

Enforce single-component matching for SSL certificate wildcards
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 pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

9 participants