Skip to content

Conversation

@t4niwa
Copy link
Contributor

@t4niwa t4niwa commented Oct 15, 2025

Description

In Go 1.25.2, the verification of X.509 certificate SANs (Subject Alternative Names) has been made stricter.

Certificates like the following are now treated as invalid:

  • Domain names with a trailing dot (.): Such as the Fully Qualified Domain Name (FQDN) format example.com.
  • Domain names with empty labels: Such as .example.com or example..com
  • Labels exceeding 63 characters: Long domain names that exceed DNS label limits
  • Improperly formatted email addresses: rfc822Name formats that do not comply with RFC 5322

A unit test was added to maintain backward compatibility.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no functional changes, no api changes)
  • Non-code changes (update documentation, pipeline, etc.)

Flags

  • Breaks backward compatibility
  • Requires a documentation update
  • Has untestable code

Related issue/PR

Delete this section if there are no issues or pull requests that relate to this pull request.

  • Fixes #issue
  • Closes #PR

Checklist

  • Followed the guidelines in the CONTRIBUTING document
  • Added prefix [skip ci]/[ci skip]/[no ci]/[skip actions]/[actions skip] in the PR title if necessary
  • Tested and linted the code
  • Commented the code
  • Made corresponding changes to the documentation
  • Passed all pipeline checking

Checklist for maintainer

  • Use Squash and merge
  • Double-confirm the merge message has prefix [skip ci]/[ci skip]/[no ci]/[skip actions]/[actions skip]
  • Delete the branch after merge

Signed-off-by: taniwa <taniwa@lycorp.co.jp>
@t4niwa t4niwa self-assigned this Oct 15, 2025
Signed-off-by: taniwa <taniwa@lycorp.co.jp>
@t4niwa t4niwa requested a review from fsul7o October 20, 2025 05:47
@fsul7o fsul7o requested a review from Copilot October 21, 2025 03:49
Copy link

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

This PR adds test coverage for certificates with malformed Subject Alternative Names (SANs) to ensure backward compatibility with Go 1.25.2's stricter X.509 certificate validation. The Go version is updated from 1.25.1 to 1.25.3.

Key Changes:

  • Updated Go version from 1.25.1 to 1.25.3
  • Added test certificates and private keys with various SAN formatting issues
  • Added test cases to verify these certificates load successfully

Reviewed Changes

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

Show a summary per file
File Description
go.mod Updated Go version to 1.25.3
test/data/trailing_dot_server.key Private key for certificate with trailing dot in SAN
test/data/trailing_dot_server.crt Certificate with trailing dot in SAN (e.g., example.com.)
test/data/malformed_email_server.key Private key for certificate with malformed email in SAN
test/data/malformed_email_server.crt Certificate with improperly formatted email address in SAN
test/data/long_label_server.key Private key for certificate with DNS label exceeding 63 characters
test/data/long_label_server.crt Certificate with DNS label exceeding 63 characters
test/data/leading_dot_server.key Private key for certificate with leading dot in SAN
test/data/leading_dot_server.crt Certificate with leading dot in SAN (e.g., .example.com)
test/data/empty_label_server.key Private key for certificate with empty label in SAN
test/data/empty_label_server.crt Certificate with empty label in SAN (e.g., example..com)
service/tls_test.go Added test cases for malformed SAN certificates and fixed error handling logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@fsul7o fsul7o merged commit 4283744 into master Oct 21, 2025
2 checks passed
@fsul7o fsul7o deleted the add-x509-validation-unit-test branch October 21, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants