Skip to content

feat: implement TLS groups/curve preferences support - #22

Open
damdo wants to merge 3 commits into
openshift:mainfrom
damdo:implement-curve-preferences
Open

feat: implement TLS groups/curve preferences support#22
damdo wants to merge 3 commits into
openshift:mainfrom
damdo:implement-curve-preferences

Conversation

@damdo

@damdo damdo commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

Implements TLS groups/curve preferences support in NewTLSConfigFromProfile() by leveraging the library-go crypto package.

Fixes #20

  • Bumps openshift/api to v0.0.0-20260702202555-ef71f942ef6c (includes Groups field)
  • Uses libgocrypto.CurveIDsForTLSGroups() to map TLS groups/curve preferences to Go curve IDs
  • Gracefully filters unsupported curves (post-quantum hybrids in Go 1.25)
  • Adds comprehensive test coverage for TLS groups/curve preference scenarios

Sample PR that leverages this is here: openshift/cluster-machine-approver#308

Test plan

  • Code compiles without errors
  • Tests added for supported/unsupported groups, empty groups, and predefined profiles
  • All changes isolated to proper commits (code, tests, then vendor)

TODO

@openshift-ci
openshift-ci Bot requested review from mdbooth and sdodson July 3, 2026 08:27
@openshift-ci

openshift-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damdo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 3, 2026
@damdo damdo changed the title feat: implement TLS curve preferences support feat: implement TLS groups/curve preferences support Jul 3, 2026
@damdo

damdo commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

/hold

This PR depends on openshift/library-go#2347 merging upstream. Once that PR is merged and released, we can drop the temporary replace directive and revendor to use the official library-go version.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 3, 2026
@damdo
damdo force-pushed the implement-curve-preferences branch from d584c5e to 79a541a Compare July 3, 2026 08:32
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The project now targets Go 1.26.0 and uses updated OpenShift, Kubernetes, controller-runtime, Prometheus, protobuf, and related module versions. NewTLSConfigFromProfile maps supported profile.Groups values to tls.Config.CurvePreferences, reports unsupported groups with unsupported cipher names, and leaves preferences unset when no groups are configured. Tests cover supported, unsupported, empty, and Intermediate TLS profiles.

Suggested reviewers: mdbooth, sdodson

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The four added It blocks cover related behaviors and use no cluster waits or resources, but every new Expect lacks a diagnostic failure message. Add meaningful messages to each new Expect assertion, and make the Intermediate-profile assertion unconditional with an explicit expected curve result.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: TLS groups and curve preference support.
Description check ✅ Passed The description explains the TLS group implementation, dependency updates, filtering behavior, and test coverage.
Linked Issues check ✅ Passed The changes satisfy issue #20 by mapping profile.Groups to CurvePreferences and preserving defaults for empty groups.
Out of Scope Changes check ✅ Passed The dependency and build updates support the TLS group implementation and do not introduce unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed All Ginkgo test names in the PR are stable and deterministic, containing no dynamic identifiers, timestamps, UUIDs, or generated suffixes that could vary between test runs.
Microshift Test Compatibility ✅ Passed The added Ginkgo cases are local TLS tests in pkg/tls/tls_test.go, not e2e tests; they use no MicroShift cluster, unsupported resources, namespaces, or platform assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Added Ginkgo tests only construct TLSProfileSpec and tls.Config in pkg/tls/tls_test.go; they make no node, pod, topology, affinity, drain, or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes only TLS code/tests, go.mod/go.sum, and Makefile; it adds no deployment, operator, controller, manifest, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The repository has no package main, init, or TestMain; its only suite setup routes zap logging to GinkgoWriter and contains no stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added Ginkgo tests are local unit tests in pkg/tls/tls_test.go; they create TLS profiles and configs only, with no IPv4 assumptions or external connectivity.
No-Weak-Crypto ✅ Passed The patch only maps TLS groups to Go curve IDs. No added MD5, SHA-1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons were found.
Container-Privileges ✅ Passed The PR changes only Go, module, test, and Makefile files. No container manifests or privilege settings were found, including privileged, host namespaces, SYS_ADMIN, or root declarations.
No-Sensitive-Data-In-Logs ✅ Passed The PR adds TLS mapping and tests only; the base-to-HEAD diff contains no new logging calls or sensitive-data literals.
✨ Finishing Touches 💡 2
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch implement-curve-preferences
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
pkg/tls/tls_test.go (1)

357-371: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Strengthen the conditional assertion in the Intermediate-profile Groups test.

The test only asserts CurvePreferences is set if len(profile.Groups) > 0; if the Intermediate profile definition ever ships with an empty Groups list (e.g., upstream API regression), this test silently passes without verifying anything.

✅ Proposed fix to make the test deterministic
 		It("should set CurvePreferences from the profile", func() {
 			profile := *configv1.TLSProfiles[configv1.TLSProfileIntermediateType]
+			Expect(profile.Groups).NotTo(BeEmpty(), "Intermediate profile is expected to define Groups")

 			tlsConfigFn, _ := NewTLSConfigFromProfile(profile)

 			tlsConf := &tls.Config{}
 			tlsConfigFn(tlsConf)

-			// Intermediate profile now includes Groups
-			if len(profile.Groups) > 0 {
-				Expect(tlsConf.CurvePreferences).NotTo(BeNil())
-			}
+			Expect(tlsConf.CurvePreferences).NotTo(BeNil())
 		})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls_test.go` around lines 357 - 371, The Intermediate profile Groups
test in NewTLSConfigFromProfile is conditional on len(profile.Groups), so it can
pass without checking anything if Groups is empty. Make the test deterministic
by asserting the expected Intermediate profile data explicitly before calling
tlsConfigFn, then always verify tlsConf.CurvePreferences is populated from the
profile’s Groups rather than skipping the assertion.
pkg/tls/tls.go (1)

119-121: 🧹 Nitpick | 🔵 Trivial

Post-quantum curve gap noted and tracked.

The TODO correctly flags that post-quantum hybrid curves (SecP256r1MLKEM768, SecP384r1MLKEM1024) are not supported in Go 1.25 and are gracefully filtered as unsupported. Since this shared TLS helper may end up protecting long-lived secrets across consuming controller-runtime projects, worth ensuring downstream consumers are aware of the current PQ gap until Go 1.26+ lands support.

As per path instructions for files matching **/*{crypt,cipher,sign,hash,tls,ssl,cert,key,token}*, "Post-quantum: flag if protecting long-lived secrets."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls.go` around lines 119 - 121, The TLS helper in
CurveIDsForTLSGroups already filters unsupported post-quantum hybrid curves, but
the comment needs to make the downstream exposure explicit for consumers
handling long-lived secrets. Update the TODO/documentation around curvePrefs and
unsupportedGroups in tls.go to clearly call out that SecP256r1MLKEM768 and
SecP384r1MLKEM1024 are currently unavailable in Go 1.25, that they are being
dropped by CurveIDsForTLSGroups, and that controller-runtime consumers should
not rely on PQ protection until Go 1.26+ support is available.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/tls/tls.go`:
- Around line 116-137: Normalize the unsupported group names returned from
NewTLSConfigFromProfile so they match the expected lowercase underscore format
instead of the raw enum string. Update the unsupported-group handling in
CurveIDsForTLSGroups (or immediately after its result is used in
NewTLSConfigFromProfile) to map values like SecP256r1MLKEM768 to
secp256r1_mlkem768 before appending to unsupported, while keeping
unsupportedCiphers behavior unchanged.

---

Nitpick comments:
In `@pkg/tls/tls_test.go`:
- Around line 357-371: The Intermediate profile Groups test in
NewTLSConfigFromProfile is conditional on len(profile.Groups), so it can pass
without checking anything if Groups is empty. Make the test deterministic by
asserting the expected Intermediate profile data explicitly before calling
tlsConfigFn, then always verify tlsConf.CurvePreferences is populated from the
profile’s Groups rather than skipping the assertion.

In `@pkg/tls/tls.go`:
- Around line 119-121: The TLS helper in CurveIDsForTLSGroups already filters
unsupported post-quantum hybrid curves, but the comment needs to make the
downstream exposure explicit for consumers handling long-lived secrets. Update
the TODO/documentation around curvePrefs and unsupportedGroups in tls.go to
clearly call out that SecP256r1MLKEM768 and SecP384r1MLKEM1024 are currently
unavailable in Go 1.25, that they are being dropped by CurveIDsForTLSGroups, and
that controller-runtime consumers should not rely on PQ protection until Go
1.26+ support is available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread pkg/tls/tls.go
Comment on lines +116 to +137
func NewTLSConfigFromProfile(profile configv1.TLSProfileSpec) (tlsConfig func(*tls.Config), unsupported []string) {
minVersion := libgocrypto.TLSVersionOrDie(string(profile.MinTLSVersion))
cipherSuites, unsupportedCiphers := cipherCodes(profile.Ciphers)
// TODO: post-quantum hybrid curves (SecP256r1MLKEM768, SecP384r1MLKEM1024) are not supported in Go 1.25.
// These will be returned as unsupported and gracefully filtered. Update this when Go 1.26+ support is available.
curvePrefs, unsupportedGroups := libgocrypto.CurveIDsForTLSGroups(profile.Groups)

unsupported = append(unsupportedCiphers, unsupportedGroups...)

return func(tlsConf *tls.Config) {
tlsConf.MinVersion = minVersion
// TODO: add curve preferences from profile once https://github.com/openshift/api/pull/2583 merges.
// tlsConf.CurvePreferences <<<<<< profile.Curves
if len(curvePrefs) > 0 {
tlsConf.CurvePreferences = curvePrefs
}

// TLS 1.3 cipher suites are not configurable in Go (https://github.com/golang/go/issues/29349), so only set CipherSuites accordingly.
// TODO: revisit this once we get an answer on the best way to handle this here:
// https://docs.google.com/document/d/1cMc9E8psHfnoK06ntR8kHSWB8d3rMtmldhnmM4nImjs/edit?disco=AAABu_nPcYg
if minVersion != tls.VersionTLS13 {
tlsConf.CipherSuites = cipherSuites
}
}, unsupportedCiphers
}, unsupported

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the vendored library-go crypto package and inspect CurveIDsForTLSGroups signature
fd -a 'crypto.go' --path '*library-go/pkg/crypto*'
rg -n -A 15 'func CurveIDsForTLSGroups' -g '*.go'

Repository: openshift/controller-runtime-common

Length of output: 405


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== go.mod references =='
rg -n 'library-go|CurveIDsForTLSGroups|TLSGroup|TLSProfileSpec' go.mod go.sum vendor . || true

echo
echo '== locate tls.go =='
fd -a 'tls.go' pkg || true

echo
echo '== outline pkg/tls/tls.go =='
if command -v ast-grep >/dev/null 2>&1; then
  ast-grep outline pkg/tls/tls.go --view expanded || true
fi

echo
echo '== relevant lines in pkg/tls/tls.go =='
nl -ba pkg/tls/tls.go | sed -n '1,220p'

Repository: openshift/controller-runtime-common

Length of output: 26899


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== dependency metadata =='
rg -n 'openshift/library-go|library-go' go.mod go.sum vendor . || true

echo
echo '== search for CurveIDsForTLSGroups in repo =='
rg -n 'CurveIDsForTLSGroups|TLSGroup' . || true

echo
echo '== inspect pkg/tls tests =='
fd -a 'tls_test.go' pkg || true
if [ -f pkg/tls/tls_test.go ]; then
  nl -ba pkg/tls/tls_test.go | sed -n '1,260p'
fi

Repository: openshift/controller-runtime-common

Length of output: 9811


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== vendor CurveIDsForTLSGroups implementation =='
sed -n '392,420p' vendor/github.com/openshift/library-go/pkg/crypto/crypto.go

echo
echo '== tls tests around unsupported groups =='
sed -n '286,360p' pkg/tls/tls_test.go

Repository: openshift/controller-runtime-common

Length of output: 3714


Normalize unsupported group names
CurveIDsForTLSGroups appends string(group) for unsupported entries, so configv1.TLSGroupSecP256r1MLKEM768 is reported as SecP256r1MLKEM768, not secp256r1_mlkem768. If the lowercase underscore form is required here, normalize before returning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls.go` around lines 116 - 137, Normalize the unsupported group names
returned from NewTLSConfigFromProfile so they match the expected lowercase
underscore format instead of the raw enum string. Update the unsupported-group
handling in CurveIDsForTLSGroups (or immediately after its result is used in
NewTLSConfigFromProfile) to map values like SecP256r1MLKEM768 to
secp256r1_mlkem768 before appending to unsupported, while keeping
unsupportedCiphers behavior unchanged.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/tls/tls_test.go (1)

