Skip to content

🌱 Preserve Mozilla v5.8 old TLS profile and harden update script#2632

Open
tmshort wants to merge 1 commit intooperator-framework:mainfrom
tmshort:tls-profiles-old-profile-preservation
Open

🌱 Preserve Mozilla v5.8 old TLS profile and harden update script#2632
tmshort wants to merge 1 commit intooperator-framework:mainfrom
tmshort:tls-profiles-old-profile-preservation

Conversation

@tmshort
Copy link
Copy Markdown
Contributor

@tmshort tmshort commented Apr 7, 2026

  • Move oldTLSProfile to a static old_profile.go (removed from v6+ spec)
  • Add version-based early exit to update-tls-profiles.sh
  • Add profile existence and tls_versions field validation in script
  • Add unit tests for old profile content and X25519MLKEM768 curve

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Copilot AI review requested due to automatic review settings April 7, 2026 15:46
@openshift-ci openshift-ci bot requested review from ankitathomas and bentito April 7, 2026 15:46
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevinrizza for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 4340f84
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69d5403237c43c000831370d
😎 Deploy Preview https://deploy-preview-2632--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Preserves the deprecated Mozilla v5.8 “old” TLS profile as a static Go source while updating the generator to track Mozilla’s latest TLS guidelines and adding guards/tests to prevent accidental regressions.

Changes:

  • Move oldTLSProfile into a new static old_profile.go (sourced from Mozilla v5.8) and remove it from generated data.
  • Harden update-tls-profiles.sh with version-based early exit and schema validations; switch input to latest.json / v6.
  • Add unit tests for old profile invariants and for presence of the X25519MLKEM768 curve across profiles.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
internal/shared/util/tlsprofiles/tlsprofiles_test.go Adds assertions to lock down old profile invariants and ensure X25519MLKEM768 is present in profiles.
internal/shared/util/tlsprofiles/old_profile.go Introduces a static copy of Mozilla v5.8 “old” profile for backward compatibility.
internal/shared/util/tlsprofiles/mozilla_data.go Updates generated header to track latest.json (v6) and removes generated “old” profile.
hack/tools/update-tls-profiles.sh Switches generator input to latest.json, adds early exit on unchanged version, and validates input structure before generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

echo "Mozilla TLS data is already at version ${NEW_VERSION}, skipping regeneration."
exit 0
fi
echo "Updating Mozilla TLS data from version ${STORED_VERSION:-unknown} to ${NEW_VERSION}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there any case where we want to fail here for a schema migration? It would have been good info in the recent profile jump to 6.0 to have log output that said "Updating Mozilla TLS data from version v5.7 to v6.0", but we'd still have the schema fracture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The additional checks that are added to the function now check for schema changes that impact generation.


TMPFILE="$(mktemp)"
trap 'rm -rf "$TMPFILE"' EXIT

Copy link
Copy Markdown
Contributor

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 ensuring that the output is valid JSON? What if the URL location changes? Then we'll see the version failure which won't clearly indicate the problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure we need to go that far, if they change the format, they are messing with everyone. There will be a failure, though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Those checks would manifest the cases

invalid JSON
error retrieving schema

the same:

"ERROR: Could not read .version from ${INPUT}"

If the URL had an outage, or if they changed the schema again in another way that made it impossible to parse given the current assumptions, that would be the symptom.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe just catch and test the curl failures?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It behaves better now.

@tmshort tmshort force-pushed the tls-profiles-old-profile-preservation branch from fbafd47 to 2de30ac Compare April 7, 2026 16:09
// X25519MLKEM768 (added in Go 1.24) is present in all three named profiles.
// This curve is part of the Mozilla recommendation and its presence should be
// guarded against accidental removal.
func TestX25519MLKEM768InProfiles(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably also verify that MLKEM is in the schema retrieved in the script as well, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clarify? "MLKEM" itself as a string is not part of the profiles. Only "X25519MLKEM768"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test code validates that a specific profile is in the generated code. We should detect an omission of this policy earlier in the tooling if we validate it is included when retrieving the schema via the script.

Copy link
Copy Markdown
Contributor Author

@tmshort tmshort Apr 7, 2026

Choose a reason for hiding this comment

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

TBH, I'm not sure we should actually test against this particular curve in this way; and I'm also not sure we want to specify this kind of testing in the script itself, which should be somewhat agnostic to the resulting output. The only exception being ciphers that we know don't exist.

We still have a problem if a new curve is added, because we don't have the code for it (because we don't know what it is).

Copy link
Copy Markdown
Contributor Author

@tmshort tmshort Apr 7, 2026

Choose a reason for hiding this comment

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

In other words, I don't think this is really a valid test, and I think I'll remove it, because that curve may be superseded, and that's just fine. Explicit testing will just cause issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Claude agrees:

Does the TestX25519MLKEM768InProfiles function really add any value, when the set of key exchanges could be changed at any time?

No, not really — especially for the generated profiles. If Mozilla updates their curve recommendations and X25519MLKEM768 is removed or replaced in a future spec version, the test fails even though the generated code is correct. It's coupling the test to a specific curve choice that's entirely Mozilla's to change.

For the static oldTLSProfile it's slightly more defensible (the file won't change unless someone edits it), but that's already guarded by TestOldProfileCiphers verifying the full cipher list. The curves aren't tested there, but an accidental edit to old_profile.go would likely show up in git diff during make verify anyway.

Overall the test encodes a transient implementation detail rather than an invariant. I'd remove it.

Copilot AI review requested due to automatic review settings April 7, 2026 16:23
@tmshort tmshort force-pushed the tls-profiles-old-profile-preservation branch from 2de30ac to b4a4e74 Compare April 7, 2026 16:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.95%. Comparing base (4510b1b) to head (4340f84).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2632   +/-   ##
=======================================
  Coverage   68.95%   68.95%           
=======================================
  Files         139      139           
  Lines        9891     9891           
=======================================
  Hits         6820     6820           
  Misses       2562     2562           
  Partials      509      509           
Flag Coverage Δ
e2e 37.27% <ø> (-0.29%) ⬇️
experimental-e2e 52.25% <ø> (ø)
unit 53.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Move oldTLSProfile to a static old_profile.go (removed from v6+ spec)
- Add version-based early exit to update-tls-profiles.sh
- Validate profile existence, tls_versions, ciphers, and curves fields
- Make jq/sed/cat invocations null-safe and consistently quote variables
- Add unit tests for old profile content; fix global state leak in tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Todd Short <tshort@redhat.com>
@tmshort tmshort force-pushed the tls-profiles-old-profile-preservation branch from b4a4e74 to 4340f84 Compare April 7, 2026 17:34
Copy link
Copy Markdown
Member

@fgiudici fgiudici left a comment

Choose a reason for hiding this comment

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

/lgtm


version=$(${JQ} -r '.version' ${TMPFILE})
# Extract stored version from current output file (may be empty on first run)
STORED_VERSION=$(grep '^// DATA VERSION:' "${OUTPUT}" 2>/dev/null | awk '{print $4}' || true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the "|| true" may be dropped here as the grep is in a pipe with awk and the overall result would never fail (as the awk command would not fail). Still looks more robust this way.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants