Skip to content

Conversation

@adreed-msft
Copy link
Member

@adreed-msft adreed-msft commented Nov 5, 2025

Description

Feature / Bug Fix:

In Go 1.23, a new feature was introduced in the crypto/x509 package that disabled certificates with a negative serial number, sometimes breaking mitm proxies, which prove useful in debugging.

There is no way to disable this at runtime outside of setting the GODEBUG environment variable-- This is often above user's heads, but it's arguable that, anybody going out of their way to use a MITM proxy probably is technically inclined enough to figure out that this changed.

Hence, this isn't the cleanest solution, and I'm not the happiest with it. This PR is here to serve as a discussion point, not necessarily something to review.

Related Links:

  • PBI #32923845

Type of Change

  • Bug fix (sorta)
  • New feature
  • Documentation update required
  • Code quality improvement
  • Other (describe):

How Has This Been Tested?

Manually tested behind fiddler

Copy link
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

This PR adds a godebug directive to the go.mod file to enable the x509negativeserial=1 setting, which controls how negative serial numbers in X.509 certificates are handled.

Key Changes

  • Added a godebug block with the x509negativeserial=1 setting to maintain compatibility with X.509 certificates that have negative serial numbers

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

@gapra-msft
Copy link
Member

gapra-msft commented Nov 6, 2025

Thanks for starting the discussion here. I don’t think we should add this to go.mod - MITM proxy is using negative serials, which isn’t RFC-compliant, so I'd prefer to avoid allowing something that isn't RFC compliant by default. Let’s just document how to set GODEBUG=x509negativeserial=1 instead for folks who need it.

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