357-371: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Weak assertion: test can pass without exercising anything.

The assertion is gated behind if len(profile.Groups) > 0, so if the Intermediate profile's Groups field is ever empty (e.g., due to an openshift/api regression), this test silently passes without validating any behavior.

🧪 Proposed fix to assert the precondition
 	Context("when using Intermediate profile with Groups", func() {
 		It("should set CurvePreferences from the profile", func() {
 			profile := *configv1.TLSProfiles[configv1.TLSProfileIntermediateType]
+			Expect(profile.Groups).NotTo(BeEmpty())
 
 			tlsConfigFn, _ := NewTLSConfigFromProfile(profile)
 
 			tlsConf := &tls.Config{}
 			tlsConfigFn(tlsConf)
 
-			// Intermediate profile now includes Groups
-			if len(profile.Groups) > 0 {
-				Expect(tlsConf.CurvePreferences).NotTo(BeNil())
-			}
+			Expect(tlsConf.CurvePreferences).NotTo(BeNil())
 		})
 	})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls_test.go` around lines 357 - 371, The test in tls_test.go has a
weak assertion because it only checks CurvePreferences when profile.Groups is
non-empty, so it can silently pass without validating behavior. In the Context
for NewTLSConfigFromProfile with configv1.TLSProfileIntermediateType, assert the
precondition on profile.Groups directly (for example, require it to be non-empty
before checking tlsConf.CurvePreferences) so the test fails if the Intermediate
profile no longer includes groups, and keep the existing CurvePreferences
expectation tied to that same setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/tls/tls_test.go`:
- Around line 357-371: The test in tls_test.go has a weak assertion because it
only checks CurvePreferences when profile.Groups is non-empty, so it can
silently pass without validating behavior. In the Context for
NewTLSConfigFromProfile with configv1.TLSProfileIntermediateType, assert the
precondition on profile.Groups directly (for example, require it to be non-empty
before checking tlsConf.CurvePreferences) so the test fails if the Intermediate
profile no longer includes groups, and keep the existing CurvePreferences
expectation tied to that same setup.

@damdo
damdo force-pushed the implement-curve-preferences branch from 79a541a to fc0245f Compare July 3, 2026 11:31
@damdo

damdo commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

/assign @joelanford

Comment thread pkg/tls/tls_test.go Outdated
Comment thread pkg/tls/tls_test.go Outdated
Comment thread pkg/tls/tls.go
cipherSuites, unsupportedCiphers := cipherCodes(profile.Ciphers)
curvePrefs, unsupportedGroups := libgocrypto.CurveIDsForTLSGroups(profile.Groups)

unsupported = append(unsupportedCiphers, unsupportedGroups...)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there any value in separating the two types here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think merging is fine here. The caller only uses unsupported for logging ("unsupported ciphers/groups that will be ignored: %v"). Separating them would change the function signature (e.g., return two slices, or a struct) for no practical benefit, the caller doesn't need to handle them differently. If a consumer ever needs to distinguish, libgocrypto.CurveIDsForTLSGroups and cipherCodes are individually callable.

@damdo
damdo force-pushed the implement-curve-preferences branch from fc0245f to 2e66fc2 Compare August 4, 2026 16:17
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 4, 2026
@damdo
damdo force-pushed the implement-curve-preferences branch from 2e66fc2 to 1e752ab Compare August 4, 2026 16:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
pkg/tls/tls_test.go (1)

338-353: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a nil Groups test case.

This test covers only a non-nil empty slice. The contract also requires nil Groups to leave tls.Config.CurvePreferences unset. Add a case with Groups omitted or set to nil, and assert empty unsupported and nil CurvePreferences.

As per the PR objectives, both empty and nil Groups must preserve the default curve preferences.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls_test.go` around lines 338 - 353, Extend the “when profile has
empty Groups” tests around NewTLSConfigFromProfile with a separate case where
TLSProfileSpec.Groups is nil or omitted. Assert unsupported is empty and
tls.Config.CurvePreferences remains nil, preserving the existing non-nil
empty-slice coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@go.mod`:
- Around line 85-86: Review and verify maintainer approval and provenance for
fork commit fceccb2c136d4e52ad826c78141e6081aa95ffb9 before merging. Keep the
github.com/openshift/library-go replacement temporarily, then remove that
replace directive and revendor once upstream pull request `#2347` is merged and
its release is available.
- Around line 17-83: Update the indirect golang.org/x/net dependency in go.mod
to at least v0.56.0 and golang.org/x/text to at least v0.39.0, then regenerate
go.sum consistently with those versions and rerun the OSV vulnerability scan to
confirm both advisories are resolved.

In `@Makefile`:
- Line 21: Update the Go version directive in tools/go.tool.mod to match the
GO_DIRECTIVE_VERSION value of 1.26.0, so verify-go-directive sees consistent
versions.

---

Nitpick comments:
In `@pkg/tls/tls_test.go`:
- Around line 338-353: Extend the “when profile has empty Groups” tests around
NewTLSConfigFromProfile with a separate case where TLSProfileSpec.Groups is nil
or omitted. Assert unsupported is empty and tls.Config.CurvePreferences remains
nil, preserving the existing non-nil empty-slice coverage.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 83b2db0d-01d8-4a0b-889f-4f3f4b69a6c5

📥 Commits

Reviewing files that changed from the base of the PR and between fc0245f and 2e66fc2.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • Makefile
  • go.mod
  • pkg/tls/tls.go
  • pkg/tls/tls_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/tls/tls.go

Comment thread go.mod
Comment thread go.mod
Comment thread Makefile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/tls/tls_test.go (1)

336-351: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit coverage for nil Groups.

The contract covers both nil and empty Groups, but this test uses only []configv1.TLSGroup{}. Add a case that omits Groups and verifies that tls.Config.CurvePreferences remains nil.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/tls/tls_test.go` around lines 336 - 351, Add a separate test case in the
existing empty-Groups context that constructs TLSProfileSpec without setting
Groups, invokes NewTLSConfigFromProfile and the returned configurator, and
explicitly verifies tls.Config.CurvePreferences remains nil.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/tls/tls_test.go`:
- Around line 353-366: Update the “should set CurvePreferences from the profile”
test to derive the expected count from the profile’s supported groups only,
rather than subtracting the combined unsupported count. Use the group-specific
filtering or supported-group result associated with NewTLSConfigFromProfile,
then compare tlsConf.CurvePreferences against that exact expected value.

---

Nitpick comments:
In `@pkg/tls/tls_test.go`:
- Around line 336-351: Add a separate test case in the existing empty-Groups
context that constructs TLSProfileSpec without setting Groups, invokes
NewTLSConfigFromProfile and the returned configurator, and explicitly verifies
tls.Config.CurvePreferences remains nil.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: a34d4867-3e36-435d-b843-640cf6127e76

📥 Commits

Reviewing files that changed from the base of the PR and between 2e66fc2 and 1e752ab.

📒 Files selected for processing (1)
  • pkg/tls/tls_test.go

Comment thread pkg/tls/tls_test.go
@damdo
damdo force-pushed the implement-curve-preferences branch from 1e752ab to 59f72c1 Compare August 5, 2026 07:52
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 5, 2026
@damdo
damdo force-pushed the implement-curve-preferences branch from 59f72c1 to c12349a Compare August 5, 2026 08:02
@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown

@damdo: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request Aug 5, 2026
Enforce the cluster-wide TLS security profile on the WMCO metrics server,
gated on the TLS adherence policy. WMCO was not previously honoring the
cluster TLS profile, so enforcement only applies when the adherence policy
is StrictAllComponents, per the centralized TLS config enhancement.

Changes:
- Fetch TLS profile and adherence policy from apiserver.config.openshift.io/cluster
- Gate enforcement using library-go's ShouldHonorClusterTLSProfile
- Disable HTTP/2 (HTTP/1.1 only) as defense-in-depth against CVE-2023-44487
- Watch for TLS profile and adherence policy changes, restart on change
- Add controller-runtime-common to hack/update_submodules.sh

CurvePreferences with X25519MLKEM768 for post-quantum key exchange will be
added in a follow-up once openshift/controller-runtime-common#22 lands.
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request Aug 5, 2026
Enforce the cluster-wide TLS security profile on the WMCO metrics server,
gated on the TLS adherence policy. WMCO was not previously honoring the
cluster TLS profile, so enforcement only applies when the adherence policy
is StrictAllComponents, per the centralized TLS config enhancement.

Changes:
- Fetch TLS profile and adherence policy from apiserver.config.openshift.io/cluster
- Gate enforcement using library-go's ShouldHonorClusterTLSProfile
- Disable HTTP/2 (HTTP/1.1 only) as defense-in-depth against CVE-2023-44487
- Watch for TLS profile and adherence policy changes, restart on change
- Add controller-runtime-common to hack/update_submodules.sh

CurvePreferences with X25519MLKEM768 for post-quantum key exchange will be
added in a follow-up once openshift/controller-runtime-common#22 lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement CurvePreferences support in NewTLSConfigFromProfile (openshift/api#2583 merged)

3 participants